Browse Source

src/core: fix shadow declarations

Nathalie Furmento 12 years ago
parent
commit
6b0919e84c
3 changed files with 31 additions and 32 deletions
  1. 2 2
      src/core/sched_ctx.c
  2. 9 10
      src/core/sched_policy.c
  3. 20 20
      src/core/workers.c

+ 2 - 2
src/core/sched_ctx.c

@@ -40,9 +40,9 @@ static void _starpu_worker_gets_into_ctx(unsigned sched_ctx_id, struct _starpu_w
 	unsigned worker_sched_ctx_id = _starpu_worker_get_sched_ctx_id(worker, sched_ctx_id);
 	/* the worker was planning to go away in another ctx but finally he changed his mind & 
 	   he's staying */
-	if(worker_sched_ctx_id  == STARPU_NMAX_SCHED_CTXS)
+	if (worker_sched_ctx_id  == STARPU_NMAX_SCHED_CTXS)
 	{
-		unsigned worker_sched_ctx_id = _starpu_worker_get_first_free_sched_ctx(worker);
+		worker_sched_ctx_id = _starpu_worker_get_first_free_sched_ctx(worker);
 		struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(sched_ctx_id);
 		/* add context to worker */
 		worker->sched_ctx[worker_sched_ctx_id] = sched_ctx;

+ 9 - 10
src/core/sched_policy.c

@@ -233,7 +233,6 @@ static int _starpu_push_task_on_specific_worker(struct starpu_task *task, int wo
 		unsigned node = starpu_worker_get_memory_node(workerid);
 		if (_starpu_task_uses_multiformat_handles(task))
 		{
-			unsigned i;
 			for (i = 0; i < task->cl->nbuffers; i++)
 			{
 				struct starpu_task *conversion_task;
@@ -269,24 +268,24 @@ static int _starpu_push_task_on_specific_worker(struct starpu_task *task, int wo
 
 		int ret = 0;
 
-		struct _starpu_job *j = _starpu_get_job_associated_to_task(task);
-		j->task_size = worker_size;
-		j->combined_workerid = workerid;
-		j->active_task_alias_count = 0;
+		struct _starpu_job *job = _starpu_get_job_associated_to_task(task);
+		job->task_size = worker_size;
+		job->combined_workerid = workerid;
+		job->active_task_alias_count = 0;
 
-		_STARPU_PTHREAD_BARRIER_INIT(&j->before_work_barrier, NULL, worker_size);
-		_STARPU_PTHREAD_BARRIER_INIT(&j->after_work_barrier, NULL, worker_size);
+		_STARPU_PTHREAD_BARRIER_INIT(&job->before_work_barrier, NULL, worker_size);
+		_STARPU_PTHREAD_BARRIER_INIT(&job->after_work_barrier, NULL, worker_size);
 
 		/* Note: we have to call that early, or else the task may have
 		 * disappeared already */
 		_starpu_push_task_end(task);
 
-		int i;
-		for (i = 0; i < worker_size; i++)
+		int j;
+		for (j = 0; j < worker_size; j++)
 		{
 			struct starpu_task *alias = _starpu_create_task_alias(task);
 
-			worker = _starpu_get_worker_struct(combined_workerid[i]);
+			worker = _starpu_get_worker_struct(combined_workerid[j]);
 			ret |= _starpu_push_local_task(worker, alias, 0);
 		}
 

+ 20 - 20
src/core/workers.c

@@ -340,14 +340,14 @@ void _starpu_worker_init(struct _starpu_worker *worker, unsigned fut_key)
 
 }
 
-static void _starpu_launch_drivers(struct _starpu_machine_config *config)
+static void _starpu_launch_drivers(struct _starpu_machine_config *pconfig)
 {
-	config->running = 1;
-	config->submitting = 1;
+	pconfig->running = 1;
+	pconfig->submitting = 1;
 
 	_STARPU_PTHREAD_KEY_CREATE(&worker_key, NULL);
 
-	unsigned nworkers = config->topology.nworkers;
+	unsigned nworkers = pconfig->topology.nworkers;
 
 	/* Launch workers asynchronously */
 	unsigned cpu = 0, cuda = 0;
@@ -368,9 +368,9 @@ static void _starpu_launch_drivers(struct _starpu_machine_config *config)
 
 	for (worker = 0; worker < nworkers; worker++)
 	{
-		struct _starpu_worker *workerarg = &config->workers[worker];
+		struct _starpu_worker *workerarg = &pconfig->workers[worker];
 
-		workerarg->config = config;
+		workerarg->config = pconfig;
 
 		_starpu_barrier_counter_init(&workerarg->tasks_barrier, 0);
 
@@ -388,7 +388,7 @@ static void _starpu_launch_drivers(struct _starpu_machine_config *config)
 		workerarg->run_by_starpu = 1;
 		workerarg->worker_is_running = 0;
 		workerarg->worker_is_initialized = 0;
-		
+
 		int ctx;
 		for(ctx = 0; ctx < STARPU_NMAX_SCHED_CTXS; ctx++)
 			workerarg->removed_from_ctx[ctx] = 0;
@@ -419,7 +419,7 @@ static void _starpu_launch_drivers(struct _starpu_machine_config *config)
 			case STARPU_CPU_WORKER:
 				workerarg->set = NULL;
 				driver.id.cpu_id = cpu;
-				if (_starpu_may_launch_driver(config->conf, &driver))
+				if (_starpu_may_launch_driver(pconfig->conf, &driver))
 				{
 					_STARPU_PTHREAD_CREATE_ON(
 						workerarg->name,
@@ -446,7 +446,7 @@ static void _starpu_launch_drivers(struct _starpu_machine_config *config)
 			case STARPU_CUDA_WORKER:
 				workerarg->set = NULL;
 				driver.id.cuda_id = cuda;
-				if (_starpu_may_launch_driver(config->conf, &driver))
+				if (_starpu_may_launch_driver(pconfig->conf, &driver))
 				{
 					_STARPU_PTHREAD_CREATE_ON(
 						workerarg->name,
@@ -473,7 +473,7 @@ static void _starpu_launch_drivers(struct _starpu_machine_config *config)
 			case STARPU_OPENCL_WORKER:
 #ifndef STARPU_SIMGRID
 				starpu_opencl_get_device(workerarg->devid, &driver.id.opencl_id);
-				if (!_starpu_may_launch_driver(config->conf, &driver))
+				if (!_starpu_may_launch_driver(pconfig->conf, &driver))
 				{
 					workerarg->run_by_starpu = 0;
 					break;
@@ -504,7 +504,7 @@ static void _starpu_launch_drivers(struct _starpu_machine_config *config)
 	cuda = 0;
 	for (worker = 0; worker < nworkers; worker++)
 	{
-		struct _starpu_worker *workerarg = &config->workers[worker];
+		struct _starpu_worker *workerarg = &pconfig->workers[worker];
 		struct starpu_driver driver;
 		driver.type = workerarg->arch;
 
@@ -512,7 +512,7 @@ static void _starpu_launch_drivers(struct _starpu_machine_config *config)
 		{
 			case STARPU_CPU_WORKER:
 				driver.id.cpu_id = cpu;
-				if (!_starpu_may_launch_driver(config->conf, &driver))
+				if (!_starpu_may_launch_driver(pconfig->conf, &driver))
 				{
 					cpu++;
 					break;
@@ -526,7 +526,7 @@ static void _starpu_launch_drivers(struct _starpu_machine_config *config)
 				break;
 			case STARPU_CUDA_WORKER:
 				driver.id.cuda_id = cuda;
-				if (!_starpu_may_launch_driver(config->conf, &driver))
+				if (!_starpu_may_launch_driver(pconfig->conf, &driver))
 				{
 					cuda++;
 					break;
@@ -542,7 +542,7 @@ static void _starpu_launch_drivers(struct _starpu_machine_config *config)
 			case STARPU_OPENCL_WORKER:
 #ifndef STARPU_SIMGRID
 				starpu_opencl_get_device(workerarg->devid, &driver.id.opencl_id);
-				if (!_starpu_may_launch_driver(config->conf, &driver))
+				if (!_starpu_may_launch_driver(pconfig->conf, &driver))
 					break;
 #endif
 				_STARPU_DEBUG("waiting for worker %u initialization\n", worker);
@@ -817,19 +817,19 @@ void starpu_profiling_init()
  * Handle runtime termination
  */
 
-static void _starpu_terminate_workers(struct _starpu_machine_config *config)
+static void _starpu_terminate_workers(struct _starpu_machine_config *pconfig)
 {
 	int status STARPU_ATTRIBUTE_UNUSED;
 	unsigned workerid;
 
-	for (workerid = 0; workerid < config->topology.nworkers; workerid++)
+	for (workerid = 0; workerid < pconfig->topology.nworkers; workerid++)
 	{
 		starpu_wake_all_blocked_workers();
 
 		_STARPU_DEBUG("wait for worker %u\n", workerid);
 
-		struct _starpu_worker_set *set = config->workers[workerid].set;
-		struct _starpu_worker *worker = &config->workers[workerid];
+		struct _starpu_worker_set *set = pconfig->workers[workerid].set;
+		struct _starpu_worker *worker = &pconfig->workers[workerid];
 
 		/* in case StarPU termination code is called from a callback,
  		 * we have to check if pthread_self() is the worker itself */
@@ -914,10 +914,10 @@ unsigned _starpu_worker_can_block(unsigned memnode STARPU_ATTRIBUTE_UNUSED)
 #endif
 }
 
-static void _starpu_kill_all_workers(struct _starpu_machine_config *config)
+static void _starpu_kill_all_workers(struct _starpu_machine_config *pconfig)
 {
 	/* set the flag which will tell workers to stop */
-	config->running = 0;
+	pconfig->running = 0;
 	/* running is just protected by a memory barrier */
 	STARPU_WMB();
 	starpu_wake_all_blocked_workers();