瀏覽代碼

fix counter decrementation + make prio work with nested sched_ctxs + make a sched_ctx example use prio

Andra Hugo 10 年之前
父節點
當前提交
ef03e9fe5b

+ 1 - 1
examples/sched_ctx/parallel_tasks_reuse_handle.c

@@ -92,7 +92,7 @@ void parallel_task_init()
 	
 	main_context.id = starpu_sched_ctx_create(main_context.cpus,
 						  main_context.ncpus,"main_ctx",
-						  STARPU_SCHED_CTX_POLICY_NAME,"eager",
+						  STARPU_SCHED_CTX_POLICY_NAME,"prio",
 						  0);
 	
 	

+ 1 - 1
src/sched_policies/deque_modeling_policy_data_aware.c

@@ -289,8 +289,8 @@ static int push_task_on_best_worker(struct starpu_task *task, int best_workerid,
 	unsigned child_sched_ctx = starpu_sched_ctx_worker_is_master_for_child_ctx(best_workerid, sched_ctx_id);
         if(child_sched_ctx != STARPU_NMAX_SCHED_CTXS)
         {
-		starpu_sched_ctx_revert_task_counters(sched_ctx_id, task->flops);
                 starpu_sched_ctx_move_task_to_ctx(task, child_sched_ctx);
+		starpu_sched_ctx_revert_task_counters(sched_ctx_id, task->flops);
                 return 0;
         }
 

+ 12 - 0
src/sched_policies/eager_central_priority_policy.c

@@ -284,6 +284,18 @@ static struct starpu_task *_starpu_priority_pop_task(unsigned sched_ctx_id)
 	/* leave the mutex how it was found before this */
 	STARPU_PTHREAD_MUTEX_LOCK(curr_sched_mutex);
 
+	if(chosen_task)
+	{
+		unsigned child_sched_ctx = starpu_sched_ctx_worker_is_master_for_child_ctx(workerid, sched_ctx_id);
+		if(child_sched_ctx != STARPU_NMAX_SCHED_CTXS)
+		{
+			starpu_sched_ctx_move_task_to_ctx(chosen_task, child_sched_ctx);
+			starpu_sched_ctx_revert_task_counters(sched_ctx_id, chosen_task->flops);
+			return NULL;
+		}
+	}
+
+
 	return chosen_task;
 }