浏览代码

add new function starpu_sched_ctx_get_sched_policy and remove function starpu_sched_policy_set_post_exec_hook

Nathalie Furmento 8 年之前
父节点
当前提交
35f33868f3
共有 4 个文件被更改,包括 8 次插入15 次删除
  1. 2 0
      include/starpu_sched_ctx.h
  2. 0 1
      include/starpu_scheduler.h
  3. 6 0
      src/core/sched_ctx.c
  4. 0 14
      src/core/sched_policy.c

+ 2 - 0
include/starpu_sched_ctx.h

@@ -119,6 +119,8 @@ void starpu_sched_ctx_set_policy_data(unsigned sched_ctx_id, void *policy_data);
 
 void *starpu_sched_ctx_get_policy_data(unsigned sched_ctx_id);
 
+struct starpu_sched_policy *starpu_sched_ctx_get_sched_policy(unsigned sched_ctx_id);
+
 void *starpu_sched_ctx_exec_parallel_code(void* (*func)(void*), void *param, unsigned sched_ctx_id);
 
 int starpu_sched_ctx_get_nready_tasks(unsigned sched_ctx_id);

+ 0 - 1
include/starpu_scheduler.h

@@ -55,7 +55,6 @@ struct starpu_sched_policy
 };
 
 struct starpu_sched_policy **starpu_sched_get_predefined_policies();
-void starpu_sched_policy_set_post_exec_hook(void (*post_exec_hook)(struct starpu_task *task, unsigned sched_ctx_id), const char *policy_name);
 
 void starpu_worker_get_sched_condition(int workerid, starpu_pthread_mutex_t **sched_mutex, starpu_pthread_cond_t **sched_cond);
 

+ 6 - 0
src/core/sched_ctx.c

@@ -1719,6 +1719,12 @@ void* starpu_sched_ctx_get_policy_data(unsigned sched_ctx_id)
 	return sched_ctx->policy_data;
 }
 
+struct starpu_sched_policy *starpu_sched_ctx_get_sched_policy(unsigned sched_ctx_id)
+{
+	struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(sched_ctx_id);
+	return sched_ctx->sched_policy;
+}
+
 struct starpu_worker_collection* starpu_sched_ctx_create_worker_collection(unsigned sched_ctx_id, enum starpu_worker_collection_type  worker_collection_type)
 {
 	struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(sched_ctx_id);

+ 0 - 14
src/core/sched_policy.c

@@ -87,20 +87,6 @@ struct starpu_sched_policy *_starpu_get_sched_policy(struct _starpu_sched_ctx *s
 	return sched_ctx->sched_policy;
 }
 
-void starpu_sched_policy_set_post_exec_hook(void (*post_exec_hook)(struct starpu_task *task, unsigned sched_ctx_id), const char *policy_name)
-{
-	int i;
-	struct _starpu_sched_ctx *sched_ctx;
-	for(i = 0; i < STARPU_NMAX_SCHED_CTXS; i++)
-	{
-		sched_ctx = _starpu_get_sched_ctx_struct(i);
-		if (sched_ctx && sched_ctx->sched_policy)
-			sched_ctx->sched_policy->post_exec_hook = post_exec_hook;
-		else
-			break;
-	}
-}
-
 /*
  *	Methods to initialize the scheduling policy
  */