Browse Source

pheft: Fix start estimation in push_task_on_best_worker

Samuel Thibault 5 years ago
parent
commit
1317a457c7
1 changed files with 6 additions and 4 deletions
  1. 6 4
      src/sched_policies/parallel_heft.c

+ 6 - 4
src/sched_policies/parallel_heft.c

@@ -88,7 +88,7 @@ static void parallel_heft_pre_exec_hook(struct starpu_task *task, unsigned sched
 	if (isnan(transfer_model))
 		transfer_model = 0.0;
 
-	/* Once we have executed the task, we can update the predicted amount
+	/* Once we have started the task, we can update the predicted amount
 	 * of work. */
 	starpu_worker_lock_self();
 	worker_exp_len[workerid] -= model + transfer_model;
@@ -98,7 +98,7 @@ static void parallel_heft_pre_exec_hook(struct starpu_task *task, unsigned sched
 	starpu_worker_unlock_self();
 }
 
-static int push_task_on_best_worker(struct starpu_task *task, int best_workerid, double exp_end_predicted, int prio, unsigned sched_ctx_id)
+static int push_task_on_best_worker(struct starpu_task *task, int best_workerid, double exp_start_predicted, double exp_end_predicted, int prio, unsigned sched_ctx_id)
 {
 	/* make sure someone coule execute that task ! */
 	STARPU_ASSERT(best_workerid != -1);
@@ -113,7 +113,7 @@ static int push_task_on_best_worker(struct starpu_task *task, int best_workerid,
 	if (!starpu_worker_is_combined_worker(best_workerid))
 	{
 		starpu_worker_lock(best_workerid);
-		task->predicted = exp_end_predicted - worker_exp_end[best_workerid];
+		task->predicted = exp_end_predicted - exp_start_predicted;
 		/* TODO */
 		task->predicted_transfer = 0;
 		worker_exp_len[best_workerid] += task->predicted;
@@ -275,6 +275,7 @@ static int _parallel_heft_push_task(struct starpu_task *task, unsigned prio, uns
 
 	int skip_worker[nworkers_ctx][STARPU_MAXIMPLEMENTATIONS];
 
+	double best_exp_start;
 	double best_exp_end = DBL_MAX;
 	//double penality_best = 0.0;
 
@@ -461,12 +462,13 @@ static int _parallel_heft_push_task(struct starpu_task *task, unsigned prio, uns
 		//penality_best = local_data_penalty[best_id_ctx][nimpl_best];
 		best_exp_end = local_exp_end[best_id_ctx][nimpl_best];
 	}
+	best_exp_start = _worker_exp_end[best];
 
 	//_STARPU_DEBUG("Scheduler parallel heft: kernel (%u)\n", nimpl_best);
 	starpu_task_set_implementation(task, nimpl_best);
 	/* we should now have the best workerid in variable "best" */
 	starpu_sched_task_break(task);
-	return push_task_on_best_worker(task, best, best_exp_end, prio, sched_ctx_id);
+	return push_task_on_best_worker(task, best, best_exp_start, best_exp_end, prio, sched_ctx_id);
 }
 
 static int parallel_heft_push_task(struct starpu_task *task)