Przeglądaj źródła

The predicted duration is now part of the task structure instead of the job
structure. The penality field of the job structure was also removed as it was
unused.

Cédric Augonnet 15 lat temu
rodzic
commit
7cdfe5ce33

+ 4 - 0
doc/starpu.texi

@@ -1772,6 +1772,10 @@ allocated data structures will not be freed until @code{starpu_task_destroy} is
 called explicitly. Setting this flag for a statically allocated task structure
 will result in undefined behaviour.
 
+@item @code{predicted} (output field):
+Predicted duration of the task. This field is only set if the scheduling
+strategy used performance models.
+
 @end table
 @end table
 

+ 5 - 0
include/starpu_task.h

@@ -127,6 +127,10 @@ struct starpu_task {
 
 	struct starpu_task_profiling_info *profiling_info;
 
+	/* Predicted duration of the task. This field is only valid if the
+	 * scheduling strategy uses performance models. */
+	double predicted;
+
 	/* this is private to StarPU, do not modify. If the task is allocated
 	 * by hand (without starpu_task_create), this field should be set to
 	 * NULL. */
@@ -152,6 +156,7 @@ struct starpu_task {
 	.regenerate = 0,				\
 	.status = STARPU_TASK_INVALID,			\
 	.profiling_info = NULL,				\
+	.predicted = -1.0,				\
 	.starpu_private = NULL				\
 };
 

+ 0 - 1
src/core/jobs.c

@@ -61,7 +61,6 @@ starpu_job_t __attribute__((malloc)) _starpu_job_create(struct starpu_task *task
 
 	job->task = task;
 
-	job->predicted = 0.0;
 	job->footprint_is_computed = 0;
 	job->submitted = 0;
 	job->terminated = 0;

+ 0 - 3
src/core/jobs.h

@@ -65,9 +65,6 @@ LIST_TYPE(starpu_job,
 	struct starpu_tag_s *tag;
 	struct starpu_cg_list_s job_successors;
 
-	double predicted;
-	double penality;
-
 	unsigned footprint_is_computed;
 	uint32_t footprint;
 

+ 2 - 2
src/core/perfmodel/perfmodel_history.c

@@ -637,16 +637,16 @@ void _starpu_update_perfmodel_history(starpu_job_t j, enum starpu_perf_archtype
 		}
 
 #ifdef STARPU_MODEL_DEBUG
+		struct starpu_task *task = j->task;
 		FILE * debug_file = per_arch_model->debug_file;
 
 		PTHREAD_RWLOCK_WRLOCK(&model->model_rwlock);
 
 		STARPU_ASSERT(j->footprint_is_computed);
 
-		fprintf(debug_file, "0x%x\t%lu\t%lf\t%lf\t%d\t\t", j->footprint, (unsigned long) _starpu_job_get_data_size(j), measured, j->predicted, cpuid);
+		fprintf(debug_file, "0x%x\t%lu\t%lf\t%lf\t%d\t\t", j->footprint, (unsigned long) _starpu_job_get_data_size(j), measured, task->predicted, cpuid);
 		unsigned i;
 			
-		struct starpu_task *task = j->task;
 		for (i = 0; i < task->cl->nbuffers; i++)
 		{
 			struct starpu_data_handle_t *handle = task->buffers[i].handle;

+ 3 - 3
src/core/policies/deque_modeling_policy.c

@@ -34,7 +34,7 @@ static starpu_job_t dm_pop_task(void)
 
 	j = _starpu_fifo_pop_task(fifo);
 	if (j) {
-		double model = j->predicted;
+		double model = j->task->predicted;
 	
 		fifo->exp_len -= model;
 		fifo->exp_start = _starpu_timing_now() + model;
@@ -59,7 +59,7 @@ static struct starpu_job_list_s *dm_pop_every_task(uint32_t where)
 			i != starpu_job_list_end(new_list);
 			i = starpu_job_list_next(i))
 		{
-			double model = i->predicted;
+			double model = i->task->predicted;
 	
 			fifo->exp_len -= model;
 			fifo->exp_start = _starpu_timing_now() + model;
@@ -134,7 +134,7 @@ static int _dm_push_task(starpu_job_t j, unsigned prio)
 	fifo->exp_end += model_best;
 	fifo->exp_len += model_best;
 
-	j->predicted = model_best;
+	j->task->predicted = model_best;
 
 	unsigned memory_node = starpu_worker_get_memory_node(best);
 

+ 2 - 3
src/core/policies/deque_modeling_policy_data_aware.c

@@ -35,7 +35,7 @@ static starpu_job_t dmda_pop_task(void)
 
 	j = _starpu_fifo_pop_task(fifo);
 	if (j) {
-		double model = j->predicted;
+		double model = j->task->predicted;
 	
 		fifo->exp_len -= model;
 		fifo->exp_start = _starpu_timing_now() + model;
@@ -166,8 +166,7 @@ static int _dmda_push_task(starpu_job_t j, unsigned prio)
 	fifo->exp_end += model_best;
 	fifo->exp_len += model_best;
 
-	j->predicted = model_best;
-	j->penality = penality_best;
+	j->task->predicted = model_best;
 
 	unsigned memory_node = starpu_worker_get_memory_node(best);
 

+ 2 - 0
src/core/task.c

@@ -68,6 +68,8 @@ void starpu_task_init(struct starpu_task *task)
 
 	task->profiling_info = NULL;
 
+	task->predicted = -1.0;
+
 	task->starpu_private = NULL;
 }