ソースを参照

scheduler: function starpu_push_task_end is now public as it needs to be called by schedulers

Nathalie Furmento 12 年 前
コミット
a33a7476f9

+ 5 - 0
doc/chapters/advanced-api.texi

@@ -1031,6 +1031,11 @@ where the worker will pop tasks first. Setting @var{back} to 0 therefore ensures
 a FIFO ordering.
 @end deftypefun
 
+@deftypefun int starpu_push_task_end ({struct starpu_task} *@var{task})
+This function must be called by a scheduler to notify that the given
+task has just been pushed.
+@end deftypefun
+
 @deftypefun int starpu_worker_can_execute_task (unsigned @var{workerid}, {struct starpu_task *}@var{task}, unsigned {nimpl})
 Check if the worker specified by workerid can execute the codelet. Schedulers need to call it before assigning a task to a worker, otherwise the task may fail to execute.
 @end deftypefun

+ 1 - 1
examples/scheduler/dummy_sched.c

@@ -73,7 +73,7 @@ static int push_task_dummy(struct starpu_task *task)
 
 	starpu_task_list_push_front(&data->sched_list, task);
 
-	_starpu_push_task_end(task);
+	starpu_push_task_end(task);
 	pthread_mutex_unlock(&data->policy_mutex);
 
 

+ 3 - 0
include/starpu_scheduler.h

@@ -139,6 +139,9 @@ int starpu_worker_can_execute_task(unsigned workerid, struct starpu_task *task,
  * a FIFO ordering. */
 int starpu_push_local_task(int workerid, struct starpu_task *task, int back);
 
+/* Called by scheduler to notify that the task has just been pushed */
+int starpu_push_task_end(struct starpu_task *task);
+
 /*
  *	Priorities
  */

+ 1 - 1
src/core/jobs.c

@@ -439,7 +439,7 @@ int _starpu_push_local_task(struct _starpu_worker *worker, struct starpu_task *t
 		starpu_task_list_push_front(&worker->local_tasks, task);
 
 	_STARPU_PTHREAD_COND_BROADCAST(&worker->sched_cond);
-	_starpu_push_task_end(task);
+	starpu_push_task_end(task);
 	_STARPU_PTHREAD_MUTEX_UNLOCK(&worker->sched_mutex);
 
 	return 0;

+ 2 - 2
src/core/sched_policy.c

@@ -278,7 +278,7 @@ static int _starpu_push_task_on_specific_worker(struct starpu_task *task, int wo
 
 		/* Note: we have to call that early, or else the task may have
 		 * disappeared already */
-		_starpu_push_task_end(task);
+		starpu_push_task_end(task);
 
 		int j;
 		for (j = 0; j < worker_size; j++)
@@ -415,7 +415,7 @@ int _starpu_push_task_to_workers(struct starpu_task *task)
 /* This is called right after the scheduler has pushed a task to a queue
  * but just before releasing mutexes: we need the task to still be alive!
  */
-int _starpu_push_task_end(struct starpu_task *task)
+int starpu_push_task_end(struct starpu_task *task)
 {
 	_starpu_profiling_set_task_push_end_time(task);
 	task->scheduled = 1;

+ 0 - 3
src/core/sched_policy.h

@@ -36,9 +36,6 @@ int _starpu_push_task(struct _starpu_job *task);
 /* actually pushes the tasks to the specific worker or to the scheduler */
 int _starpu_push_task_to_workers(struct starpu_task *task);
 
-/* Called by scheduler to notify that the task has just been pushed */
-int _starpu_push_task_end(struct starpu_task *task);
-
 /* pop a task that can be executed on the worker */
 struct starpu_task *_starpu_pop_task(struct _starpu_worker *worker);
 /* pop every task that can be executed on the worker */

+ 2 - 2
src/sched_policies/deque_modeling_policy_data_aware.c

@@ -340,7 +340,7 @@ static int push_task_on_best_worker(struct starpu_task *task, int best_workerid,
 		_STARPU_PTHREAD_MUTEX_LOCK(sched_mutex);
 		ret =_starpu_fifo_push_sorted_task(dt->queue_array[best_workerid], task);
 		_STARPU_PTHREAD_COND_SIGNAL(sched_cond);
-		_starpu_push_task_end(task);
+		starpu_push_task_end(task);
 		_STARPU_PTHREAD_MUTEX_UNLOCK(sched_mutex);
 	}
 	else
@@ -348,7 +348,7 @@ static int push_task_on_best_worker(struct starpu_task *task, int best_workerid,
 		_STARPU_PTHREAD_MUTEX_LOCK(sched_mutex);
 		ret = _starpu_fifo_push_task(dt->queue_array[best_workerid], task);
 		_STARPU_PTHREAD_COND_SIGNAL(sched_cond);
-		_starpu_push_task_end(task);
+		starpu_push_task_end(task);
 		_STARPU_PTHREAD_MUTEX_UNLOCK(sched_mutex);
 	}
 

+ 2 - 2
src/sched_policies/eager_central_policy.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2013  Université de Bordeaux 1
- * Copyright (C) 2010-2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010-2013  Centre National de la Recherche Scientifique
  * Copyright (C) 2011  INRIA
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -79,7 +79,7 @@ static int push_task_eager_policy(struct starpu_task *task)
 	_STARPU_PTHREAD_MUTEX_LOCK(&data->policy_mutex);
 	ret_val = _starpu_fifo_push_task(data->fifo, task);
 
-	_starpu_push_task_end(task);
+	starpu_push_task_end(task);
 	_STARPU_PTHREAD_MUTEX_UNLOCK(&data->policy_mutex);
 
 

+ 2 - 2
src/sched_policies/eager_central_priority_policy.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2013  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  * Copyright (C) 2011  INRIA
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -129,7 +129,7 @@ static int _starpu_priority_push_task(struct starpu_task *task)
 	starpu_task_list_push_back(&taskq->taskq[priolevel], task);
 	taskq->ntasks[priolevel]++;
 	taskq->total_ntasks++;
-	_starpu_push_task_end(task);
+	starpu_push_task_end(task);
 	_STARPU_PTHREAD_MUTEX_UNLOCK(&data->policy_mutex);
 
 	/*if there are no tasks block */

+ 1 - 1
src/sched_policies/parallel_eager.c

@@ -190,7 +190,7 @@ static int push_task_peager_policy(struct starpu_task *task)
 	
 	
 	ret_val = _starpu_fifo_push_task(data->fifo, task);
-	_starpu_push_task_end(task);
+	starpu_push_task_end(task);
 
 	while(workers->has_next(workers, &it))
 	{

+ 2 - 2
src/sched_policies/work_stealing_policy.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2013  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  * Copyright (C) 2011, 2012  INRIA
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -382,7 +382,7 @@ int ws_push_task(struct starpu_task *task)
 #endif
 	_starpu_job_list_push_back(deque_queue->jobq, j);
 	deque_queue->njobs++;
-	_starpu_push_task_end(task);
+	starpu_push_task_end(task);
 
 	while(workers->has_next(workers, &it))
 	{