Andra Hugo 13 anni fa
parent
commit
437a340e43

+ 2 - 2
include/starpu_task.h

@@ -181,7 +181,7 @@ struct starpu_task {
 
 	/* flag to differentiate tasks needed by starpu management purposes 
 	 from the ones provided by the appl*/
-	unsigned specific_starpu;
+	unsigned control_task;
 };
 
 /* It is possible to initialize statically allocated tasks with this value.
@@ -207,7 +207,7 @@ struct starpu_task {
 	.predicted = -1.0,				\
 	.starpu_private = NULL,				\
 	.sched_ctx = 0,					\
-	.specific_starpu = 0				\
+	.control_task = 0				\
 };
 
 /*

+ 13 - 13
src/core/sched_ctx.c

@@ -48,7 +48,7 @@ static void update_workers_func(void *buffers[] __attribute__ ((unused)), void *
 		/* remove context from worker */
 		int i;
 		for(i = 0; i < STARPU_NMAX_SCHED_CTXS; i++)
-			if(worker->sched_ctx[i] != NULL && worker->sched_ctx[i]->sched_ctx_id == sched_ctx_id)
+			if(worker->sched_ctx[i] != NULL && worker->sched_ctx[i]->id == sched_ctx_id)
 			  {
 				worker->sched_ctx[i] = NULL;
 				worker->nctxs--;
@@ -125,7 +125,7 @@ struct starpu_sched_ctx*  _starpu_create_sched_ctx(const char *policy_name, int
 	unsigned id = _starpu_get_first_available_sched_ctx_id(config);
 
 	struct starpu_sched_ctx *sched_ctx = &config->sched_ctxs[id];
-	sched_ctx->sched_ctx_id = id;
+	sched_ctx->id = id;
 	int nworkers = config->topology.nworkers;
 	
 	STARPU_ASSERT(nworkerids_in_ctx <= nworkers);
@@ -136,7 +136,7 @@ struct starpu_sched_ctx*  _starpu_create_sched_ctx(const char *policy_name, int
 
 	sched_ctx->sched_policy = malloc(sizeof(struct starpu_sched_policy_s));
 	sched_ctx->is_initial_sched = is_initial_sched;
-	sched_ctx->sched_name = sched_name;
+	sched_ctx->name = sched_name;
 
 	_starpu_barrier_counter_init(&sched_ctx->tasks_barrier, 0);
 
@@ -192,7 +192,7 @@ unsigned starpu_create_sched_ctx(const char *policy_name, int *workerids_in_ctx,
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_create_sched_ctx(policy_name, workerids_in_ctx, nworkerids_in_ctx, 0, sched_name);
 	_starpu_update_workers(sched_ctx->workerid, sched_ctx->nworkers_in_ctx, -1, sched_ctx);
-	return sched_ctx->sched_ctx_id;
+	return sched_ctx->id;
 }
 
 /* check if the worker already belongs to the context */
@@ -217,14 +217,14 @@ static void free_sched_ctx_mem(struct starpu_sched_ctx *sched_ctx)
 	sched_ctx->sched_cond = NULL;
 	struct starpu_machine_config_s *config = _starpu_get_machine_config();
 	config->topology.nsched_ctxs--;
-	sched_ctx->sched_ctx_id = STARPU_NMAX_SCHED_CTXS;
+	sched_ctx->id = STARPU_NMAX_SCHED_CTXS;
 
 }
 
 static void _starpu_manage_delete_sched_ctx(struct starpu_sched_ctx *sched_ctx)
 {
 	_starpu_update_workers(sched_ctx->workerid, sched_ctx->nworkers_in_ctx, 
-			       sched_ctx->sched_ctx_id, NULL);
+			       sched_ctx->id, NULL);
 }
 
 static void _starpu_add_workers_to_sched_ctx(int *new_workers, int nnew_workers,
@@ -268,7 +268,7 @@ static void _starpu_add_workers_to_sched_ctx(int *new_workers, int nnew_workers,
                   }
           }
 
-        sched_ctx->sched_policy->init_sched_for_workers(sched_ctx->sched_ctx_id, n_added_workers);
+        sched_ctx->sched_policy->init_sched_for_workers(sched_ctx->id, n_added_workers);
 
 	_starpu_update_workers(added_workers, n_added_workers, -1, sched_ctx);
 
@@ -306,7 +306,7 @@ void _starpu_delete_all_sched_ctxs()
 	  {
 		struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(i);
 		_starpu_barrier_counter_destroy(&sched_ctx->tasks_barrier);
-		if(sched_ctx->sched_ctx_id != STARPU_NMAX_SCHED_CTXS)
+		if(sched_ctx->id != STARPU_NMAX_SCHED_CTXS)
 			free_sched_ctx_mem(sched_ctx);
 	  }
 	return;
@@ -370,7 +370,7 @@ static void _starpu_remove_workers_from_sched_ctx(int *workerids_in_ctx, int nwo
 		_starpu_rearange_sched_ctx_workerids(sched_ctx, nworkerids_already_in_ctx);
 	  }
 
-	_starpu_update_workers(removed_workers, nremoved_workers, sched_ctx->sched_ctx_id, NULL);
+	_starpu_update_workers(removed_workers, nremoved_workers, sched_ctx->id, NULL);
 
 	return;
 }
