Bläddra i källkod

Replacing task->buffers[x].handle by task->handles[x] and moving the modes from the task to the codelets in some of the tests.

[Coccinelle] Done using modes.cocci. 
3 files have been reverted.
Cyril Roelandt 13 år sedan
förälder
incheckning
96efa2dc02

+ 4 - 4
tests/core/insert_task.c

@@ -31,6 +31,8 @@ void func_cpu(void *descr[], void *_args)
 
 struct starpu_codelet mycodelet =
 {
+	.modes[1] = STARPU_RW,
+	.modes[0] = STARPU_RW,
 	.where = STARPU_CPU,
 	.cpu_funcs = {func_cpu, NULL},
         .nbuffers = 2
@@ -79,10 +81,8 @@ int main(int argc, char **argv)
 
 	struct starpu_task *task = starpu_task_create();
 	task->cl = &mycodelet;
-	task->buffers[0].handle = data_handles[0];
-	task->buffers[0].mode = STARPU_RW;
-	task->buffers[1].handle = data_handles[1];
-	task->buffers[1].mode = STARPU_RW;
+	task->handles[0] = data_handles[0];
+	task->handles[1] = data_handles[1];
 	char *arg_buffer;
 	size_t arg_buffer_size;
 	starpu_pack_cl_args(&arg_buffer, &arg_buffer_size,

+ 2 - 2
tests/core/multiformat_data_release.c

@@ -152,6 +152,7 @@ create_and_submit(int where)
 {
 	static struct starpu_codelet cl =
 	{
+		.modes[0] = STARPU_RW,
 #ifdef STARPU_USE_CUDA
 		.cuda_funcs   = {cuda_func, NULL},
 #endif
@@ -164,8 +165,7 @@ create_and_submit(int where)
 
 	struct starpu_task *task = starpu_task_create();
 	task->cl = &cl;
-	task->buffers[0].handle = handle;
-	task->buffers[0].mode = STARPU_RW;
+	task->handles[0] = handle;
 
 	/* We need to be sure the data has been copied to the GPU at the end 
 	 * of this function */

+ 8 - 8
tests/core/multiformat_handle_conversion.c

@@ -150,6 +150,7 @@ create_and_submit_tasks(int where, starpu_data_handle_t handles[])
 	FPRINTF(stderr, "***** Starting Task 1\n");
 	static struct starpu_codelet cl =
 	{
+		.modes[0] = STARPU_RW,
 #ifdef STARPU_USE_CUDA
 		.cuda_funcs  = {cuda_func, NULL},
 #endif
@@ -163,13 +164,13 @@ create_and_submit_tasks(int where, starpu_data_handle_t handles[])
 	struct starpu_task *task = starpu_task_create();
 	task->synchronous = SYNCHRONOUS;
 	task->cl = &cl;
-	task->buffers[0].handle = handles[0];
-	task->buffers[0].mode = STARPU_RW;
+	task->handles[0] = handles[0];
 	starpu_task_submit(task);
 
 	FPRINTF(stderr, "***** Starting Task 2\n");
 	static struct starpu_codelet cl2 =
 	{
+		.modes[0] = STARPU_RW,
 		.where = STARPU_CPU,
 		.cpu_funcs = {cpu_func, NULL},
 		.nbuffers = 1
@@ -178,14 +179,15 @@ create_and_submit_tasks(int where, starpu_data_handle_t handles[])
 	struct starpu_task *task2 = starpu_task_create();
 	task2->synchronous = SYNCHRONOUS;
 	task2->cl = &cl2;
-	task2->buffers[0].handle = handles[1];
-	task2->buffers[0].mode = STARPU_RW;
+	task2->handles[0] = handles[1];
 	starpu_task_submit(task2);
 
 
 	FPRINTF(stderr, "***** Starting Task 3\n");
 	static struct starpu_codelet cl3 =
 	{
+		.modes[1] = STARPU_RW,
+		.modes[0] = STARPU_RW,
 		.cpu_funcs   = {cpu_func, NULL},
 #ifdef STARPU_USE_CUDA
 		.cuda_funcs   = {cuda_func, NULL},
@@ -200,10 +202,8 @@ create_and_submit_tasks(int where, starpu_data_handle_t handles[])
 	struct starpu_task *task3 = starpu_task_create();
 	task3->synchronous = SYNCHRONOUS;
 	task3->cl = &cl3;
-	task3->buffers[0].handle = handles[0];
-	task3->buffers[0].mode = STARPU_RW;
-	task3->buffers[1].handle = handles[1];
-	task3->buffers[1].mode = STARPU_RW;
+	task3->handles[0] = handles[0];
+	task3->handles[1] = handles[1];
 	starpu_task_submit(task3);
 
 	starpu_task_wait_for_all();

+ 2 - 2
tests/datawizard/acquire_release.c

@@ -32,6 +32,7 @@ void increment_cpu(void *descr[], __attribute__ ((unused)) void *_args)
 
 static struct starpu_codelet increment_cl =
 {
+        .modes[0] = STARPU_RW,
         .where = STARPU_CPU|STARPU_CUDA,
 	.cpu_funcs = {increment_cpu, NULL},
 #ifdef STARPU_USE_CUDA
@@ -48,8 +49,7 @@ int increment_token()
 	struct starpu_task *task = starpu_task_create();
         task->synchronous = 1;
 	task->cl = &increment_cl;
-	task->buffers[0].handle = token_handle;
-	task->buffers[0].mode = STARPU_RW;
+	task->handles[0] = token_handle;
 	return starpu_task_submit(task);
 }
 

+ 2 - 2
tests/datawizard/acquire_release2.c

@@ -31,6 +31,7 @@ void increment_cpu(void *descr[], __attribute__ ((unused)) void *_args)
 
 static struct starpu_codelet increment_cl =
 {
+        .modes[0] = STARPU_RW,
         .where = STARPU_CPU|STARPU_CUDA,
 	.cpu_funcs = {increment_cpu, NULL},
 #ifdef STARPU_USE_CUDA
@@ -47,8 +48,7 @@ int increment_token(int synchronous)
 	struct starpu_task *task = starpu_task_create();
         task->synchronous = synchronous;
 	task->cl = &increment_cl;
-	task->buffers[0].handle = token_handle;
-	task->buffers[0].mode = STARPU_RW;
+	task->handles[0] = token_handle;
 	return starpu_task_submit(task);
 }
 

+ 12 - 12
tests/datawizard/data_implicit_deps.c

@@ -36,6 +36,8 @@ static void f(void *descr[], __attribute__ ((unused)) void *_args)
 
 static struct starpu_codelet cl_f =
 {
+	.modes[1] = STARPU_RW,
+	.modes[0] = STARPU_R,
 	.where = STARPU_CPU|STARPU_CUDA,
 	.cpu_funcs = {f, NULL},
 	.cuda_funcs = {f, NULL},
@@ -50,6 +52,8 @@ static void g(void *descr[], __attribute__ ((unused)) void *_args)
 
 static struct starpu_codelet cl_g =
 {
+	.modes[1] = STARPU_RW,
+	.modes[0] = STARPU_R,
 	.where = STARPU_CPU|STARPU_CUDA,
 	.cpu_funcs = {g, NULL},
 	.cuda_funcs = {g, NULL},
@@ -64,6 +68,8 @@ static void h(void *descr[], __attribute__ ((unused)) void *_args)
 
 static struct starpu_codelet cl_h =
 {
+	.modes[1] = STARPU_RW,
+	.modes[0] = STARPU_R,
 	.where = STARPU_CPU|STARPU_CUDA,
 	.cpu_funcs = {h, NULL},
 	.cuda_funcs = {h, NULL},
@@ -100,30 +106,24 @@ int main(int argc, char **argv)
 	 */
 	struct starpu_task *task_f = starpu_task_create();
 	task_f->cl = &cl_f;
-	task_f->buffers[0].handle = A_handle;
-	task_f->buffers[0].mode = STARPU_R;
-	task_f->buffers[1].handle = B_handle;
-	task_f->buffers[1].mode = STARPU_RW;
+	task_f->handles[0] = A_handle;
+	task_f->handles[1] = B_handle;
 	ret = starpu_task_submit(task_f);
 	if (ret == -ENODEV) goto enodev;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 
 	struct starpu_task *task_g = starpu_task_create();
 	task_g->cl = &cl_g;
-	task_g->buffers[0].handle = B_handle;
-	task_g->buffers[0].mode = STARPU_R;
-	task_g->buffers[1].handle = C_handle;
-	task_g->buffers[1].mode = STARPU_RW;
+	task_g->handles[0] = B_handle;
+	task_g->handles[1] = C_handle;
 	ret = starpu_task_submit(task_g);
 	if (ret == -ENODEV) goto enodev;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 
 	struct starpu_task *task_h = starpu_task_create();
 	task_h->cl = &cl_h;
-	task_h->buffers[0].handle = C_handle;
-	task_h->buffers[0].mode = STARPU_R;
-	task_h->buffers[1].handle = D_handle;
-	task_h->buffers[1].mode = STARPU_RW;
+	task_h->handles[0] = C_handle;
+	task_h->handles[1] = D_handle;
 	ret = starpu_task_submit(task_h);
 	if (ret == -ENODEV) goto enodev;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");

+ 4 - 4
tests/datawizard/dining_philosophers.c

@@ -30,6 +30,8 @@ static void eat_kernel(void *descr[], void *arg)
 
 static struct starpu_codelet eating_cl =
 {
+	.modes[1] = STARPU_RW,
+	.modes[0] = STARPU_RW,
 	.where = STARPU_CPU|STARPU_CUDA|STARPU_OPENCL,
 	.cuda_funcs = {eat_kernel, NULL},
 	.cpu_funcs = {eat_kernel, NULL},
@@ -46,10 +48,8 @@ int submit_one_task(unsigned p)
 	unsigned left = p;
 	unsigned right = (p+1)%N;
 
-	task->buffers[0].handle = fork_handles[left];
-	task->buffers[0].mode = STARPU_RW;
-	task->buffers[1].handle = fork_handles[right];
-	task->buffers[1].mode = STARPU_RW;
+	task->handles[0] = fork_handles[left];
+	task->handles[1] = fork_handles[right];
 
 	int ret = starpu_task_submit(task);
 	return ret;

+ 4 - 4
tests/datawizard/interfaces/multiformat/advanced/same_handle.c

@@ -27,6 +27,8 @@ static int vector[NX]; static starpu_data_handle_t handle;
 
 static struct starpu_codelet cl =
 {
+.modes[1] = STARPU_RW,
+.modes[0] = STARPU_RW,
 #ifdef STARPU_USE_CUDA
 	.cuda_funcs = { cuda_func, NULL },
 #endif
@@ -67,10 +69,8 @@ create_and_submit_tasks(void)
 
 	task = starpu_task_create();
 	task->cl = &cl;
-	task->buffers[0].handle = handle;
-	task->buffers[0].mode = STARPU_RW;
-	task->buffers[1].handle = handle;
-	task->buffers[1].mode = STARPU_RW;
+	task->handles[0] = handle;
+	task->handles[1] = handle;
 
 	ret = starpu_task_submit(task);
 	if (ret == -ENODEV)

+ 2 - 2
tests/datawizard/mpi_like.c

@@ -57,6 +57,7 @@ static void increment_handle_cpu_kernel(void *descr[], void *cl_arg __attribute_
 
 static struct starpu_codelet increment_handle_cl =
 {
+	.modes[0] = STARPU_RW,
 	.where = STARPU_CPU|STARPU_CUDA,
 	.cpu_funcs = {increment_handle_cpu_kernel, NULL},
 #ifdef STARPU_USE_CUDA
@@ -70,8 +71,7 @@ static void increment_handle(struct thread_data *thread_data)
 	struct starpu_task *task = starpu_task_create();
 	task->cl = &increment_handle_cl;
 
-	task->buffers[0].handle = thread_data->handle;
-	task->buffers[0].mode = STARPU_RW;
+	task->handles[0] = thread_data->handle;
 
 	task->cl_arg = thread_data;
 

+ 2 - 2
tests/datawizard/mpi_like_async.c

@@ -72,6 +72,7 @@ static void increment_handle_cpu_kernel(void *descr[], void *cl_arg __attribute_
 
 static struct starpu_codelet increment_handle_cl =
 {
+	.modes[0] = STARPU_RW,
 	.where = STARPU_CPU|STARPU_CUDA,
 	.cpu_funcs = {increment_handle_cpu_kernel, NULL},
 #ifdef STARPU_USE_CUDA
@@ -85,8 +86,7 @@ static void increment_handle_async(struct thread_data *thread_data)
 	struct starpu_task *task = starpu_task_create();
 	task->cl = &increment_handle_cl;
 
-	task->buffers[0].handle = thread_data->handle;
-	task->buffers[0].mode = STARPU_RW;
+	task->handles[0] = thread_data->handle;
 
 	task->detach = 1;
 	task->destroy = 1;

+ 2 - 2
tests/datawizard/sync_with_data_with_mem.c

@@ -36,6 +36,7 @@ static void dummy_codelet(void *descr[], __attribute__ ((unused)) void *_args)
 
 static struct starpu_codelet cl =
 {
+	.modes[0] = STARPU_RW,
 	.where = STARPU_CPU|STARPU_CUDA|STARPU_OPENCL,
 	.cpu_funcs = {dummy_codelet, NULL},
 #ifdef STARPU_USE_CUDA
@@ -54,8 +55,7 @@ int use_handle(starpu_data_handle_t handle)
 
 	task = starpu_task_create();
 		task->cl = &cl;
-		task->buffers[0].handle = handle;
-		task->buffers[0].mode = STARPU_RW;
+		task->handles[0] = handle;
 		task->detach = 0;
 
 	ret = starpu_task_submit(task);

+ 2 - 2
tests/datawizard/sync_with_data_with_mem_non_blocking.c

@@ -37,6 +37,7 @@ static void dummy_codelet(void *descr[], __attribute__ ((unused)) void *_args)
 
 static struct starpu_codelet cl =
 {
+	.modes[0] = STARPU_RW,
 	.where = STARPU_CPU|STARPU_CUDA|STARPU_OPENCL,
 	.cpu_funcs = {dummy_codelet, NULL},
 #ifdef STARPU_USE_CUDA
@@ -55,8 +56,7 @@ int use_handle(starpu_data_handle_t handle)
 
 	task = starpu_task_create();
 		task->cl = &cl;
-		task->buffers[0].handle = handle;
-		task->buffers[0].mode = STARPU_RW;
+		task->handles[0] = handle;
 		task->detach = 0;
 
 	ret = starpu_task_submit(task);

+ 2 - 2
tests/datawizard/sync_with_data_with_mem_non_blocking_implicit.c

@@ -37,6 +37,7 @@ static void dummy_codelet(void *descr[], __attribute__ ((unused)) void *_args)
 
 static struct starpu_codelet cl =
 {
+	.modes[0] = STARPU_RW,
 	.where = STARPU_CPU|STARPU_CUDA|STARPU_OPENCL,
 	.cpu_funcs = {dummy_codelet, NULL},
 #ifdef STARPU_USE_CUDA
@@ -55,8 +56,7 @@ int use_handle(starpu_data_handle_t handle)
 
 	task = starpu_task_create();
 		task->cl = &cl;
-		task->buffers[0].handle = handle;
-		task->buffers[0].mode = STARPU_RW;
+		task->handles[0] = handle;
 		task->detach = 0;
 
 	ret = starpu_task_submit(task);

+ 2 - 2
tests/datawizard/unpartition.c

@@ -36,6 +36,7 @@ static void dummy_codelet(void *descr[], __attribute__ ((unused)) void *_args)
 
 static struct starpu_codelet cl =
 {
+	.modes[0] = STARPU_RW,
 	.where = STARPU_CPU|STARPU_CUDA|STARPU_OPENCL,
 	.cpu_funcs = {dummy_codelet, NULL},
 #ifdef STARPU_USE_CUDA
@@ -54,8 +55,7 @@ int use_handle(starpu_data_handle_t handle)
 
 	task = starpu_task_create();
 		task->cl = &cl;
-		task->buffers[0].handle = handle;
-		task->buffers[0].mode = STARPU_RW;
+		task->handles[0] = handle;
 		task->detach = 0;
 
 	ret = starpu_task_submit(task);

+ 2 - 2
tests/errorcheck/invalid_blocking_calls.c

@@ -40,6 +40,7 @@ static void wrong_func(void *descr[], void *arg)
 
 static struct starpu_codelet wrong_codelet =
 {
+	.modes[0] = STARPU_RW,
 	.where = STARPU_CPU|STARPU_CUDA|STARPU_OPENCL,
 	.cpu_funcs = {wrong_func, NULL},
 	.cuda_funcs = {wrong_func, NULL},
@@ -76,8 +77,7 @@ int main(int argc, char **argv)
 
 	task->cl = &wrong_codelet;
 
-	task->buffers[0].handle = handle;
-	task->buffers[0].mode = STARPU_RW;
+	task->handles[0] = handle;
 
 	task->use_tag = 1;
 	task->tag_id = TAG;