Ver código fonte

rename starpu_create_task_alias to starpu_task_dup and document it

Nathalie Furmento 12 anos atrás
pai
commit
19b552794f

+ 4 - 0
doc/chapters/api.texi

@@ -2201,6 +2201,10 @@ by the task have to be freed by calling
 @code{starpu_task_destroy}.
 @end deftypefun
 
+@deftypefun {struct starpu_task *}starpu_task_dup ({struct starpu_task *}@var{task})
+Allocate a task structure which is the exact duplicate of the given task.
+@end deftypefun
+
 @deftypefun void starpu_task_clean ({struct starpu_task} *@var{task})
 Release all the structures automatically allocated to execute @var{task}, but
 not the task structure itself and values set by the user remain unchanged.

+ 2 - 2
include/starpu_task.h

@@ -357,8 +357,8 @@ struct starpu_task *starpu_task_get_current(void);
  * at the same time */
 void starpu_parallel_task_barrier_init(struct starpu_task* task, int workerid);
 
-/* create task alias to dispatch it to the workers of a combined workers */
-struct starpu_task *starpu_create_task_alias(struct starpu_task *task);
+/* duplicate the given task */
+struct starpu_task *starpu_task_dup(struct starpu_task *task);
 
 #ifdef __cplusplus
 }

+ 2 - 2
src/core/parallel_task.c

@@ -22,12 +22,12 @@
 #include <core/workers.h>
 #include <common/barrier.h>
 
-struct starpu_task *starpu_create_task_alias(struct starpu_task *task)
+struct starpu_task *starpu_task_dup(struct starpu_task *task)
 {
 	struct starpu_task *task_dup = (struct starpu_task *) malloc(sizeof(struct starpu_task));
 	STARPU_ASSERT(task_dup);
 
-	/* XXX perhaps this is a bit too much overhead and we should only copy
+	/* TODO perhaps this is a bit too much overhead and we should only copy
 	 * part of the structure ? */
 	memcpy(task_dup, task, sizeof(struct starpu_task));
 

+ 1 - 1
src/core/sched_policy.c

@@ -283,7 +283,7 @@ 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_create_task_alias(task);
+			struct starpu_task *alias = starpu_task_dup(task);
 
 			worker = _starpu_get_worker_struct(combined_workerid[j]);
 			ret |= _starpu_push_local_task(worker, alias, 0);

+ 3 - 3
src/sched_policies/parallel_eager.c

@@ -265,9 +265,9 @@ static struct starpu_task *pop_task_peager_policy(unsigned sched_ctx_id)
 			/* Dispatch task aliases to the different slaves */
 			for (i = 1; i < worker_size; i++)
 			{
-				struct starpu_task *alias = starpu_create_task_alias(task);
+				struct starpu_task *alias = starpu_task_dup(task);
 				int local_worker = combined_workerid[i];
-				
+
 				starpu_pthread_mutex_t *sched_mutex;
 				starpu_pthread_cond_t *sched_cond;
 				starpu_worker_get_sched_condition(local_worker, &sched_mutex, &sched_cond);
@@ -282,7 +282,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_create_task_alias(task);
+			struct starpu_task *master_alias = starpu_task_dup(task);
 			return master_alias;
 		}
 	}

+ 1 - 1
src/sched_policies/parallel_heft.c

@@ -152,7 +152,7 @@ static int push_task_on_best_worker(struct starpu_task *task, int best_workerid,
 		int i;
 		for (i = 0; i < worker_size; i++)
 		{
-			struct starpu_task *alias = starpu_create_task_alias(task);
+			struct starpu_task *alias = starpu_task_dup(task);
 			int local_worker = combined_workerid[i];
 
 			alias->predicted = exp_end_predicted - worker_exp_end[local_worker];