瀏覽代碼

renaming
--This line, and those eelow, will be ignored--

M include/starpu_scheduler.h
M src/core/sched_ctx.c
M src/core/sched_policy.c
M src/core/sched_ctx.h
M sched_ctx_hypervisor/src/sched_ctx_hypervisor.c
M sched_ctx_hypervisor/examples/sched_ctx_utils/sched_ctx_utils.c

Andra Hugo 13 年之前
父節點
當前提交
90cca0e7c4

+ 7 - 8
include/starpu_scheduler.h

@@ -127,17 +127,16 @@ struct worker_collection {
 
 #define WORKER_LIST 0
 
-struct starpu_sched_ctx_hypervisor_criteria {
-	void (*idle_time_cb)(unsigned sched_ctx, int worker, double idle_time);
-	void (*reset_idle_time_cb)(unsigned sched_ctx, int worker);
-	void (*working_time_cb)(unsigned sched_ctx, double working_time);
-	void (*pushed_task_cb)(unsigned sched_ctx, int worker);
-	void (*poped_task_cb)(unsigned sched_ctx, int worker, double flops);
-	void (*post_exec_hook_cb)(unsigned sched_ctx, int taskid);
+struct starpu_performance_counters {
+	void (*notify_idle_cycle)(unsigned sched_ctx, int worker, double idle_time);
+	void (*notify_idle_end)(unsigned sched_ctx, int worker);
+	void (*notify_pushed_task)(unsigned sched_ctx, int worker);
+	void (*notify_poped_task)(unsigned sched_ctx, int worker, double flops);
+	void (*notify_post_exec_hook)(unsigned sched_ctx, int taskid);
 };
 
 #ifdef STARPU_BUILD_SCHED_CTX_HYPERVISOR
-unsigned starpu_create_sched_ctx_with_criteria(const char *policy_name, int *workerids_ctx, int nworkers_ctx, const char *sched_name, struct starpu_sched_ctx_hypervisor_criteria **criteria);
+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_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

+ 3 - 3
sched_ctx_hypervisor/examples/sched_ctx_utils/sched_ctx_utils.c

@@ -222,7 +222,7 @@ void start_2ndbench(void (*bench)(float*, unsigned, unsigned))
 
 void construct_contexts(void (*bench)(float*, unsigned, unsigned))
 {
-	struct starpu_sched_ctx_hypervisor_criteria *criteria = sched_ctx_hypervisor_init(IDLE_POLICY);
+	struct starpu_performance_counters *perf_counters = sched_ctx_hypervisor_init(IDLE_POLICY);
 	int nworkers1 = cpu1 + gpu + gpu1;
 	int nworkers2 = cpu2 + gpu + gpu2;
 	unsigned n_all_gpus = gpu + gpu1 + gpu2;
@@ -247,7 +247,7 @@ 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_criteria("heft", p1.workers, nworkers1, "sched_ctx1", criteria);
+	p1.ctx = starpu_create_sched_ctx_with_perf_counters("heft", p1.workers, nworkers1, "sched_ctx1", perf_counters);
 	p2.the_other_ctx = (int)p1.ctx;
 	p1.nworkers = nworkers1;
 	sched_ctx_hypervisor_handle_ctx(p1.ctx, 0.0);
@@ -282,7 +282,7 @@ 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_criteria("heft", p2.workers, 0, "sched_ctx2", criteria);
+	p2.ctx = starpu_create_sched_ctx_with_perf_counters("heft", p2.workers, 0, "sched_ctx2", perf_counters);
 	p1.the_other_ctx = (int)p2.ctx;
 	p2.nworkers = 0;
 	sched_ctx_hypervisor_handle_ctx(p2.ctx, 0.0);

+ 17 - 17
sched_ctx_hypervisor/src/sched_ctx_hypervisor.c

@@ -1,7 +1,7 @@
 #include <sched_ctx_hypervisor_intern.h>
 
 unsigned imposed_resize = 0;
-struct starpu_sched_ctx_hypervisor_criteria* criteria = NULL;
+struct starpu_performance_counters* perf_counters = NULL;
 
 extern struct hypervisor_policy idle_policy;
 extern struct hypervisor_policy app_driven_policy;
@@ -36,7 +36,7 @@ static void _load_hypervisor_policy(int type)
 	hypervisor.policy.resize = policy->resize;
 }
 
-struct starpu_sched_ctx_hypervisor_criteria** sched_ctx_hypervisor_init(int type)
+struct starpu_performance_counters** sched_ctx_hypervisor_init(int type)
 {
 	hypervisor.min_tasks = 0;
 	hypervisor.nsched_ctxs = 0;
@@ -73,13 +73,13 @@ struct starpu_sched_ctx_hypervisor_criteria** sched_ctx_hypervisor_init(int type
 
 	_load_hypervisor_policy(type);
 
-	criteria = (struct starpu_sched_ctx_hypervisor_criteria*)malloc(sizeof(struct starpu_sched_ctx_hypervisor_criteria));
-	criteria->idle_time_cb = idle_time_cb;
-	criteria->pushed_task_cb = pushed_task_cb;
-	criteria->poped_task_cb = poped_task_cb;
-	criteria->post_exec_hook_cb = post_exec_hook_cb;
-	criteria->reset_idle_time_cb = reset_idle_time_cb;
-	return criteria;
+	perf_counters = (struct starpu_performance_counters*)malloc(sizeof(struct starpu_performance_counters));
+	perf_counters->notify_idle_cycle = idle_time_cb;
+	perf_counters->notify_pushed_task = pushed_task_cb;
+	perf_counters->notify_poped_task = poped_task_cb;
+	perf_counters->notify_post_exec_hook = post_exec_hook_cb;
+	perf_counters->notify_idle_end = reset_idle_time_cb;
+	return perf_counters;
 }
 
 void sched_ctx_hypervisor_stop_resize(unsigned sched_ctx)
@@ -106,14 +106,14 @@ void sched_ctx_hypervisor_shutdown(void)
 			sched_ctx_hypervisor_ignore_ctx(hypervisor.sched_ctxs[i]);
 		}
 	}
-	criteria->idle_time_cb = NULL;
-	criteria->pushed_task_cb = NULL;
-	criteria->poped_task_cb = NULL;
-	criteria->post_exec_hook_cb = NULL;
-	criteria->reset_idle_time_cb = NULL;
-
-	free(criteria);
-	criteria = NULL;
+	perf_counters->notify_idle_cycle = NULL;
+	perf_counters->notify_pushed_task = NULL;
+	perf_counters->notify_poped_task = NULL;
+	perf_counters->notify_post_exec_hook = NULL;
+	perf_counters->notify_idle_end = NULL;
+
+	free(perf_counters);
+	perf_counters = NULL;
 
 	pthread_mutex_destroy(&act_hypervisor_mutex);
 }

