Browse Source

refactoring

Andra Hugo 13 years ago
parent
commit
3eee9c2521

+ 3 - 3
include/starpu_scheduler.h

@@ -106,10 +106,10 @@ struct starpu_sched_policy
 	/* This method is called every time a task has been executed. (optional) */
 	void (*post_exec_hook)(struct starpu_task *);
 
-	/* Initialize the scheduling policy for added workers. */
+	/* Initialize scheduling structures corresponding to each worker. */
 	void (*add_workers)(unsigned sched_ctx_id, int *workerids, unsigned nworkers);
 
-	/* Deinitialize the scheduling policy for removed workers. */
+	/* Deinitialize scheduling structures corresponding to each worker. */
 	void (*remove_workers)(unsigned sched_ctx_id, int *workerids, unsigned nworkers);
 
 	/* Name of the policy (optionnal) */
@@ -145,7 +145,7 @@ struct starpu_performance_counters {
 };
 
 #ifdef STARPU_BUILD_SCHED_CTX_HYPERVISOR
-unsigned starpu_create_sched_ctx_with_perf_counters(const char *policy_name, int *workerids_ctx, int nworkers_ctx, const char *sched_name, struct starpu_performance_counters *perf_counters);
+void starpu_set_perf_counters(unsigned sched_ctx_id, struct starpu_performance_counters *perf_counters);
 void starpu_call_poped_task_cb(int workerid, unsigned sched_ctx_id, double flops);
 void starpu_call_pushed_task_cb(int workerid, unsigned sched_ctx_id);
 #endif //STARPU_BUILD_SCHED_CTX_HYPERVISOR

+ 4 - 2
sched_ctx_hypervisor/examples/sched_ctx_utils/sched_ctx_utils.c

@@ -247,7 +247,8 @@ void construct_contexts(void (*bench)(float*, unsigned, unsigned))
 	for(i = 0; i < 12; i++)
 		p1.workers[i] = i; 
 
-	p1.ctx = starpu_create_sched_ctx_with_perf_counters("heft", p1.workers, nworkers1, "sched_ctx1", perf_counters);
+	p1.ctx = starpu_create_sched_ctx("heft", p1.workers, nworkers1, "sched_ctx1");
+	starpu_set_perf_counters(p1.ctx, perf_counters);
 	p2.the_other_ctx = (int)p1.ctx;
 	p1.nworkers = nworkers1;
 	sched_ctx_hypervisor_register_ctx(p1.ctx, 0.0);
@@ -282,7 +283,8 @@ void construct_contexts(void (*bench)(float*, unsigned, unsigned))
 	/* for(i = n_all_gpus  + cpu1; i < n_all_gpus + cpu1 + cpu2; i++) */
 	/* 	p2.workers[k++] = i; */
 
-	p2.ctx = starpu_create_sched_ctx_with_perf_counters("heft", p2.workers, 0, "sched_ctx2", perf_counters);
+	p2.ctx = starpu_create_sched_ctx("heft", p2.workers, 0, "sched_ctx2");
+	starpu_set_perf_counters(p2.ctx, perf_counters);
 	p1.the_other_ctx = (int)p2.ctx;
 	p2.nworkers = 0;
 	sched_ctx_hypervisor_register_ctx(p2.ctx, 0.0);

+ 1 - 4
src/core/sched_ctx.c

@@ -238,11 +238,8 @@ unsigned starpu_create_sched_ctx(const char *policy_name, int *workerids,
 }
 
 #ifdef STARPU_USE_SCHED_CTX_HYPERVISOR
-unsigned starpu_create_sched_ctx_with_perf_counters(const char *policy_name, int *workerids, 
-				 int nworkers_ctx, const char *sched_name,
-				 struct starpu_performance_counters *perf_counters)
+void starpu_set_perf_counters(unsigned sched_ctx_id, struct starpu_performance_counters *perf_counters)
 {
-	unsigned sched_ctx_id = starpu_create_sched_ctx(policy_name, workerids, nworkers_ctx, sched_name);
 	struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(sched_ctx_id);
 	sched_ctx->perf_counters = perf_counters;
 	return sched_ctx_id;