@@ -398,7 +398,7 @@ void _starpu_init_all_sched_ctx(struct starpu_machine_config_s *config)
 
 	unsigned i;
 	for(i = 0; i < STARPU_NMAX_SCHED_CTXS; i++)
-		config->sched_ctxs[i].sched_ctx_id = STARPU_NMAX_SCHED_CTXS;
+		config->sched_ctxs[i].id = STARPU_NMAX_SCHED_CTXS;
 
 	return;
 }
@@ -422,7 +422,7 @@ static unsigned _starpu_get_first_available_sched_ctx_id(struct starpu_machine_c
 {
 	unsigned i;
 	for(i = 0; i < STARPU_NMAX_SCHED_CTXS; i++)
-		if(config->sched_ctxs[i].sched_ctx_id == STARPU_NMAX_SCHED_CTXS)
+		if(config->sched_ctxs[i].id == STARPU_NMAX_SCHED_CTXS)
 			return i;
 
 	STARPU_ASSERT(0);
@@ -559,13 +559,13 @@ int _starpu_get_index_in_ctx_of_workerid(unsigned sched_ctx_id, unsigned workeri
 
 pthread_mutex_t *_starpu_get_sched_mutex(struct starpu_sched_ctx *sched_ctx, int worker)
 {
-	int workerid_ctx = _starpu_get_index_in_ctx_of_workerid(sched_ctx->sched_ctx_id, worker);
+	int workerid_ctx = _starpu_get_index_in_ctx_of_workerid(sched_ctx->id, worker);
 	return (workerid_ctx == -1 ? NULL : sched_ctx->sched_mutex[workerid_ctx]);
 }
 
 pthread_cond_t *_starpu_get_sched_cond(struct starpu_sched_ctx *sched_ctx, int worker)
 {
-	int workerid_ctx = _starpu_get_index_in_ctx_of_workerid(sched_ctx->sched_ctx_id, worker);
+	int workerid_ctx = _starpu_get_index_in_ctx_of_workerid(sched_ctx->id, worker);
 	return (workerid_ctx == -1 ? NULL : sched_ctx->sched_cond[workerid_ctx]);
 }
 

+ 2 - 2
src/core/sched_ctx.h

@@ -25,10 +25,10 @@
 
 struct starpu_sched_ctx {
 	/* id of the context used in user mode*/
-	unsigned sched_ctx_id;
+	unsigned id;
 
 	/* name of context */
-	const char *sched_name;
+	const char *name;
 
 	/* policy of the context */
 	struct starpu_sched_policy_s *sched_policy;

+ 7 - 7
src/core/sched_policy.c

@@ -202,14 +202,14 @@ void _starpu_init_sched_policy(struct starpu_machine_config_s *config, struct st
 
 	load_sched_policy(selected_policy, sched_ctx);
 
-	sched_ctx->sched_policy->init_sched(sched_ctx->sched_ctx_id);
+	sched_ctx->sched_policy->init_sched(sched_ctx->id);
 }
 
 void _starpu_deinit_sched_policy(struct starpu_machine_config_s *config, struct starpu_sched_ctx *sched_ctx)
 {
         struct starpu_sched_policy_s *policy = sched_ctx->sched_policy;
 	if (policy->deinit_sched)
-		policy->deinit_sched(sched_ctx->sched_ctx_id);
+		policy->deinit_sched(sched_ctx->id);
 }
 
 /* Enqueue a task into the list of tasks explicitely attached to a worker. In
@@ -247,7 +247,7 @@ static int _starpu_push_task_on_specific_worker(struct starpu_task *task, int wo
 		if (worker->sched_ctx[i] != NULL && worker->sched_ctx[i]->sched_policy != NULL && 
 		    worker->sched_ctx[i]->sched_policy->push_task_notify)
 		  {
-			worker->sched_ctx[i]->sched_policy->push_task_notify(task, workerid, worker->sched_ctx[i]->sched_ctx_id);
+			worker->sched_ctx[i]->sched_policy->push_task_notify(task, workerid, worker->sched_ctx[i]->id);
 		  }
 	  }
 
@@ -320,7 +320,7 @@ int _starpu_push_task(starpu_job_t j, unsigned job_is_already_locked)
 		    sched_ctx->temp_nworkers_in_ctx = -1;
 		  }
 		/* don't push task on ctx at the same time workers are removed from ctx */
-		ret = sched_ctx->sched_policy->push_task(task, sched_ctx->sched_ctx_id);
+		ret = sched_ctx->sched_policy->push_task(task, sched_ctx->id);
 		PTHREAD_MUTEX_UNLOCK(&sched_ctx->changing_ctx_mutex);
 		
 	}
@@ -368,7 +368,7 @@ struct starpu_task *_starpu_pop_task(struct starpu_worker_s *worker)
 			    if (sched_ctx->sched_policy->pop_task)
 			      {
 				PTHREAD_MUTEX_UNLOCK(sched_ctx_mutex);
-				task = sched_ctx->sched_policy->pop_task(sched_ctx->sched_ctx_id);
+				task = sched_ctx->sched_policy->pop_task(sched_ctx->id);
 				break;
 			      }
 			    PTHREAD_MUTEX_UNLOCK(sched_ctx_mutex);
@@ -403,14 +403,14 @@ struct starpu_task *_starpu_pop_every_task(struct starpu_sched_ctx *sched_ctx)
 	STARPU_ASSERT(sched_ctx->sched_policy->pop_every_task);
 
 	/* TODO set profiling info */
-	return sched_ctx->sched_policy->pop_every_task(sched_ctx->sched_ctx_id);
+	return sched_ctx->sched_policy->pop_every_task(sched_ctx->id);
 }
 
 void _starpu_sched_post_exec_hook(struct starpu_task *task)
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(task->sched_ctx);
 	if (sched_ctx->sched_policy->post_exec_hook)
-		sched_ctx->sched_policy->post_exec_hook(task, sched_ctx->sched_ctx_id);
+		sched_ctx->sched_policy->post_exec_hook(task, sched_ctx->id);
 }
 
 void _starpu_wait_on_sched_event(void)

+ 4 - 4
src/core/task.c

@@ -80,9 +80,9 @@ void starpu_task_init(struct starpu_task *task)
 
 	task->starpu_private = NULL;
 
-	task->sched_ctx = _starpu_get_initial_sched_ctx()->sched_ctx_id;
+	task->sched_ctx = _starpu_get_initial_sched_ctx()->id;
 	
-	task->specific_starpu = 0;
+	task->control_task = 0;
 }
 
 /* Free all the ressources allocated for a task, without deallocating the task
@@ -232,7 +232,7 @@ int starpu_task_submit(struct starpu_task *task)
 {
 	unsigned nsched_ctxs = _starpu_get_nsched_ctxs();
 
-	task->sched_ctx = nsched_ctxs == 1 || task->specific_starpu ? 
+	task->sched_ctx = nsched_ctxs == 1 || task->control_task ? 
 		0 : starpu_get_sched_ctx();
 
 	int ret;
@@ -315,7 +315,7 @@ int starpu_task_submit(struct starpu_task *task)
 
 int _starpu_task_submit_internal(struct starpu_task *task)
 {
-	task->specific_starpu = 1;
+	task->control_task = 1;
 	return starpu_task_submit(task);
 }
 

+ 1 - 1
src/core/workers.c

@@ -395,7 +395,7 @@ int starpu_init(struct starpu_conf *user_conf)
 	else
 		sched_ctx = _starpu_create_sched_ctx(user_conf->sched_policy_name, NULL, -1, 1, "init");
 
-	starpu_set_sched_ctx(&sched_ctx->sched_ctx_id);
+	starpu_set_sched_ctx(&sched_ctx->id);
 	_starpu_initialize_registered_performance_models();
 
 	/* Launch "basic" workers (ie. non-combined workers) */

+ 1 - 1
src/sched_policies/deque_modeling_policy_data_aware.c

@@ -289,7 +289,7 @@ static int push_task_on_best_worker(struct starpu_task *task, int best_workerid,
 	/* make sure someone coule execute that task ! */
 	STARPU_ASSERT(best_workerid != -1);
 
-	int best_workerid_ctx =  _starpu_get_index_in_ctx_of_workerid(sched_ctx->sched_ctx_id, best_workerid);
+	int best_workerid_ctx =  _starpu_get_index_in_ctx_of_workerid(sched_ctx->id, best_workerid);
 
 	struct starpu_fifo_taskq_s *fifo;
 	fifo = dt->queue_array[best_workerid_ctx];