Browse Source

Get rid of the "who" field of the queue structure since it is meaningless when
there are multiple workers associated to a queue and that it is possible to get
this information directly from the worker id.

Cédric Augonnet 14 years ago
parent
commit
880d7f9e1c

+ 0 - 3
src/core/mechanisms/queues.h

@@ -41,9 +41,6 @@ struct starpu_jobq_s {
  	 * */
 	struct starpu_job_list_s *(*pop_every_task)(struct starpu_jobq_s *, uint32_t);
 
-	/* what are the driver that may pop job from that queue ? */
-	uint32_t who;
-
 	/* this is only relevant if there is a single worker per queue */
 	uint32_t memory_node;
 	enum starpu_perf_archtype arch;

+ 10 - 7
src/core/perfmodel/perfmodel.c

@@ -71,21 +71,24 @@ static double per_arch_task_expected_length(struct starpu_perfmodel_t *model, en
  * Common model
  */
 
-static double common_task_expected_length(struct starpu_perfmodel_t *model, uint32_t who, struct starpu_task *task)
+static double common_task_expected_length(struct starpu_perfmodel_t *model, int workerid, struct starpu_task *task)
 {
 	double exp;
 
 	if (model->cost_model) {
 		float alpha;
 		exp = model->cost_model(task->buffers);
-		switch (who) {
-			case STARPU_CPU:
+
+		enum starpu_archtype arch = starpu_worker_get_type(workerid);
+
+		switch (arch) {
+			case STARPU_CPU_WORKER:
 				alpha = STARPU_CPU_ALPHA;
 				break;
-			case STARPU_CUDA:
+			case STARPU_CUDA_WORKER:
 				alpha = STARPU_CUDA_ALPHA;
 				break;
-  		        case STARPU_OPENCL:
+  		        case STARPU_OPENCL_WORKER:
 	                        alpha = STARPU_OPENCL_ALPHA;
                                 break;
 			default:
@@ -102,7 +105,7 @@ static double common_task_expected_length(struct starpu_perfmodel_t *model, uint
 	return -1.0;
 }
 
-double _starpu_job_expected_length(uint32_t who, struct starpu_job_s *j, enum starpu_perf_archtype arch)
+double _starpu_job_expected_length(int workerid, struct starpu_job_s *j, enum starpu_perf_archtype arch)
 {
 	struct starpu_task *task = j->task;
 	struct starpu_perfmodel_t *model = task->cl->model;
@@ -113,7 +116,7 @@ double _starpu_job_expected_length(uint32_t who, struct starpu_job_s *j, enum st
 				return per_arch_task_expected_length(model, arch, task);
 
 			case STARPU_COMMON:
-				return common_task_expected_length(model, who, task);
+				return common_task_expected_length(model, workerid, task);
 
 			case STARPU_HISTORY_BASED:
 				return _starpu_history_based_job_expected_length(model, arch, j);

+ 2 - 2
src/core/perfmodel/perfmodel.h

@@ -91,9 +91,9 @@ void _starpu_register_model(struct starpu_perfmodel_t *model);
 void _starpu_initialize_registered_performance_models(void);
 void _starpu_deinitialize_registered_performance_models(void);
 
-double _starpu_job_expected_length(uint32_t who, struct starpu_job_s *j, enum starpu_perf_archtype arch);
+double _starpu_job_expected_length(int workerid, struct starpu_job_s *j, enum starpu_perf_archtype arch);
 double _starpu_regression_based_job_expected_length(struct starpu_perfmodel_t *model,
-		uint32_t who, struct starpu_job_s *j);
+					enum starpu_perf_archtype arch, struct starpu_job_s *j);
 void _starpu_update_perfmodel_history(struct starpu_job_s *j, enum starpu_perf_archtype arch,
 				unsigned cpuid, double measured);
 

+ 2 - 3
src/core/policies/deque_modeling_policy.c

@@ -84,13 +84,13 @@ static int _dm_push_task(struct starpu_jobq_s *q __attribute__ ((unused)), starp
 		fifo->exp_start = STARPU_MAX(fifo->exp_start, _starpu_timing_now());
 		fifo->exp_end = STARPU_MAX(fifo->exp_end, _starpu_timing_now());
 
-		if ((queue_array[worker]->who & task->cl->where) == 0)
+		if (!_starpu_worker_may_execute_task(worker, task->cl->where))
 		{
 			/* no one on that queue may execute this task */
 			continue;
 		}
 
-		double local_length = _starpu_job_expected_length(queue_array[worker]->who, j, queue_array[worker]->arch);
+		double local_length = _starpu_job_expected_length(worker, j, queue_array[worker]->arch);
 
 		if (local_length == -1.0) 
 		{
@@ -161,7 +161,6 @@ static struct starpu_jobq_s *init_dm_fifo(void)
 	q->push_prio_task = dm_push_prio_task; 
 	q->pop_task = dm_pop_task;
 	q->pop_every_task = dm_pop_every_task;
-	q->who = 0;
 
 	queue_array[nworkers++] = q;
 

+ 3 - 5
src/core/policies/deque_modeling_policy_data_aware.c

@@ -84,14 +84,13 @@ static int _dmda_push_task(struct starpu_jobq_s *q __attribute__ ((unused)) , st
 		fifo->exp_start = STARPU_MAX(fifo->exp_start, _starpu_timing_now());
 		fifo->exp_end = STARPU_MAX(fifo->exp_end, _starpu_timing_now());
 
-		if ((queue_array[worker]->who & task->cl->where) == 0)
+		if (!_starpu_worker_may_execute_task(worker, task->cl->where))
 		{
 			/* no one on that queue may execute this task */
 			continue;
 		}
 
-		local_task_length[worker] = _starpu_job_expected_length(queue_array[worker]->who,
-							j, queue_array[worker]->arch);
+		local_task_length[worker] = _starpu_job_expected_length(worker,	j, queue_array[worker]->arch);
 
 		//local_data_penalty[worker] = 0;
 		local_data_penalty[worker] = _starpu_data_expected_penalty(queue_array[worker], task);
@@ -119,7 +118,7 @@ static int _dmda_push_task(struct starpu_jobq_s *q __attribute__ ((unused)) , st
 		{
 			fifo = queue_array[worker]->queue;
 	
-			if ((queue_array[worker]->who & task->cl->where) == 0)
+			if (!_starpu_worker_may_execute_task(worker, task->cl->where))
 			{
 				/* no one on that queue may execute this task */
 				continue;
@@ -199,7 +198,6 @@ static struct starpu_jobq_s *init_dmda_fifo(void)
 	q->push_task = dmda_push_task; 
 	q->push_prio_task = dmda_push_prio_task; 
 	q->pop_task = dmda_pop_task;
-	q->who = 0;
 
 	queue_array[nworkers++] = q;
 

+ 0 - 1
src/core/policies/random_policy.c

@@ -85,7 +85,6 @@ static struct starpu_jobq_s *init_random_fifo(void)
 	q->push_task = random_push_task; 
 	q->push_prio_task = random_push_prio_task; 
 	q->pop_task = random_pop_task;
-	q->who = 0;
 
 	queue_array[nworkers++] = q;
 

+ 0 - 1
src/core/policies/work_stealing_policy.c

@@ -167,7 +167,6 @@ static struct starpu_jobq_s *init_ws_deque(void)
 	q->push_task = _starpu_deque_push_task; 
 	q->push_prio_task = _starpu_deque_push_prio_task; 
 	q->pop_task = ws_pop_task;
-	q->who = 0;
 
 	queue_array[nworkers++] = q;
 

+ 0 - 2
src/core/workers.c

@@ -89,8 +89,6 @@ static void _starpu_init_worker_queue(struct starpu_worker_s *workerarg)
 	  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_CPU_WORKER:
 			jobq->alpha = STARPU_CPU_ALPHA;