+ 7 - 7
src/core/sched_ctx.c

@@ -232,13 +232,13 @@ unsigned starpu_create_sched_ctx(const char *policy_name, int *workerids,
 }
 
 #ifdef STARPU_USE_SCHED_CTX_HYPERVISOR
-unsigned starpu_create_sched_ctx_with_criteria(const char *policy_name, int *workerids, 
+unsigned starpu_create_sched_ctx_with_perf_counters(const char *policy_name, int *workerids, 
 				 int nworkers_ctx, const char *sched_name,
-				 struct starpu_sched_ctx_hypervisor_criteria **criteria)
+				 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->criteria = criteria;
+	sched_ctx->perf_counters = perf_counters;
 	return sched_ctx_id;
 }
 #endif
@@ -692,8 +692,8 @@ void starpu_call_poped_task_cb(int workerid, unsigned sched_ctx_id, double flops
 	struct starpu_worker_s *worker =  _starpu_get_worker_struct(workerid);
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(sched_ctx_id);
 	if(sched_ctx != NULL && sched_ctx_id != 0 && sched_ctx_id != STARPU_NMAX_SCHED_CTXS
-		   && *sched_ctx->criteria != NULL)
-		(*sched_ctx->criteria)->poped_task_cb(sched_ctx_id, worker->workerid, flops);
+		   && *sched_ctx->perf_counters != NULL)
+		(*sched_ctx->perf_counters)->notify_poped_task(sched_ctx_id, worker->workerid, flops);
 }
 
 void starpu_call_pushed_task_cb(int workerid, unsigned sched_ctx_id)
@@ -702,8 +702,8 @@ void starpu_call_pushed_task_cb(int workerid, unsigned sched_ctx_id)
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(sched_ctx_id);
 
 	if(sched_ctx != NULL && sched_ctx_id != 0)
-		if(*sched_ctx->criteria != NULL)
-			(*sched_ctx->criteria)->pushed_task_cb(sched_ctx_id, workerid);
+		if(*sched_ctx->perf_counters != NULL)
+			(*sched_ctx->perf_counters)->notify_pushed_task(sched_ctx_id, workerid);
 
 }
 

+ 2 - 2
src/core/sched_ctx.h

@@ -70,8 +70,8 @@ struct starpu_sched_ctx {
 	pthread_mutex_t empty_ctx_mutex;
 
 #ifdef STARPU_USE_SCHED_CTX_HYPERVISOR
-	/* a structure containing a series of criteria determining the resize procedure */
-	struct starpu_sched_ctx_hypervisor_criteria **criteria;
+	/* a structure containing a series of performance counters determining the resize procedure */
+	struct starpu_performance_counters **perf_counters;
 #endif //STARPU_USE_SCHED_CTX_HYPERVISOR
 };
 

+ 8 - 8
src/core/sched_policy.c

@@ -443,20 +443,20 @@ struct starpu_task *_starpu_pop_task(struct starpu_worker_s *worker)
 #ifdef STARPU_USE_SCHED_CTX_HYPERVISOR
 	unsigned i;
 	struct starpu_sched_ctx *sched_ctx = NULL;
-	struct starpu_sched_ctx_hypervisor_criteria **criteria = NULL;
+	struct starpu_performance_counters **perf_counters = NULL;
 	for(i = 0; i < STARPU_NMAX_SCHED_CTXS; i++)
 	{
 		sched_ctx = worker->sched_ctx[i];
 		if(sched_ctx != NULL && sched_ctx->id != 0)
 		{
-			criteria = sched_ctx->criteria;
-			if(criteria != NULL && *criteria != NULL && 
-			   (*criteria)->idle_time_cb && (*criteria)->reset_idle_time_cb)
+			perf_counters = sched_ctx->perf_counters;
+			if(perf_counters != NULL && *perf_counters != NULL && 
+			   (*perf_counters)->notify_idle_cycle && (*perf_counters)->notify_idle_end)
 			{
 				if(!task)
-					(*criteria)->idle_time_cb(sched_ctx->id, worker->workerid, 1.0);
+					(*perf_counters)->notify_idle_cycle(sched_ctx->id, worker->workerid, 1.0);
 				else
-					(*criteria)->reset_idle_time_cb(sched_ctx->id, worker->workerid);
+					(*perf_counters)->notify_idle_end(sched_ctx->id, worker->workerid);
 			}
 		}
 	}
@@ -479,8 +479,8 @@ void _starpu_sched_post_exec_hook(struct starpu_task *task)
 
 #ifdef STARPU_USE_SCHED_CTX_HYPERVISOR
 	if(task->hypervisor_tag > 0 && sched_ctx != NULL && 
-	   sched_ctx->id != 0 && *sched_ctx->criteria != NULL)
-		(*sched_ctx->criteria)->post_exec_hook_cb(sched_ctx->id, task->hypervisor_tag);
+	   sched_ctx->id != 0 && *sched_ctx->perf_counters != NULL)
+		(*sched_ctx->perf_counters)->notify_post_exec_hook(sched_ctx->id, task->hypervisor_tag);
 #endif //STARPU_USE_SCHED_CTX_HYPERVISOR
 
 	if (sched_ctx->sched_policy->post_exec_hook)