Browse Source

add starpu_task_get_name and use it to warn about dmda etc. using a dumb policy when calibration is not finished

Samuel Thibault 8 years ago
parent
commit
fcbb7dd5e1

+ 9 - 0
doc/doxygen/chapters/api/codelet_and_tasks.doxy

@@ -853,6 +853,15 @@ This function returns the task currently executed by the
 worker, or <c>NULL</c> if it is called either from a thread that is not a
 task or simply because there is no task being executed at the moment.
 
+\fn const char *starpu_task_get_name(struct starpu_task *task)
+\ingroup API_Codelet_And_Tasks
+This function returns the name of \p task, i.e. either its task->name field, or
+the name of the corresponding performance model.
+
+\fn const char *starpu_task_get_model_name(struct starpu_task *task)
+\ingroup API_Codelet_And_Tasks
+This function returns the name of the performance model of \p task.
+
 \fn void starpu_codelet_display_stats(struct starpu_codelet *cl)
 \ingroup API_Codelet_And_Tasks
 Output on stderr some statistics on the codelet \p cl.

+ 4 - 1
include/starpu_task.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2016  Université de Bordeaux
+ * Copyright (C) 2010-2017  Université de Bordeaux
  * Copyright (C) 2010, 2011, 2012, 2013, 2014  CNRS
  * Copyright (C) 2011  Télécom-SudParis
  * Copyright (C) 2011, 2014  INRIA
@@ -318,6 +318,9 @@ void starpu_codelet_display_stats(struct starpu_codelet *cl);
 
 struct starpu_task *starpu_task_get_current(void);
 
+const char *starpu_task_get_model_name(struct starpu_task *task);
+const char *starpu_task_get_name(struct starpu_task *task);
+
 void starpu_parallel_task_barrier_init(struct starpu_task *task, int workerid);
 void starpu_parallel_task_barrier_init_n(struct starpu_task *task, int worker_size);
 

+ 7 - 0
src/sched_policies/component_perfmodel_select.c

@@ -44,7 +44,14 @@ static int perfmodel_select_push_task(struct starpu_sched_component * component,
 	if(can_execute)
 	{
 		if(isnan(length))
+		{
+			static int warned;
+			if (!warned) {
+				warned = 1;
+				_STARPU_DISP("Warning: performance model for %s not finished calibrating, using a dumb scheduling heuristic for now\n",starpu_task_get_name(task));
+			}
 			return starpu_sched_component_push_task(component,data->calibrator_component,task);
+		}
 		if(_STARPU_IS_ZERO(length))
 			return starpu_sched_component_push_task(component,data->no_perfmodel_component,task);
 		return starpu_sched_component_push_task(component,data->perfmodel_component,task);

+ 8 - 2
src/sched_policies/deque_modeling_policy_data_aware.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2016  Université de Bordeaux
+ * Copyright (C) 2010-2017  Université de Bordeaux
  * Copyright (C) 2010, 2011, 2012, 2013, 2015, 2016  CNRS
  * Copyright (C) 2011  Télécom-SudParis
  * Copyright (C) 2011-2012, 2016  INRIA
@@ -562,11 +562,17 @@ static int _dm_push_task(struct starpu_task *task, unsigned prio, unsigned sched
 				best_impl = nimpl;
 			}
 
-			if (isnan(local_length))
+			if (isnan(local_length)) {
 				/* we are calibrating, we want to speed-up calibration time
 				 * so we privilege non-calibrated tasks (but still
 				 * greedily distribute them to avoid dumb schedules) */
+				static int warned;
+				if (!warned) {
+					warned = 1;
+					_STARPU_DISP("Warning: performance model for %s not finished calibrating on worker %u, using a dumb scheduling heuristic for now\n", starpu_task_get_name(task), worker);
+				}
 				calibrating = 1;
+			}
 
 			if (isnan(local_length) || _STARPU_IS_ZERO(local_length))
 				/* there is no prediction available for that task

+ 2 - 2
src/sched_policies/graph_test_policy.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2016  Université de Bordeaux
+ * Copyright (C) 2010-2017  Université de Bordeaux
  * Copyright (C) 2010-2013, 2016  CNRS
  * Copyright (C) 2011  INRIA
  *
@@ -124,7 +124,7 @@ static struct _starpu_prio_deque *select_prio(unsigned sched_ctx_id, struct _sta
 		if (length == 0.)
 		{
 			_STARPU_DISP("Warning: graph_test needs performance models for all tasks, including %s\n",
-					_starpu_job_get_task_name(_starpu_get_job_associated_to_task(task)));
+					starpu_task_get_name(task));
 			power = 0.;
 		}
 		else

+ 8 - 2
src/sched_policies/parallel_heft.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2012 INRIA
- * Copyright (C) 2010-2016  Université de Bordeaux
+ * Copyright (C) 2010-2017  Université de Bordeaux
  * Copyright (C) 2011  Télécom-SudParis
  * Copyright (C) 2016  CNRS
  *
@@ -374,11 +374,17 @@ static int _parallel_heft_push_task(struct starpu_task *task, unsigned prio, uns
 				nimpl_best = nimpl;
 			}
 
-			if (isnan(local_task_length[worker_ctx][nimpl]))
+			if (isnan(local_task_length[worker_ctx][nimpl])) {
+				static int warned;
+				if (!warned) {
+					warned = 1;
+					_STARPU_DISP("Warning: performance model for %s not finished calibrating on %u, using a dumb scheduling heuristic for now\n", starpu_task_get_name(task), worker);
+				}
 				/* we are calibrating, we want to speed-up calibration time
 				 * so we privilege non-calibrated tasks (but still
 				 * greedily distribute them to avoid dumb schedules) */
 				calibrating = 1;
+			}
 
 			if (isnan(local_task_length[worker_ctx][nimpl])
 					|| _STARPU_IS_ZERO(local_task_length[worker_ctx][nimpl]))

+ 19 - 1
src/util/misc.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2012, 2015  Université de Bordeaux
+ * Copyright (C) 2012, 2015, 2017  Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -55,3 +55,21 @@ const char *_starpu_job_get_task_name(struct _starpu_job *j)
 	else
 		return _starpu_job_get_model_name(j);
 }
+
+const char *starpu_task_get_model_name(struct starpu_task *task)
+{
+	if (!task)
+		return NULL;
+
+	return _starpu_codelet_get_model_name(task->cl);
+}
+
+const char *starpu_task_get_name(struct starpu_task *task)
+{
+	if (!task)
+		return NULL;
+	if (task->name)
+		return task->name;
+	else
+		return starpu_task_get_model_name(task);
+}