Browse Source

Add a "post_exec_hook" method in the scheduler interface. This function is
called after the execution of the task.

Cédric Augonnet 14 years ago
parent
commit
93ac947e65

+ 2 - 0
include/starpu_scheduler.h

@@ -67,6 +67,8 @@ struct starpu_sched_policy_s {
 	int (*push_prio_task)(struct starpu_task *);
 	struct starpu_task *(*pop_task)(void);
 
+	void (*post_exec_hook)(struct starpu_task *);
+
 	 /* Remove all available tasks from the scheduler (tasks are chained by
 	  * the means of the prev and next fields of the starpu_task
 	  * structure). */

+ 2 - 0
src/core/jobs.c

@@ -156,6 +156,8 @@ void _starpu_handle_job_termination(starpu_job_t j, unsigned job_is_already_lock
 		_starpu_set_local_worker_status(STATUS_UNKNOWN);
 	}
 
+	_starpu_sched_post_exec_hook(task);
+
 	STARPU_TRACE_TASK_DONE(j);
 
 	/* NB: we do not save those values before the callback, in case the

+ 6 - 0
src/core/policies/sched_policy.c

@@ -245,6 +245,12 @@ struct starpu_task *_starpu_pop_every_task(uint32_t where)
 	return policy.pop_every_task(where);
 }
 
+void _starpu_sched_post_exec_hook(struct starpu_task *task)
+{
+	if (policy.post_exec_hook)
+		policy.post_exec_hook(task);
+}
+
 void _starpu_wait_on_sched_event(void)
 {
 	struct starpu_worker_s *worker = _starpu_get_local_worker_key();

+ 1 - 0
src/core/policies/sched_policy.h

@@ -33,6 +33,7 @@ int _starpu_get_prefetch_flag(void);
 int _starpu_push_task(starpu_job_t task, unsigned job_is_already_locked);
 struct starpu_task *_starpu_pop_task(void);
 struct starpu_task *_starpu_pop_every_task(uint32_t where);
+void _starpu_sched_post_exec_hook(struct starpu_task *task);
 
 void _starpu_wait_on_sched_event(void);