Browse Source

push_task_notify has to take sched_ctx_id as parameter

Andra Hugo 12 years ago
parent
commit
83e975fe61

+ 2 - 2
examples/sched_ctx/sched_ctx.c

@@ -76,8 +76,8 @@ int main(int argc, char **argv)
 #endif
 
 	/*create contexts however you want*/
-	unsigned sched_ctx1 = starpu_create_sched_ctx("heft", procs1, nprocs1, "ctx1");
-	unsigned sched_ctx2 = starpu_create_sched_ctx("heft", procs2, nprocs2, "ctx2");
+	unsigned sched_ctx1 = starpu_create_sched_ctx("dmda", procs1, nprocs1, "ctx1");
+	unsigned sched_ctx2 = starpu_create_sched_ctx("dmda", procs2, nprocs2, "ctx2");
 
 	/*indicate what to do with the resources when context 2 finishes (it depends on your application)*/
 	starpu_sched_ctx_set_inheritor(sched_ctx2, sched_ctx1);

+ 1 - 1
include/starpu_scheduler.h

@@ -87,7 +87,7 @@ struct starpu_sched_policy
 	 * task is explicitely assigned to a worker. This method therefore
 	 * permits to keep the timing state of the scheduler coherent even
 	 * when StarPU bypasses the scheduling strategy. */
-	void (*push_task_notify)(struct starpu_task *, int workerid);
+	void (*push_task_notify)(struct starpu_task *, int workerid, unsigned sched_ctx_id);
 
 	/* Get a task from the scheduler. The mutex associated to the worker is
 	 * already taken when this method is called. */

+ 1 - 1
src/core/sched_policy.c

@@ -217,7 +217,7 @@ static int _starpu_push_task_on_specific_worker(struct starpu_task *task, int wo
 		sched_ctx = worker->sched_ctx[i];
 		if (sched_ctx != NULL && sched_ctx->sched_policy != NULL && sched_ctx->sched_policy->push_task_notify)
 		{
-			sched_ctx->sched_policy->push_task_notify(task, workerid);
+			sched_ctx->sched_policy->push_task_notify(task, workerid, sched_ctx->id);
 		}
 
 	}

+ 1 - 2
src/sched_policies/deque_modeling_policy_data_aware.c

@@ -857,9 +857,8 @@ static void dmda_pre_exec_hook(struct starpu_task *task)
 	_STARPU_PTHREAD_MUTEX_UNLOCK(sched_mutex);
 }
 
-static void dmda_push_task_notify(struct starpu_task *task, int workerid)
+static void dmda_push_task_notify(struct starpu_task *task, int workerid, unsigned sched_ctx_id)
 {
-	unsigned sched_ctx_id = task->sched_ctx;
 	dmda_data *dt = (dmda_data*)starpu_get_sched_ctx_policy_data(sched_ctx_id);
 	struct _starpu_fifo_taskq *fifo = dt->queue_array[workerid];
 	/* Compute the expected penality */