瀏覽代碼

Factorize code from the initialization of all the different scheduling
policies: the role of the designer of the scheduling policy is just to create
the different queues now.

Cédric Augonnet 15 年之前
父節點
當前提交
10e76eaf98
共有 2 個文件被更改,包括 29 次插入24 次删除
  1. 0 24
      src/core/mechanisms/queues.c
  2. 29 0
      src/core/workers.c

+ 0 - 24
src/core/mechanisms/queues.c

@@ -36,30 +36,6 @@ void setup_queues(void (*init_queue_design)(void),
 		struct  worker_s *workerarg = &config->workers[worker];
 		
 		workerarg->jobq = func_init_queue();
-
-		/* warning : in case there are multiple workers on the same
-                   queue, we overwrite this value so that it is meaningless
-		 */
-		workerarg->jobq->arch = workerarg->perf_arch;
-
-		switch (workerarg->arch) {
-			case STARPU_CORE_WORKER:
-				workerarg->jobq->who |= CORE;
-				workerarg->jobq->alpha = CORE_ALPHA;
-				break;
-			case STARPU_CUDA_WORKER:
-				workerarg->jobq->who |= CUDA;
-				workerarg->jobq->alpha = CUDA_ALPHA;
-				break;
-			case STARPU_GORDON_WORKER:
-				workerarg->jobq->who |= GORDON;
-				workerarg->jobq->alpha = GORDON_ALPHA;
-				break;
-			default:
-				STARPU_ABORT();
-		}
-		
-		memory_node_attach_queue(workerarg->jobq, workerarg->memory_node);
 	}
 }
 

+ 29 - 0
src/core/workers.c

@@ -61,6 +61,33 @@ static unsigned gordon_inited = 0;
 static struct worker_set_s gordon_worker_set;
 #endif
 
+static void init_worker_queue(struct worker_s *workerarg)
+{
+	struct jobq_s *jobq = workerarg->jobq;
+
+	/* warning : in case there are multiple workers on the same
+	  queue, we overwrite this value so that it is meaningless */
+	jobq->arch = workerarg->perf_arch;
+		
+	jobq->who |= workerarg->worker_mask;
+
+	switch (workerarg->arch) {
+		case STARPU_CORE_WORKER:
+			jobq->alpha = CORE_ALPHA;
+			break;
+		case STARPU_CUDA_WORKER:
+			jobq->alpha = CUDA_ALPHA;
+			break;
+		case STARPU_GORDON_WORKER:
+			jobq->alpha = GORDON_ALPHA;
+			break;
+		default:
+			STARPU_ABORT();
+	}
+		
+	memory_node_attach_queue(jobq, workerarg->memory_node);
+}
+
 static void init_workers(struct machine_config_s *config)
 {
 	config->running = 1;
@@ -92,6 +119,8 @@ static void init_workers(struct machine_config_s *config)
 	
 		workerarg->status = STATUS_INITIALIZING;
 
+		init_worker_queue(workerarg);
+
 		switch (workerarg->arch) {
 #ifdef USE_CPUS
 			case STARPU_CORE_WORKER: