Forráskód Böngészése

src: Update towards new codelet/task interface which defines access modes for data handles into starpu_codelet and no longer in starpu_task

Nathalie Furmento 13 éve
szülő
commit
4092dc6e8c

+ 3 - 3
src/core/sched_policy.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2012  Université de Bordeaux 1
- * Copyright (C) 2010-2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010-2012  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -347,8 +347,7 @@ struct starpu_task *_starpu_create_conversion_task(starpu_data_handle_t handle,
 
 	conversion_task = starpu_task_create();
 	conversion_task->synchronous = 0;
-	conversion_task->buffers[0].handle = handle;
-	conversion_task->buffers[0].mode = STARPU_RW;
+	conversion_task->handles[0] = handle;
 
 	/* The node does not really matter here */
 	format_interface = (struct starpu_multiformat_interface *) starpu_data_get_interface_on_node(handle, 0);
@@ -394,6 +393,7 @@ struct starpu_task *_starpu_create_conversion_task(starpu_data_handle_t handle,
 		STARPU_ASSERT(0);
 	}
 
+	conversion_task->cl->modes[0] = STARPU_RW;
 	return conversion_task;
 }
 

+ 9 - 9
src/datawizard/reduction.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2011, 2012  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -168,11 +168,11 @@ void _starpu_data_end_reduction_mode(starpu_data_handle_t handle)
 					redux_task->cl = handle->redux_cl;
 					STARPU_ASSERT(redux_task->cl);
 
-					redux_task->buffers[0].handle = replicate_array[i];
-					redux_task->buffers[0].mode = STARPU_RW;
+					redux_task->handles[0] = replicate_array[i];
+					redux_task->cl->modes[0] = STARPU_RW;
 
-					redux_task->buffers[1].handle = replicate_array[i+step];
-					redux_task->buffers[1].mode = STARPU_R;
+					redux_task->handles[1] = replicate_array[i+step];
+					redux_task->cl->modes[1] = STARPU_R;
 
 					redux_task->detach = 0;
 
@@ -212,11 +212,11 @@ void _starpu_data_end_reduction_mode(starpu_data_handle_t handle)
 		redux_task->cl = handle->redux_cl;
 		STARPU_ASSERT(redux_task->cl);
 
-		redux_task->buffers[0].handle = handle;
-		redux_task->buffers[0].mode = STARPU_RW;
+		redux_task->handles[0] = handle;
+		redux_task->cl->modes[0] = STARPU_RW;
 
-		redux_task->buffers[1].handle = replicate_array[0];
-		redux_task->buffers[1].mode = STARPU_R;
+		redux_task->handles[1] = replicate_array[0];
+		redux_task->cl->modes[1] = STARPU_R;
 
 		if (last_replicate_deps[0])
 			starpu_task_declare_deps_array(redux_task, 1, &last_replicate_deps[0]);

+ 3 - 4
src/util/starpu_data_cpy.c

@@ -65,6 +65,7 @@ static struct starpu_codelet copy_cl =
 	.opencl_func = STARPU_MULTIPLE_OPENCL_IMPLEMENTATIONS,
 	.opencl_funcs = {data_cpy_func, NULL},
 	.nbuffers = 2,
+	.modes = {STARPU_RW, STARPU_R},
 	.model = &copy_model
 };
 
@@ -82,10 +83,8 @@ int starpu_data_cpy(starpu_data_handle_t dst_handle, starpu_data_handle_t src_ha
 	task->callback_func = callback_func;
 	task->callback_arg = callback_arg;
 
-	task->buffers[0].handle = dst_handle;
-	task->buffers[0].mode = STARPU_RW;
-	task->buffers[1].handle = src_handle;
-	task->buffers[1].mode = STARPU_R;
+	task->handles[0] = dst_handle;
+	task->handles[1] = src_handle;
 
 	task->synchronous = !asynchronous;
 

+ 6 - 3
src/util/starpu_insert_task_utils.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2011, 2012  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -183,8 +183,11 @@ int _starpu_insert_task_create_and_submit(char *arg_buffer, struct starpu_codele
 
 			enum starpu_access_mode mode = arg_type;
 
-			(*task)->buffers[current_buffer].handle = handle;
-			(*task)->buffers[current_buffer].mode = mode;
+			(*task)->handles[current_buffer] = handle;
+			if (cl->modes[current_buffer])
+				STARPU_ASSERT(cl->modes[current_buffer] == mode);
+			else
+				cl->modes[current_buffer] = mode;
 
 			current_buffer++;
 		}