浏览代码

fix queue expected length computation

Samuel Thibault 14 年之前
父节点
当前提交
757e5cafba
共有 2 个文件被更改,包括 8 次插入3 次删除
  1. 5 2
      src/sched_policies/deque_modeling_policy_data_aware.c
  2. 3 1
      src/sched_policies/parallel_heft.c

+ 5 - 2
src/sched_policies/deque_modeling_policy_data_aware.c

@@ -320,8 +320,9 @@ static int _dm_push_task(struct starpu_task *task, unsigned prio)
 		
 		fifo = queue_array[worker];
 
+		/* Sometimes workers didn't take the tasks as early as we expected */
 		fifo->exp_start = STARPU_MAX(fifo->exp_start, starpu_timing_now());
-		fifo->exp_end = STARPU_MAX(fifo->exp_end, starpu_timing_now());
+		fifo->exp_end = fifo->exp_start + fifo->exp_len;
 
 		if (!starpu_worker_may_execute_task(worker, task))
 		{
@@ -409,8 +410,9 @@ static int _dmda_push_task(struct starpu_task *task, unsigned prio)
 	{
 		fifo = queue_array[worker];
 
+		/* Sometimes workers didn't take the tasks as early as we expected */
 		fifo->exp_start = STARPU_MAX(fifo->exp_start, starpu_timing_now());
-		fifo->exp_end = STARPU_MAX(fifo->exp_end, starpu_timing_now());
+		fifo->exp_end = fifo->exp_start + fifo->exp_len;
 
 		if (!starpu_worker_may_execute_task(worker, task))
 		{
@@ -595,6 +597,7 @@ static void deinitialize_dmda_policy(struct starpu_machine_topology_s *topology,
 	_STARPU_DEBUG("total_task_cnt %ld ready_task_cnt %ld -> %f\n", total_task_cnt, ready_task_cnt, (100.0f*ready_task_cnt)/total_task_cnt);
 }
 
+/* TODO: use post_exec_hook to fix the expected start */
 struct starpu_sched_policy_s _starpu_sched_dm_policy = {
 	.init_sched = initialize_dmda_policy,
 	.deinit_sched = deinitialize_dmda_policy,

+ 3 - 1
src/sched_policies/parallel_heft.c

@@ -246,8 +246,9 @@ static int _parallel_heft_push_task(struct starpu_task *task, unsigned prio)
 	{
 		fifo = queue_array[worker];
 
+		/* Sometimes workers didn't take the tasks as early as we expected */
 		fifo->exp_start = STARPU_MAX(fifo->exp_start, starpu_timing_now());
-		fifo->exp_end = STARPU_MAX(fifo->exp_end, starpu_timing_now());
+		fifo->exp_end = fifo->exp_start + fifo->exp_len;
 	}
 
 	for (worker = 0; worker < (nworkers+ncombinedworkers); worker++)
@@ -424,6 +425,7 @@ static void deinitialize_parallel_heft_policy(struct starpu_machine_topology_s *
 		_starpu_destroy_fifo(queue_array[workerid]);
 }
 
+/* TODO: use post_exec_hook to fix the expected start */
 struct starpu_sched_policy_s _starpu_sched_parallel_heft_policy = {
 	.init_sched = initialize_parallel_heft_policy,
 	.deinit_sched = deinitialize_parallel_heft_policy,