Browse Source

Factorize code which needs not be directly written in the drivers

Cédric Augonnet 15 years ago
parent
commit
dd7443ea86

+ 9 - 0
src/core/workers.c

@@ -106,6 +106,15 @@ static void _starpu_init_worker_queue(struct starpu_worker_s *workerarg)
 		default:
 		default:
 			STARPU_ABORT();
 			STARPU_ABORT();
 	}
 	}
+
+	/* This is only useful (and meaningful) is there is a single memory
+	 * node "related" to that queue */
+	jobq->memory_node = workerarg->memory_node;
+
+	jobq->total_computation_time = 0.0;
+	jobq->total_communication_time = 0.0;
+	jobq->total_computation_time_error = 0.0;
+	jobq->total_job_performed = 0;
 		
 		
 	PTHREAD_MUTEX_UNLOCK(&jobq->activity_mutex);
 	PTHREAD_MUTEX_UNLOCK(&jobq->activity_mutex);
 
 

+ 0 - 13
src/drivers/cpu/driver_cpu.c

@@ -119,21 +119,8 @@ void *_starpu_cpu_worker(void *arg)
 
 
 	snprintf(cpu_arg->name, 32, "CPU %d", cpu_arg->devid);
 	snprintf(cpu_arg->name, 32, "CPU %d", cpu_arg->devid);
 
 
-	PTHREAD_MUTEX_LOCK(&jobq->activity_mutex);
-
-	/* this is only useful (and meaningful) is there is a single
-	   memory node "related" to that queue */
-	jobq->memory_node = cpu_arg->memory_node;
-
-	jobq->total_computation_time = 0.0;
-	jobq->total_communication_time = 0.0;
-	jobq->total_computation_time_error = 0.0;
-	jobq->total_job_performed = 0;
-
 	cpu_arg->status = STATUS_UNKNOWN;
 	cpu_arg->status = STATUS_UNKNOWN;
 
 
-	PTHREAD_MUTEX_UNLOCK(&jobq->activity_mutex);
-	
 	STARPU_TRACE_WORKER_INIT_END
 	STARPU_TRACE_WORKER_INIT_END
 
 
         /* tell the main thread that we are ready */
         /* tell the main thread that we are ready */

+ 0 - 13
src/drivers/cuda/driver_cuda.c

@@ -185,19 +185,6 @@ void *_starpu_cuda_worker(void *arg)
 
 
 	_starpu_set_local_worker_key(args);
 	_starpu_set_local_worker_key(args);
 
 
-	PTHREAD_MUTEX_LOCK(&jobq->activity_mutex);
-
-	/* this is only useful (and meaningful) is there is a single
-	   memory node "related" to that queue */
-	jobq->memory_node = memory_node;
-
-	jobq->total_computation_time = 0.0;
-	jobq->total_communication_time = 0.0;
-	jobq->total_computation_time_error = 0.0;
-	jobq->total_job_performed = 0;
-
-	PTHREAD_MUTEX_UNLOCK(&jobq->activity_mutex);
-
 	init_context(devid);
 	init_context(devid);
 
 
 	/* one more time to avoid hacks from third party lib :) */
 	/* one more time to avoid hacks from third party lib :) */

+ 0 - 14
src/drivers/opencl/driver_opencl.c

@@ -186,7 +186,6 @@ void *_starpu_opencl_worker(void *arg)
 	struct starpu_jobq_s *jobq = args->jobq;
 	struct starpu_jobq_s *jobq = args->jobq;
 
 
 	int devid = args->devid;
 	int devid = args->devid;
-	unsigned memory_node = args->memory_node;
 
 
 #ifdef USE_FXT
 #ifdef USE_FXT
 	fxt_register_thread(args->bindid);
 	fxt_register_thread(args->bindid);
@@ -200,19 +199,6 @@ void *_starpu_opencl_worker(void *arg)
 
 
 	_starpu_set_local_worker_key(args);
 	_starpu_set_local_worker_key(args);
 
 
-	PTHREAD_MUTEX_LOCK(&jobq->activity_mutex);
-
-	/* this is only useful (and meaningful) is there is a single
-	   memory node "related" to that queue */
-	jobq->memory_node = memory_node;
-
-	jobq->total_computation_time = 0.0;
-	jobq->total_communication_time = 0.0;
-	jobq->total_computation_time_error = 0.0;
-	jobq->total_job_performed = 0;
-
-	PTHREAD_MUTEX_UNLOCK(&jobq->activity_mutex);
-
 	_starpu_opencl_init_context(devid);
 	_starpu_opencl_init_context(devid);
 
 
 	/* one more time to avoid hacks from third party lib :) */
 	/* one more time to avoid hacks from third party lib :) */