Browse Source

when pushing parallel tasks to explicit combined workers, we also need to use task aliases. Also make sure they get freed

Samuel Thibault 9 years ago
parent
commit
bb3081fb9a

+ 3 - 1
src/core/sched_policy.c

@@ -264,8 +264,10 @@ static int _starpu_push_task_on_specific_worker(struct starpu_task *task, int wo
 		int j;
 		for (j = 0; j < worker_size; j++)
 		{
+			struct starpu_task *alias = starpu_task_dup(task);
 			int subworkerid = combined_workerid[j];
-			_starpu_push_task_on_specific_worker_notify_sched(task, _starpu_get_worker_struct(subworkerid), subworkerid, workerid);
+			alias->destroy = 1;
+			_starpu_push_task_on_specific_worker_notify_sched(alias, _starpu_get_worker_struct(subworkerid), subworkerid, workerid);
 		}
 	}
 

+ 2 - 0
src/sched_policies/component_worker.c

@@ -670,6 +670,7 @@ static int combined_worker_push_task(struct starpu_sched_component * component,
 	task_alias[0] = _starpu_task_grid_create();
 	task_alias[0]->task = starpu_task_dup(task);
 	task_alias[0]->task->workerid = combined_worker->combined_workerid[0];
+	task_alias[0]->task->destroy = 1;
 	task_alias[0]->left = NULL;
 	task_alias[0]->ntasks = combined_worker->worker_size;
 	int i;
@@ -677,6 +678,7 @@ static int combined_worker_push_task(struct starpu_sched_component * component,
 	{
 		task_alias[i] = _starpu_task_grid_create();
 		task_alias[i]->task = starpu_task_dup(task);
+		task_alias[i]->task->destroy = 1;
 		task_alias[i]->task->workerid = combined_worker->combined_workerid[i];
 		task_alias[i]->left = task_alias[i-1];
 		task_alias[i - 1]->right = task_alias[i];

+ 3 - 1
src/sched_policies/parallel_eager.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2011-2014  Université de Bordeaux
+ * Copyright (C) 2011-2015  Université de Bordeaux
  * Copyright (C) 2011  Télécom-SudParis
  * Copyright (C) 2011-2013  INRIA
  *
@@ -265,6 +265,7 @@ static struct starpu_task *pop_task_peager_policy(unsigned sched_ctx_id)
 				struct starpu_task *alias = starpu_task_dup(task);
 				int local_worker = combined_workerid[i];
 
+				alias->destroy = 1;
 				starpu_pthread_mutex_t *sched_mutex;
 				starpu_pthread_cond_t *sched_cond;
 				starpu_worker_get_sched_condition(local_worker, &sched_mutex, &sched_cond);
@@ -282,6 +283,7 @@ static struct starpu_task *pop_task_peager_policy(unsigned sched_ctx_id)
 
 			/* The master also manipulated an alias */
 			struct starpu_task *master_alias = starpu_task_dup(task);
+			master_alias->destroy = 1;
 			return master_alias;
 		}
 	}

+ 1 - 2
src/sched_policies/parallel_heft.c

@@ -165,6 +165,7 @@ static int push_task_on_best_worker(struct starpu_task *task, int best_workerid,
 			alias->predicted = exp_end_predicted - worker_exp_end[local_worker];
 			/* TODO */
 			alias->predicted_transfer = 0;
+			alias->destroy = 1;
 			starpu_pthread_mutex_t *sched_mutex;
 			starpu_pthread_cond_t *sched_cond;
 			starpu_worker_get_sched_condition(local_worker, &sched_mutex, &sched_cond);
@@ -181,8 +182,6 @@ static int push_task_on_best_worker(struct starpu_task *task, int best_workerid,
 
 		STARPU_PTHREAD_MUTEX_UNLOCK(&hd->global_push_mutex);
 
-		//TODO : free task
-
 	}
 
 	return ret;