Browse Source

examples: 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 years ago
parent
commit
3a30c58c65

+ 8 - 10
examples/axpy/axpy.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -82,7 +82,8 @@ static struct starpu_codelet axpy_cl =
 #ifdef STARPU_USE_CUDA
 	.cuda_funcs = {axpy_gpu, NULL},
 #endif
-	.nbuffers = 2
+	.nbuffers = 2,
+	.modes = {STARPU_R, STARPU_RW}
 };
 
 int main(int argc, char **argv)
@@ -92,7 +93,7 @@ int main(int argc, char **argv)
 
 	starpu_helper_cublas_init();
 
-	/* This is equivalent to 
+	/* This is equivalent to
 		vec_a = malloc(N*sizeof(TYPE));
 		vec_b = malloc(N*sizeof(TYPE));
 	*/
@@ -130,7 +131,7 @@ int main(int argc, char **argv)
 
 	struct timeval start;
 	struct timeval end;
-	
+
 	gettimeofday(&start, NULL);
 
 	unsigned b;
@@ -142,12 +143,9 @@ int main(int argc, char **argv)
 
 		task->cl_arg = &alpha;
 
-		task->buffers[0].handle = starpu_data_get_sub_data(handle_x, 1, b);
-		task->buffers[0].mode = STARPU_R;
-		
-		task->buffers[1].handle = starpu_data_get_sub_data(handle_y, 1, b);
-		task->buffers[1].mode = STARPU_RW;
-		
+		task->handles[0] = starpu_data_get_sub_data(handle_x, 1, b);
+		task->handles[1] = starpu_data_get_sub_data(handle_y, 1, b);
+
 		starpu_task_submit(task);
 	}
 

+ 3 - 3
examples/basic_examples/block.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010, 2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -46,13 +46,13 @@ int execute_on(uint32_t where, device_func func, float *block, int pnx, int pny,
         cl.cpu_funcs[0] = func;
         cl.opencl_funcs[0] = func;
         cl.nbuffers = 1;
+	cl.modes[0] = STARPU_RW,
         cl.model = NULL;
 
         struct starpu_task *task = starpu_task_create();
         task->cl = &cl;
         task->callback_func = NULL;
-        task->buffers[0].handle = block_handle;
-        task->buffers[0].mode = STARPU_RW;
+        task->handles[0] = block_handle;
 	task->cl_arg = &multiplier;
 	task->cl_arg_size = sizeof(multiplier);
 

+ 5 - 7
examples/basic_examples/mult.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010-2011  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -269,6 +269,7 @@ static struct starpu_codelet cl =
         /* the codelet manipulates 3 buffers that are managed by the
          * DSM */
         .nbuffers = 3,
+	.modes = {STARPU_R, STARPU_R, STARPU_W},
         /* in case the scheduling policy may use performance models */
         .model = &mult_perf_model
 };
@@ -311,10 +312,8 @@ static void launch_tasks(void)
 			 * identified by "tasky" (respectively "taskx). The "1"
 			 * tells StarPU that there is a single argument to the
 			 * variable-arity function starpu_data_get_sub_data */
-			task->buffers[0].handle = starpu_data_get_sub_data(A_handle, 1, tasky);
-			task->buffers[0].mode = STARPU_R;
-			task->buffers[1].handle = starpu_data_get_sub_data(B_handle, 1, taskx);
-			task->buffers[1].mode = STARPU_R;
+			task->handles[0] = starpu_data_get_sub_data(A_handle, 1, tasky);
+			task->handles[1] = starpu_data_get_sub_data(B_handle, 1, taskx);
 
 			/* 2 filters were applied on matrix C, so we give
 			 * starpu_data_get_sub_data 2 arguments. The order of the arguments
@@ -325,8 +324,7 @@ static void launch_tasks(void)
 			 * NB2: starpu_data_get_sub_data(C_handle, 2, taskx, tasky) is
 			 * equivalent to
 			 * starpu_data_get_sub_data(starpu_data_get_sub_data(C_handle, 1, taskx), 1, tasky)*/
-			task->buffers[2].handle = starpu_data_get_sub_data(C_handle, 2, taskx, tasky);
-			task->buffers[2].mode = STARPU_W;
+			task->handles[2] = starpu_data_get_sub_data(C_handle, 2, taskx, tasky);
 
 			/* this is not a blocking call since task->synchronous = 0 */
 			starpu_task_submit(task);

+ 2 - 2
examples/basic_examples/variable.c

@@ -65,6 +65,7 @@ int main(int argc, char **argv)
         cl.opencl_funcs[0] = opencl_codelet;
 #endif
         cl.nbuffers = 1;
+	cl.modes[0] = STARPU_RW;
         cl.model = NULL;
 
 	for (i = 0; i < niter; i++)
@@ -76,8 +77,7 @@ int main(int argc, char **argv)
 
 		task->callback_func = NULL;
 
-		task->buffers[0].handle = float_array_handle;
-		task->buffers[0].mode = STARPU_RW;
+		task->handles[0] = float_array_handle;
 
 		ret = starpu_task_submit(task);
 		if (STARPU_UNLIKELY(ret == -ENODEV))

+ 3 - 3
examples/basic_examples/vector_scal.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
  * Copyright (C) 2010, 2011  Université de Bordeaux 1
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -74,6 +74,7 @@ static struct starpu_codelet cl =
 	.opencl_funcs = {scal_opencl_func, NULL},
 #endif
 	.nbuffers = 1,
+	.modes = {STARPU_RW},
 	.model = &vector_scal_model,
 	.power_model = &vector_scal_power_model
 };
@@ -129,8 +130,7 @@ int main(int argc, char **argv)
 	task->cl = &cl;
 
 	/* the codelet manipulates one buffer in RW mode */
-	task->buffers[0].handle = vector_handle;
-	task->buffers[0].mode = STARPU_RW;
+	task->handles[0] = vector_handle;
 
 	/* an argument is passed to the codelet, beware that this is a
 	 * READ-ONLY buffer and that the codelet may be given a pointer to a

+ 7 - 7
examples/cholesky/cholesky_models.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
  * Copyright (C) 2011  Télécom-SudParis
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -40,7 +40,7 @@ static double cpu_chol_task_11_cost(struct starpu_task *task, enum starpu_perf_a
 {
 	uint32_t n;
 
-	n = starpu_matrix_get_nx(task->buffers[0].handle);
+	n = starpu_matrix_get_nx(task->handles[0]);
 
 	double cost = (((double)(n)*n*n)/1000.0f*0.894/0.79176);
 
@@ -55,7 +55,7 @@ static double cuda_chol_task_11_cost(struct starpu_task *task, enum starpu_perf_
 {
 	uint32_t n;
 
-	n = starpu_matrix_get_nx(task->buffers[0].handle);
+	n = starpu_matrix_get_nx(task->handles[0]);
 
 	double cost = (((double)(n)*n*n)/50.0f/10.75/5.088633/0.9883);
 
@@ -70,7 +70,7 @@ static double cpu_chol_task_21_cost(struct starpu_task *task, enum starpu_perf_a
 {
 	uint32_t n;
 
-	n = starpu_matrix_get_nx(task->buffers[0].handle);
+	n = starpu_matrix_get_nx(task->handles[0]);
 
 	double cost = (((double)(n)*n*n)/7706.674/0.95/0.9965);
 
@@ -85,7 +85,7 @@ static double cuda_chol_task_21_cost(struct starpu_task *task, enum starpu_perf_
 {
 	uint32_t n;
 
-	n = starpu_matrix_get_nx(task->buffers[0].handle);
+	n = starpu_matrix_get_nx(task->handles[0]);
 
 	double cost = (((double)(n)*n*n)/50.0f/10.75/87.29520);
 
@@ -100,7 +100,7 @@ static double cpu_chol_task_22_cost(struct starpu_task *task, enum starpu_perf_a
 {
 	uint32_t n;
 
-	n = starpu_matrix_get_nx(task->buffers[0].handle);
+	n = starpu_matrix_get_nx(task->handles[0]);
 
 	double cost = (((double)(n)*n*n)/50.0f/10.75/8.0760);
 
@@ -115,7 +115,7 @@ static double cuda_chol_task_22_cost(struct starpu_task *task, enum starpu_perf_
 {
 	uint32_t n;
 
-	n = starpu_matrix_get_nx(task->buffers[0].handle);
+	n = starpu_matrix_get_nx(task->handles[0]);
 
 	double cost = (((double)(n)*n*n)/50.0f/10.75/76.30666);
 

+ 4 - 4
examples/filters/fblock.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -99,7 +99,8 @@ int main(int argc, char **argv)
 #ifdef STARPU_USE_OPENCL
                 .opencl_funcs = {opencl_func, NULL},
 #endif
-		.nbuffers = 1
+		.nbuffers = 1,
+                .modes = {STARPU_RW}
 	};
         starpu_init(NULL);
 
@@ -139,8 +140,7 @@ int main(int argc, char **argv)
                 task->cl = &cl;
                 task->synchronous = 1;
                 task->callback_func = NULL;
-                task->buffers[0].handle = starpu_data_get_sub_data(handle, 1, i);
-                task->buffers[0].mode = STARPU_RW;
+                task->handles[0] = starpu_data_get_sub_data(handle, 1, i);
                 task->cl_arg = &multiplier;
 
                 ret = starpu_task_submit(task);

+ 4 - 4
examples/filters/fmatrix.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -63,7 +63,8 @@ int main(int argc, char **argv)
 	{
                 .where = STARPU_CPU,
                 .cpu_funcs = {cpu_func, NULL},
-                .nbuffers = 1
+                .nbuffers = 1,
+		.modes = {STARPU_RW}
         };
         starpu_init(NULL);
 
@@ -83,8 +84,7 @@ int main(int argc, char **argv)
 	{
                 struct starpu_task *task = starpu_task_create();
                 int factor = i;
-		task->buffers[0].handle = starpu_data_get_sub_data(handle, 1, i);
-		task->buffers[0].mode = STARPU_RW;
+		task->handles[0] = starpu_data_get_sub_data(handle, 1, i);
                 task->cl = &cl;
                 task->synchronous = 1;
                 task->cl_arg = &factor;

+ 4 - 4
examples/filters/fvector.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -46,7 +46,8 @@ int main(int argc, char **argv)
 	{
                 .where = STARPU_CPU,
                 .cpu_funcs = {cpu_func, NULL},
-                .nbuffers = 1
+                .nbuffers = 1,
+		.modes = {STARPU_RW}
         };
 
         for(i=0 ; i<NX ; i++) vector[i] = i;
@@ -74,8 +75,7 @@ int main(int argc, char **argv)
                 struct starpu_task *task = starpu_task_create();
 
                 factor *= 10;
-		task->buffers[0].handle = sub_handle;
-		task->buffers[0].mode = STARPU_RW;
+		task->handles[0] = sub_handle;
                 task->cl = &cl;
                 task->synchronous = 1;
                 task->cl_arg = &factor;

+ 65 - 100
examples/heat/dw_factolu.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2009-2011  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -40,6 +40,7 @@ static struct starpu_codelet cl11 =
 	.cuda_funcs = {dw_cublas_codelet_update_u11, NULL},
 #endif
 	.nbuffers = 1,
+	.modes = {STARPU_RW},
 	.model = &model_11
 };
 
@@ -51,8 +52,9 @@ static struct starpu_codelet cl12 =
 	.cuda_funcs = {dw_cublas_codelet_update_u12, NULL},
 #endif
 	.nbuffers = 2,
+	.modes = {STARPU_R, STARPU_RW},
 	.model = &model_12
-}; 
+};
 
 static struct starpu_codelet cl21 =
 {
@@ -62,6 +64,7 @@ static struct starpu_codelet cl21 =
 	.cuda_funcs = {dw_cublas_codelet_update_u21, NULL},
 #endif
 	.nbuffers = 2,
+	.modes = {STARPU_R, STARPU_RW},
 	.model = &model_21
 }; 
 
@@ -73,6 +76,7 @@ static struct starpu_codelet cl22 =
 	.cuda_funcs = {dw_cublas_codelet_update_u22, NULL},
 #endif
 	.nbuffers = 3,
+	.modes = {STARPU_R, STARPU_R, STARPU_RW},
 	.model = &model_22
 }; 
 
@@ -103,14 +107,12 @@ void dw_callback_v2_codelet_update_u22(void *argcb)
 		cl_args *u11arg = malloc(sizeof(cl_args));
 
 		struct starpu_task *task = starpu_task_create();
-			task->callback_func = dw_callback_v2_codelet_update_u11;
-			task->callback_arg = u11arg;
-			task->cl = &cl11;
-			task->cl_arg = u11arg;
+		task->callback_func = dw_callback_v2_codelet_update_u11;
+		task->callback_arg = u11arg;
+		task->cl = &cl11;
+		task->cl_arg = u11arg;
 
-			task->buffers[0].handle =
-				starpu_data_get_sub_data(args->dataA, 2, k+1, k+1);
-			task->buffers[0].mode = STARPU_RW;
+		task->handles[0] = starpu_data_get_sub_data(args->dataA, 2, k+1, k+1);
 	
 		u11arg->dataA = args->dataA;
 		u11arg->i = k + 1;
@@ -135,8 +137,7 @@ void dw_callback_v2_codelet_update_u22(void *argcb)
 			uint8_t u = STARPU_ATOMIC_OR(&advance_12_21[(k+1) + j*nblocks], STARTED);
 				if ((u & STARTED) == 0)
 				{
-					/* we are the only one that should 
-					 * launch that task */
+					/* we are the only one that should launch that task */
 					cl_args *u21a = malloc(sizeof(cl_args));
 
 					struct starpu_task *task21 = starpu_task_create();
@@ -144,19 +145,15 @@ void dw_callback_v2_codelet_update_u22(void *argcb)
 					task21->callback_arg = u21a;
 					task21->cl = &cl21;
 					task21->cl_arg = u21a;
-			
+
 					u21a->i = k+1;
 					u21a->k = j;
 					u21a->nblocks = args->nblocks;
 					u21a->dataA = args->dataA;
 
-					task21->buffers[0].handle = 
-						starpu_data_get_sub_data(args->dataA, 2, u21a->i, u21a->i);
-					task21->buffers[0].mode = STARPU_R;
-					task21->buffers[1].handle =
-						starpu_data_get_sub_data(args->dataA, 2, u21a->i, u21a->k);
-					task21->buffers[1].mode = STARPU_RW;
-		
+					task21->handles[0] = starpu_data_get_sub_data(args->dataA, 2, u21a->i, u21a->i);
+					task21->handles[1] = starpu_data_get_sub_data(args->dataA, 2, u21a->i, u21a->k);
+
 					starpu_task_submit(task21);
 				}
 		}
@@ -188,11 +185,9 @@ void dw_callback_v2_codelet_update_u22(void *argcb)
 					u12a->nblocks = args->nblocks;
 					u12a->dataA = args->dataA;
 
-					task12->buffers[0].handle = starpu_data_get_sub_data(args->dataA, 2, u12a->i, u12a->i); 
-					task12->buffers[0].mode = STARPU_R;
-					task12->buffers[1].handle = starpu_data_get_sub_data(args->dataA, 2, u12a->k, u12a->i); 
-					task12->buffers[1].mode = STARPU_RW;
-					
+					task12->handles[0] = starpu_data_get_sub_data(args->dataA, 2, u12a->i, u12a->i);
+					task12->handles[1] = starpu_data_get_sub_data(args->dataA, 2, u12a->k, u12a->i);
+
 					starpu_task_submit(task12);
 				}
 		}
@@ -241,15 +236,10 @@ void dw_callback_v2_codelet_update_u12(void *argcb)
 				u22a->dataA = args->dataA;
 				u22a->nblocks = nblocks;
 
-				task22->buffers[0].handle = starpu_data_get_sub_data(args->dataA, 2, u22a->i, u22a->k);
-				task22->buffers[0].mode = STARPU_R;
+				task22->handles[0] = starpu_data_get_sub_data(args->dataA, 2, u22a->i, u22a->k);
+				task22->handles[1] = starpu_data_get_sub_data(args->dataA, 2, u22a->k, u22a->j);
+				task22->handles[2] = starpu_data_get_sub_data(args->dataA, 2, u22a->i, u22a->j);
 
-				task22->buffers[1].handle = starpu_data_get_sub_data(args->dataA, 2, u22a->k, u22a->j);
-				task22->buffers[1].mode = STARPU_R;
-
-				task22->buffers[2].handle = starpu_data_get_sub_data(args->dataA, 2, u22a->i, u22a->j);
-				task22->buffers[2].mode = STARPU_RW;
-				
 				/* schedule that codelet */
 				if (!no_prio && (slicey == i+1))
 					task22->priority = STARPU_MAX_PRIO;
@@ -301,15 +291,10 @@ void dw_callback_v2_codelet_update_u21(void *argcb)
 				u22a->dataA = args->dataA;
 				u22a->nblocks = nblocks;
 
-				task22->buffers[0].handle = starpu_data_get_sub_data(args->dataA, 2, u22a->i, u22a->k);
-				task22->buffers[0].mode = STARPU_R;
-
-				task22->buffers[1].handle = starpu_data_get_sub_data(args->dataA, 2, u22a->k, u22a->j);
-				task22->buffers[1].mode = STARPU_R;
+				task22->handles[0] = starpu_data_get_sub_data(args->dataA, 2, u22a->i, u22a->k);
+				task22->handles[1] = starpu_data_get_sub_data(args->dataA, 2, u22a->k, u22a->j);
+				task22->handles[2] = starpu_data_get_sub_data(args->dataA, 2, u22a->i, u22a->j);
 
-				task22->buffers[2].handle = starpu_data_get_sub_data(args->dataA, 2, u22a->i, u22a->j);
-				task22->buffers[2].mode = STARPU_RW;
-				
 				/* schedule that codelet */
 				if (!no_prio && (slicex == i+1))
 					task22->priority = STARPU_MAX_PRIO;
@@ -377,10 +362,8 @@ void dw_callback_v2_codelet_update_u11(void *argcb)
 					u12a->nblocks = args->nblocks;
 					u12a->dataA = args->dataA;
 
-					task12->buffers[0].handle = starpu_data_get_sub_data(args->dataA, 2, u12a->i, u12a->i); 
-					task12->buffers[0].mode = STARPU_R;
-					task12->buffers[1].handle = starpu_data_get_sub_data(args->dataA, 2, u12a->k, u12a->i); 
-					task12->buffers[1].mode = STARPU_RW;
+					task12->handles[0] = starpu_data_get_sub_data(args->dataA, 2, u12a->i, u12a->i);
+					task12->handles[1] = starpu_data_get_sub_data(args->dataA, 2, u12a->k, u12a->i);
 
 					if (!no_prio && (slice == i +1))
 						task12->priority = STARPU_MAX_PRIO;
@@ -408,21 +391,19 @@ void dw_callback_v2_codelet_update_u11(void *argcb)
 					cl_args *u21a = malloc(sizeof(cl_args));
 
 					struct starpu_task *task21 = starpu_task_create();
-						task21->callback_func = dw_callback_v2_codelet_update_u21;
-						task21->callback_arg = u21a;
-						task21->cl = &cl21;
-						task21->cl_arg = u21a;
-		
+					task21->callback_func = dw_callback_v2_codelet_update_u21;
+					task21->callback_arg = u21a;
+					task21->cl = &cl21;
+					task21->cl_arg = u21a;
+
 					u21a->i = i;
 					u21a->k = slice;
 					u21a->nblocks = args->nblocks;
 					u21a->dataA = args->dataA;
 
-					task21->buffers[0].handle = starpu_data_get_sub_data(args->dataA, 2, u21a->i, u21a->i);
-					task21->buffers[0].mode = STARPU_R;
-					task21->buffers[1].handle = starpu_data_get_sub_data(args->dataA, 2, u21a->i, u21a->k);
-					task21->buffers[1].mode = STARPU_RW;
-		
+					task21->handles[0] = starpu_data_get_sub_data(args->dataA, 2, u21a->i, u21a->i);
+					task21->handles[1] = starpu_data_get_sub_data(args->dataA, 2, u21a->i, u21a->k);
+
 					if (!no_prio && (slice == i +1))
 						task21->priority = STARPU_MAX_PRIO;
 
@@ -474,43 +455,35 @@ void dw_callback_codelet_update_u11(void *argcb)
 			cl_args *u21a = malloc(sizeof(cl_args));
 
 			struct starpu_task *task12 = starpu_task_create();
-				task12->callback_func = dw_callback_codelet_update_u12_21;
-				task12->callback_arg = u12a;
-				task12->cl = &cl12;
-				task12->cl_arg = u12a;
+			task12->callback_func = dw_callback_codelet_update_u12_21;
+			task12->callback_arg = u12a;
+			task12->cl = &cl12;
+			task12->cl_arg = u12a;
 
 			struct starpu_task *task21 = starpu_task_create();
-				task21->callback_func = dw_callback_codelet_update_u12_21;
-				task21->callback_arg = u21a;
-				task21->cl = &cl21;
-				task21->cl_arg = u21a;
-			
+			task21->callback_func = dw_callback_codelet_update_u12_21;
+			task21->callback_arg = u21a;
+			task21->cl = &cl21;
+			task21->cl_arg = u21a;
+
 			u12a->i = args->i;
 			u12a->k = slice;
 			u12a->nblocks = args->nblocks;
 			u12a->dataA = args->dataA;
 			u12a->remaining = remaining;
-			
+
 			u21a->i = args->i;
 			u21a->k = slice;
 			u21a->nblocks = args->nblocks;
 			u21a->dataA = args->dataA;
 			u21a->remaining = remaining;
 
-			task12->buffers[0].handle = 
-				starpu_data_get_sub_data(args->dataA, 2, u12a->i, u12a->i); 
-			task12->buffers[0].mode = STARPU_R;
-			task12->buffers[1].handle = 
-				starpu_data_get_sub_data(args->dataA, 2, u12a->k, u12a->i); 
-			task12->buffers[1].mode = STARPU_RW;
-
-			task21->buffers[0].handle = 
-				starpu_data_get_sub_data(args->dataA, 2, u21a->i, u21a->i);
-			task21->buffers[0].mode = STARPU_R;
-			task21->buffers[1].handle = 
-				starpu_data_get_sub_data(args->dataA, 2, u21a->i, u21a->k);
-			task21->buffers[1].mode = STARPU_RW;
-		
+			task12->handles[0] = starpu_data_get_sub_data(args->dataA, 2, u12a->i, u12a->i);
+			task12->handles[1] = starpu_data_get_sub_data(args->dataA, 2, u12a->k, u12a->i);
+
+			task21->handles[0] = starpu_data_get_sub_data(args->dataA, 2, u21a->i, u21a->i);
+			task21->handles[1] = starpu_data_get_sub_data(args->dataA, 2, u21a->i, u21a->k);
+
 			starpu_task_submit(task12);
 			starpu_task_submit(task21);
 		}
@@ -536,8 +509,7 @@ void dw_callback_codelet_update_u22(void *argcb)
 			task->cl = &cl11;
 			task->cl_arg = u11arg;
 
-			task->buffers[0].handle = starpu_data_get_sub_data(args->dataA, 2, args->k + 1, args->k + 1);
-			task->buffers[0].mode = STARPU_RW;
+			task->handles[0] = starpu_data_get_sub_data(args->dataA, 2, args->k + 1, args->k + 1);
 	
 		u11arg->dataA = args->dataA;
 		u11arg->i = args->k + 1;
@@ -585,15 +557,10 @@ void dw_callback_codelet_update_u12_21(void *argcb)
 				u22a->nblocks = nblocks;
 				u22a->remaining = remaining;
 
-				task22->buffers[0].handle = starpu_data_get_sub_data(args->dataA, 2, u22a->i, u22a->k);
-				task22->buffers[0].mode = STARPU_R;
-
-				task22->buffers[1].handle = starpu_data_get_sub_data(args->dataA, 2, u22a->k, u22a->j);
-				task22->buffers[1].mode = STARPU_R;
+				task22->handles[0] = starpu_data_get_sub_data(args->dataA, 2, u22a->i, u22a->k);
+				task22->handles[1] = starpu_data_get_sub_data(args->dataA, 2, u22a->k, u22a->j);
+				task22->handles[2] = starpu_data_get_sub_data(args->dataA, 2, u22a->i, u22a->j);
 
-				task22->buffers[2].handle = starpu_data_get_sub_data(args->dataA, 2, u22a->i, u22a->j);
-				task22->buffers[2].mode = STARPU_RW;
-				
 				/* schedule that codelet */
 				starpu_task_submit(task22);
 			}
@@ -619,13 +586,12 @@ void dw_codelet_facto(starpu_data_handle_t dataA, unsigned nblocks)
 
 	/* inject a new task with this codelet into the system */ 
 	struct starpu_task *task = starpu_task_create();
-		task->callback_func = dw_callback_codelet_update_u11;
-		task->callback_arg = args;
-		task->cl = &cl11;
-		task->cl_arg = args;
+	task->callback_func = dw_callback_codelet_update_u11;
+	task->callback_arg = args;
+	task->cl = &cl11;
+	task->cl_arg = args;
 
-		task->buffers[0].handle = starpu_data_get_sub_data(dataA, 2, 0, 0);
-		task->buffers[0].mode = STARPU_RW;
+	task->handles[0] = starpu_data_get_sub_data(dataA, 2, 0, 0);
 
 	/* schedule the codelet */
 	starpu_task_submit(task);
@@ -671,13 +637,12 @@ void dw_codelet_facto_v2(starpu_data_handle_t dataA, unsigned nblocks)
 
 	/* inject a new task with this codelet into the system */ 
 	struct starpu_task *task = starpu_task_create();
-		task->callback_func = dw_callback_v2_codelet_update_u11;
-		task->callback_arg = args;
-		task->cl = &cl11;
-		task->cl_arg = args;
+	task->callback_func = dw_callback_v2_codelet_update_u11;
+	task->callback_arg = args;
+	task->cl = &cl11;
+	task->cl_arg = args;
 
-		task->buffers[0].handle = starpu_data_get_sub_data(dataA, 2, 0, 0); 
-		task->buffers[0].mode = STARPU_RW;
+	task->handles[0] = starpu_data_get_sub_data(dataA, 2, 0, 0); 
 
 	/* schedule the codelet */
 	int ret = starpu_task_submit(task);

+ 47 - 40
examples/heat/dw_sparse_cg.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010, 2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -139,25 +139,27 @@ void init_cg(struct cg_problem *problem)
 	task1->cl->where = STARPU_CPU;
 	task1->cl->cpu_funcs[0] = cpu_codelet_func_1;
 	task1->cl->nbuffers = 4;
-		task1->buffers[0].handle = problem->ds_matrixA;
-		task1->buffers[0].mode = STARPU_R;
-		task1->buffers[1].handle = problem->ds_vecx;
-		task1->buffers[1].mode = STARPU_R;
-		task1->buffers[2].handle = problem->ds_vecr;
-		task1->buffers[2].mode = STARPU_W;
-		task1->buffers[3].handle = problem->ds_vecb;
-		task1->buffers[3].mode = STARPU_R;
+	task1->cl->modes[0] = STARPU_R;
+	task1->cl->modes[1] = STARPU_R;
+	task1->cl->modes[2] = STARPU_W;
+	task1->cl->modes[3] = STARPU_R;
+
+	task1->handles[0] = problem->ds_matrixA;
+	task1->handles[1] = problem->ds_vecx;
+	task1->handles[2] = problem->ds_vecr;
+	task1->handles[3] = problem->ds_vecb;
 
 	/* d = r */
 	struct starpu_task *task2 = create_task(2UL);
 	task2->cl->where = STARPU_CPU;
 	task2->cl->cpu_funcs[0] = cpu_codelet_func_2;
 	task2->cl->nbuffers = 2;
-		task2->buffers[0].handle = problem->ds_vecd;
-		task2->buffers[0].mode = STARPU_W;
-		task2->buffers[1].handle = problem->ds_vecr;
-		task2->buffers[1].mode = STARPU_R;
-	
+	task2->cl->modes[0] = STARPU_W;
+	task2->cl->modes[1] = STARPU_R;
+
+	task2->handles[0] = problem->ds_vecd;
+	task2->handles[1] = problem->ds_vecr;
+
 	starpu_tag_declare_deps((starpu_tag_t)2UL, 1, (starpu_tag_t)1UL);
 
 	/* delta_new = trans(r) r */
@@ -169,8 +171,8 @@ void init_cg(struct cg_problem *problem)
 	task3->cl->cpu_funcs[0] = cpu_codelet_func_3;
 	task3->cl_arg = problem;
 	task3->cl->nbuffers = 1;
-		task3->buffers[0].handle = problem->ds_vecr;
-		task3->buffers[0].mode = STARPU_R;
+	task3->cl->modes[0] = STARPU_R;
+	task3->handles[0] = problem->ds_vecr;
 
 	task3->callback_func = iteration_cg;
 	task3->callback_arg = problem;
@@ -200,12 +202,13 @@ void launch_new_cg_iteration(struct cg_problem *problem)
 	task4->cl->where = STARPU_CPU;
 	task4->cl->cpu_funcs[0] = cpu_codelet_func_4;
 	task4->cl->nbuffers = 3;
-		task4->buffers[0].handle = problem->ds_matrixA;
-		task4->buffers[0].mode = STARPU_R;
-		task4->buffers[1].handle = problem->ds_vecd;
-		task4->buffers[1].mode = STARPU_R;
-		task4->buffers[2].handle = problem->ds_vecq;
-		task4->buffers[2].mode = STARPU_W;
+	task4->cl->modes[0] = STARPU_R;
+	task4->cl->modes[1] = STARPU_R;
+	task4->cl->modes[2] = STARPU_W;
+
+	task4->handles[0] = problem->ds_matrixA;
+	task4->handles[1] = problem->ds_vecd;
+	task4->handles[2] = problem->ds_vecq;
 
 	/* alpha = delta_new / ( trans(d) q )*/
 	struct starpu_task *task5 = create_task(maskiter | 5UL);
@@ -216,10 +219,11 @@ void launch_new_cg_iteration(struct cg_problem *problem)
 	task5->cl->cpu_funcs[0] = cpu_codelet_func_5;
 	task5->cl_arg = problem;
 	task5->cl->nbuffers = 2;
-		task5->buffers[0].handle = problem->ds_vecd;
-		task5->buffers[0].mode = STARPU_R;
-		task5->buffers[1].handle = problem->ds_vecq;
-		task5->buffers[1].mode = STARPU_R;
+	task5->cl->modes[0] = STARPU_R;
+	task5->cl->modes[1] = STARPU_R;
+
+	task5->handles[0] = problem->ds_vecd;
+	task5->handles[1] = problem->ds_vecq;
 
 	starpu_tag_declare_deps((starpu_tag_t)(maskiter | 5UL), 1, (starpu_tag_t)(maskiter | 4UL));
 
@@ -232,10 +236,11 @@ void launch_new_cg_iteration(struct cg_problem *problem)
 	task6->cl->cpu_funcs[0] = cpu_codelet_func_6;
 	task6->cl_arg = problem;
 	task6->cl->nbuffers = 2;
-		task6->buffers[0].handle = problem->ds_vecx;
-		task6->buffers[0].mode = STARPU_RW;
-		task6->buffers[1].handle = problem->ds_vecd;
-		task6->buffers[1].mode = STARPU_R;
+	task6->cl->modes[0] = STARPU_RW;
+	task6->cl->modes[1] = STARPU_R;
+
+	task6->handles[0] = problem->ds_vecx;
+	task6->handles[1] = problem->ds_vecd;
 
 	starpu_tag_declare_deps((starpu_tag_t)(maskiter | 6UL), 1, (starpu_tag_t)(maskiter | 5UL));
 
@@ -248,10 +253,11 @@ void launch_new_cg_iteration(struct cg_problem *problem)
 	task7->cl->cpu_funcs[0] = cpu_codelet_func_7;
 	task7->cl_arg = problem;
 	task7->cl->nbuffers = 2;
-		task7->buffers[0].handle = problem->ds_vecr;
-		task7->buffers[0].mode = STARPU_RW;
-		task7->buffers[1].handle = problem->ds_vecq;
-		task7->buffers[1].mode = STARPU_R;
+	task7->cl->modes[0] = STARPU_RW;
+	task7->cl->modes[1] = STARPU_R;
+
+	task7->handles[0] = problem->ds_vecr;
+	task7->handles[1] = problem->ds_vecq;
 
 	starpu_tag_declare_deps((starpu_tag_t)(maskiter | 7UL), 1, (starpu_tag_t)(maskiter | 6UL));
 
@@ -264,8 +270,8 @@ void launch_new_cg_iteration(struct cg_problem *problem)
 	task8->cl->cpu_funcs[0] = cpu_codelet_func_8;
 	task8->cl_arg = problem;
 	task8->cl->nbuffers = 1;
-		task8->buffers[0].handle = problem->ds_vecr;
-		task8->buffers[0].mode = STARPU_R;
+	task8->cl->modes[0] = STARPU_R;
+	task8->handles[0] = problem->ds_vecr;
 
 	starpu_tag_declare_deps((starpu_tag_t)(maskiter | 8UL), 1, (starpu_tag_t)(maskiter | 7UL));
 
@@ -278,10 +284,11 @@ void launch_new_cg_iteration(struct cg_problem *problem)
 	task9->cl->cpu_funcs[0] = cpu_codelet_func_9;
 	task9->cl_arg = problem;
 	task9->cl->nbuffers = 2;
-		task9->buffers[0].handle = problem->ds_vecd;
-		task9->buffers[0].mode = STARPU_RW;
-		task9->buffers[1].handle = problem->ds_vecr;
-		task9->buffers[1].mode = STARPU_R;
+	task9->cl->modes[0] = STARPU_RW;
+	task9->cl->modes[1] = STARPU_R;
+
+	task9->handles[0] = problem->ds_vecd;
+	task9->handles[1] = problem->ds_vecr;
 
 	starpu_tag_declare_deps((starpu_tag_t)(maskiter | 9UL), 1, (starpu_tag_t)(maskiter | 8UL));
 

+ 19 - 19
examples/heat/lu_kernels_model.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
  * Copyright (C) 2011  Télécom-SudParis
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -46,7 +46,7 @@ double task_11_cost(struct starpu_task *task, unsigned nimpl)
 {
 	uint32_t n;
 
-	n = starpu_matrix_get_nx(task->buffers[0].handle);
+	n = starpu_matrix_get_nx(task->handles[0]);
 
 	double cost = ((n*n*n)/537.5);
 
@@ -57,7 +57,7 @@ double task_12_cost(struct starpu_task *task, unsigned nimpl)
 {
 	uint32_t n;
 
-	n = starpu_matrix_get_nx(task->buffers[0].handle);
+	n = starpu_matrix_get_nx(task->handles[0]);
 
 /*	double cost = ((n*n*n)/1744.695); */
 	double cost = ((n*n*n)/3210.80);
@@ -71,7 +71,7 @@ double task_21_cost(struct starpu_task *task, unsigned nimpl)
 {
 	uint32_t n;
 
-	n = starpu_matrix_get_nx(task->buffers[0].handle);
+	n = starpu_matrix_get_nx(task->handles[0]);
 
 /*	double cost = ((n*n*n)/1744.695); */
 	double cost = ((n*n*n)/3691.53);
@@ -86,9 +86,9 @@ double task_22_cost(struct starpu_task *task, unsigned nimpl)
 {
 	uint32_t nx, ny, nz;
 
-	nx = starpu_matrix_get_nx(task->buffers[2].handle);
-	ny = starpu_matrix_get_ny(task->buffers[2].handle);
-	nz = starpu_matrix_get_ny(task->buffers[0].handle);
+	nx = starpu_matrix_get_nx(task->handles[2]);
+	ny = starpu_matrix_get_ny(task->handles[2]);
+	nz = starpu_matrix_get_ny(task->handles[0]);
 
 	double cost = ((nx*ny*nz)/4110.0);
 
@@ -106,7 +106,7 @@ double task_11_cost_cuda(struct starpu_task *task, enum starpu_perf_archtype arc
 {
 	uint32_t n;
 
-	n = starpu_matrix_get_nx(task->buffers[0].handle);
+	n = starpu_matrix_get_nx(task->handles[0]);
 
 	double cost = ((n*n*n)/1853.7806);
 
@@ -118,7 +118,7 @@ double task_12_cost_cuda(struct starpu_task *task, enum starpu_perf_archtype arc
 {
 	uint32_t n;
 
-	n = starpu_matrix_get_nx(task->buffers[0].handle);
+	n = starpu_matrix_get_nx(task->handles[0]);
 
 	double cost = ((n*n*n)/42838.5718);
 
@@ -131,7 +131,7 @@ double task_21_cost_cuda(struct starpu_task *task, enum starpu_perf_archtype arc
 {
 	uint32_t n;
 
-	n = starpu_matrix_get_nx(task->buffers[0].handle);
+	n = starpu_matrix_get_nx(task->handles[0]);
 
 	double cost = ((n*n*n)/49208.667);
 
@@ -145,9 +145,9 @@ double task_22_cost_cuda(struct starpu_task *task, enum starpu_perf_archtype arc
 {
 	uint32_t nx, ny, nz;
 
-	nx = starpu_matrix_get_nx(task->buffers[2].handle);
-	ny = starpu_matrix_get_ny(task->buffers[2].handle);
-	nz = starpu_matrix_get_ny(task->buffers[0].handle);
+	nx = starpu_matrix_get_nx(task->handles[2]);
+	ny = starpu_matrix_get_ny(task->handles[2]);
+	nz = starpu_matrix_get_ny(task->handles[0]);
 
 	double cost = ((nx*ny*nz)/57523.560);
 
@@ -165,7 +165,7 @@ double task_11_cost_cpu(struct starpu_task *task, enum starpu_perf_archtype arch
 {
 	uint32_t n;
 
-	n = starpu_matrix_get_nx(task->buffers[0].handle);
+	n = starpu_matrix_get_nx(task->handles[0]);
 
 	double cost = ((n*n*n)/537.5);
 
@@ -177,7 +177,7 @@ double task_12_cost_cpu(struct starpu_task *task, enum starpu_perf_archtype arch
 {
 	uint32_t n;
 
-	n = starpu_matrix_get_nx(task->buffers[0].handle);
+	n = starpu_matrix_get_nx(task->handles[0]);
 
 	double cost = ((n*n*n)/6668.224);
 
@@ -190,7 +190,7 @@ double task_21_cost_cpu(struct starpu_task *task, enum starpu_perf_archtype arch
 {
 	uint32_t n;
 
-	n = starpu_matrix_get_nx(task->buffers[0].handle);
+	n = starpu_matrix_get_nx(task->handles[0]);
 
 	double cost = ((n*n*n)/6793.8423);
 
@@ -204,9 +204,9 @@ double task_22_cost_cpu(struct starpu_task *task, enum starpu_perf_archtype arch
 {
 	uint32_t nx, ny, nz;
 
-	nx = starpu_matrix_get_nx(task->buffers[2].handle);
-	ny = starpu_matrix_get_ny(task->buffers[2].handle);
-	nz = starpu_matrix_get_ny(task->buffers[0].handle);
+	nx = starpu_matrix_get_nx(task->handles[2]);
+	ny = starpu_matrix_get_ny(task->handles[2]);
+	nz = starpu_matrix_get_ny(task->handles[0]);
 
 	double cost = ((nx*ny*nz)/4203.0175);
 

+ 4 - 4
examples/incrementer/incrementer.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -71,7 +71,8 @@ int main(int argc, char **argv)
 #ifdef STARPU_USE_OPENCL
 		.opencl_funcs = {opencl_codelet, NULL},
 #endif
-		.nbuffers = 1
+		.nbuffers = 1,
+		.modes = {STARPU_RW}
 	};
 
 	struct timeval start;
@@ -88,8 +89,7 @@ int main(int argc, char **argv)
 
 		task->callback_func = NULL;
 
-		task->buffers[0].handle = float_array_handle;
-		task->buffers[0].mode = STARPU_RW;
+		task->handles[0] = float_array_handle;
 
 		int ret = starpu_task_submit(task);
 		if (STARPU_UNLIKELY(ret == -ENODEV))

+ 9 - 17
examples/lu/xlu.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -57,8 +57,7 @@ static struct starpu_task *create_task_11(starpu_data_handle_t dataA, unsigned k
 	task->cl = &cl11;
 
 	/* which sub-data is manipulated ? */
-	task->buffers[0].handle = starpu_data_get_sub_data(dataA, 2, k, k);
-	task->buffers[0].mode = STARPU_RW;
+	task->handles[0] = starpu_data_get_sub_data(dataA, 2, k, k);
 
 	/* this is an important task */
 	if (!no_prio)
@@ -82,10 +81,8 @@ static void create_task_12(starpu_data_handle_t dataA, unsigned k, unsigned j)
 	task->cl = &cl12;
 
 	/* which sub-data is manipulated ? */
-	task->buffers[0].handle = starpu_data_get_sub_data(dataA, 2, k, k); 
-	task->buffers[0].mode = STARPU_R;
-	task->buffers[1].handle = starpu_data_get_sub_data(dataA, 2, j, k); 
-	task->buffers[1].mode = STARPU_RW;
+	task->handles[0] = starpu_data_get_sub_data(dataA, 2, k, k); 
+	task->handles[1] = starpu_data_get_sub_data(dataA, 2, j, k); 
 
 	if (!no_prio && (j == k+1))
 	{
@@ -112,10 +109,8 @@ static void create_task_21(starpu_data_handle_t dataA, unsigned k, unsigned i)
 	task->cl = &cl21;
 	
 	/* which sub-data is manipulated ? */
-	task->buffers[0].handle = starpu_data_get_sub_data(dataA, 2, k, k); 
-	task->buffers[0].mode = STARPU_R;
-	task->buffers[1].handle = starpu_data_get_sub_data(dataA, 2, k, i); 
-	task->buffers[1].mode = STARPU_RW;
+	task->handles[0] = starpu_data_get_sub_data(dataA, 2, k, k); 
+	task->handles[1] = starpu_data_get_sub_data(dataA, 2, k, i); 
 
 	if (!no_prio && (i == k+1))
 	{
@@ -144,12 +139,9 @@ static void create_task_22(starpu_data_handle_t dataA, unsigned k, unsigned i, u
 	task->cl = &cl22;
 
 	/* which sub-data is manipulated ? */
-	task->buffers[0].handle = starpu_data_get_sub_data(dataA, 2, k, i); /* produced by TAG21(k, i) */ 
-	task->buffers[0].mode = STARPU_R;
-	task->buffers[1].handle = starpu_data_get_sub_data(dataA, 2, j, k); /* produced by TAG12(k, j) */
-	task->buffers[1].mode = STARPU_R;
-	task->buffers[2].handle = starpu_data_get_sub_data(dataA, 2, j, i); /* produced by TAG22(k-1, i, j) */
-	task->buffers[2].mode = STARPU_RW;
+	task->handles[0] = starpu_data_get_sub_data(dataA, 2, k, i); /* produced by TAG21(k, i) */ 
+	task->handles[1] = starpu_data_get_sub_data(dataA, 2, j, k); /* produced by TAG12(k, j) */
+	task->handles[2] = starpu_data_get_sub_data(dataA, 2, j, i); /* produced by TAG22(k-1, i, j) */
 
 	if (!no_prio &&  (i == k + 1) && (j == k +1) )
 	{

+ 9 - 17
examples/lu/xlu_implicit.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010-2011  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -27,8 +27,7 @@ static void create_task_11(starpu_data_handle_t dataA, unsigned k)
 	task->cl = &cl11;
 
 	/* which sub-data is manipulated ? */
-	task->buffers[0].handle = starpu_data_get_sub_data(dataA, 2, k, k);
-	task->buffers[0].mode = STARPU_RW;
+	task->handles[0] = starpu_data_get_sub_data(dataA, 2, k, k);
 
 	/* this is an important task */
 	if (!no_prio)
@@ -43,10 +42,8 @@ static void create_task_12(starpu_data_handle_t dataA, unsigned k, unsigned j)
 	task->cl = &cl12;
 
 	/* which sub-data is manipulated ? */
-	task->buffers[0].handle = starpu_data_get_sub_data(dataA, 2, k, k); 
-	task->buffers[0].mode = STARPU_R;
-	task->buffers[1].handle = starpu_data_get_sub_data(dataA, 2, j, k); 
-	task->buffers[1].mode = STARPU_RW;
+	task->handles[0] = starpu_data_get_sub_data(dataA, 2, k, k); 
+	task->handles[1] = starpu_data_get_sub_data(dataA, 2, j, k); 
 
 	if (!no_prio && (j == k+1))
 		task->priority = STARPU_MAX_PRIO;
@@ -61,10 +58,8 @@ static void create_task_21(starpu_data_handle_t dataA, unsigned k, unsigned i)
 	task->cl = &cl21;
 	
 	/* which sub-data is manipulated ? */
-	task->buffers[0].handle = starpu_data_get_sub_data(dataA, 2, k, k); 
-	task->buffers[0].mode = STARPU_R;
-	task->buffers[1].handle = starpu_data_get_sub_data(dataA, 2, k, i); 
-	task->buffers[1].mode = STARPU_RW;
+	task->handles[0] = starpu_data_get_sub_data(dataA, 2, k, k); 
+	task->handles[1] = starpu_data_get_sub_data(dataA, 2, k, i); 
 
 	if (!no_prio && (i == k+1))
 		task->priority = STARPU_MAX_PRIO;
@@ -79,12 +74,9 @@ static void create_task_22(starpu_data_handle_t dataA, unsigned k, unsigned i, u
 	task->cl = &cl22;
 
 	/* which sub-data is manipulated ? */
-	task->buffers[0].handle = starpu_data_get_sub_data(dataA, 2, k, i);
-	task->buffers[0].mode = STARPU_R;
-	task->buffers[1].handle = starpu_data_get_sub_data(dataA, 2, j, k);
-	task->buffers[1].mode = STARPU_R;
-	task->buffers[2].handle = starpu_data_get_sub_data(dataA, 2, j, i);
-	task->buffers[2].mode = STARPU_RW;
+	task->handles[0] = starpu_data_get_sub_data(dataA, 2, k, i);
+	task->handles[1] = starpu_data_get_sub_data(dataA, 2, j, k);
+	task->handles[2] = starpu_data_get_sub_data(dataA, 2, j, i);
 
 	if (!no_prio &&  (i == k + 1) && (j == k +1) )
 		task->priority = STARPU_MAX_PRIO;

+ 10 - 19
examples/lu/xlu_implicit_pivot.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010-2011  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -35,8 +35,7 @@ static void create_task_pivot(starpu_data_handle_t *dataAp, unsigned nblocks,
 	task->cl = &cl_pivot;
 
 	/* which sub-data is manipulated ? */
-	task->buffers[0].handle = get_block(dataAp, nblocks, k, i);
-	task->buffers[0].mode = STARPU_RW;
+	task->handles[0] = get_block(dataAp, nblocks, k, i);
 
 	task->cl_arg = &piv_description[k];
 
@@ -58,8 +57,7 @@ static void create_task_11_pivot(starpu_data_handle_t *dataAp, unsigned nblocks,
 	task->cl_arg = &piv_description[k];
 
 	/* which sub-data is manipulated ? */
-	task->buffers[0].handle = get_block(dataAp, nblocks, k, k);
-	task->buffers[0].mode = STARPU_RW;
+	task->handles[0] = get_block(dataAp, nblocks, k, k);
 
 	/* this is an important task */
 	if (!no_prio)
@@ -76,10 +74,8 @@ static void create_task_12(starpu_data_handle_t *dataAp, unsigned nblocks, unsig
 	task->cl = &cl12;
 
 	/* which sub-data is manipulated ? */
-	task->buffers[0].handle = get_block(dataAp, nblocks, k, k);
-	task->buffers[0].mode = STARPU_R;
-	task->buffers[1].handle = get_block(dataAp, nblocks, j, k);
-	task->buffers[1].mode = STARPU_RW;
+	task->handles[0] = get_block(dataAp, nblocks, k, k);
+	task->handles[1] = get_block(dataAp, nblocks, j, k);
 
 	if (!no_prio && (j == k+1))
 		task->priority = STARPU_MAX_PRIO;
@@ -95,10 +91,8 @@ static void create_task_21(starpu_data_handle_t *dataAp, unsigned nblocks, unsig
 	task->cl = &cl21;
 	
 	/* which sub-data is manipulated ? */
-	task->buffers[0].handle = get_block(dataAp, nblocks, k, k); 
-	task->buffers[0].mode = STARPU_R;
-	task->buffers[1].handle = get_block(dataAp, nblocks, k, i); 
-	task->buffers[1].mode = STARPU_RW;
+	task->handles[0] = get_block(dataAp, nblocks, k, k); 
+	task->handles[1] = get_block(dataAp, nblocks, k, i); 
 
 	if (!no_prio && (i == k+1))
 		task->priority = STARPU_MAX_PRIO;
@@ -114,12 +108,9 @@ static void create_task_22(starpu_data_handle_t *dataAp, unsigned nblocks, unsig
 	task->cl = &cl22;
 
 	/* which sub-data is manipulated ? */
-	task->buffers[0].handle = get_block(dataAp, nblocks, k, i);
-	task->buffers[0].mode = STARPU_R;
-	task->buffers[1].handle = get_block(dataAp, nblocks, j, k);
-	task->buffers[1].mode = STARPU_R;
-	task->buffers[2].handle = get_block(dataAp, nblocks, j, i);
-	task->buffers[2].mode = STARPU_RW;
+	task->handles[0] = get_block(dataAp, nblocks, k, i);
+	task->handles[1] = get_block(dataAp, nblocks, j, k);
+	task->handles[2] = get_block(dataAp, nblocks, j, i);
 
 	if (!no_prio &&  (i == k + 1) && (j == k +1) )
 		task->priority = STARPU_MAX_PRIO;

+ 7 - 1
examples/lu/xlu_kernels.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -114,6 +114,7 @@ struct starpu_codelet cl22 =
 	.cuda_funcs = {STARPU_LU(cublas_u22), NULL},
 #endif
 	.nbuffers = 3,
+	.modes = {STARPU_R, STARPU_R, STARPU_RW},
 	.model = &STARPU_LU(model_22)
 };
 
@@ -200,6 +201,7 @@ struct starpu_codelet cl12 =
 	.cuda_funcs = {STARPU_LU(cublas_u12), NULL},
 #endif
 	.nbuffers = 2,
+	.modes = {STARPU_R, STARPU_RW},
 	.model = &STARPU_LU(model_12)
 };
 
@@ -283,6 +285,7 @@ struct starpu_codelet cl21 =
 	.cuda_funcs = {STARPU_LU(cublas_u21), NULL},
 #endif
 	.nbuffers = 2,
+	.modes = {STARPU_R, STARPU_RW},
 	.model = &STARPU_LU(model_21)
 };
 
@@ -381,6 +384,7 @@ struct starpu_codelet cl11 =
 	.cuda_funcs = {STARPU_LU(cublas_u11), NULL},
 #endif
 	.nbuffers = 1,
+	.modes = {STARPU_RW},
 	.model = &STARPU_LU(model_11)
 };
 
@@ -520,6 +524,7 @@ struct starpu_codelet cl11_pivot =
 	.cuda_funcs = {STARPU_LU(cublas_u11_pivot), NULL},
 #endif
 	.nbuffers = 1,
+	.modes = {STARPU_RW},
 	.model = &STARPU_LU(model_11_pivot)
 };
 
@@ -608,5 +613,6 @@ struct starpu_codelet cl_pivot =
 	.cuda_funcs = {STARPU_LU(cublas_pivot), NULL},
 #endif
 	.nbuffers = 1,
+	.modes = {STARPU_RW},
 	.model = &STARPU_LU(model_pivot)
 };

+ 10 - 19
examples/lu/xlu_pivot.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -56,8 +56,7 @@ static void create_task_pivot(starpu_data_handle_t *dataAp, unsigned nblocks,
 	task->cl = &cl_pivot;
 
 	/* which sub-data is manipulated ? */
-	task->buffers[0].handle = get_block(dataAp, nblocks, k, i);
-	task->buffers[0].mode = STARPU_RW;
+	task->handles[0] = get_block(dataAp, nblocks, k, i);
 
 	task->cl_arg = &piv_description[k];
 
@@ -106,8 +105,7 @@ static struct starpu_task *create_task_11_pivot(starpu_data_handle_t *dataAp, un
 	task->cl_arg = &piv_description[k];
 
 	/* which sub-data is manipulated ? */
-	task->buffers[0].handle = get_block(dataAp, nblocks, k, k);
-	task->buffers[0].mode = STARPU_RW;
+	task->handles[0] = get_block(dataAp, nblocks, k, k);
 
 	/* this is an important task */
 	if (!no_prio)
@@ -134,10 +132,8 @@ static void create_task_12(starpu_data_handle_t *dataAp, unsigned nblocks, unsig
 	task->cl_arg = (void *)(task->tag_id);
 
 	/* which sub-data is manipulated ? */
-	task->buffers[0].handle = get_block(dataAp, nblocks, k, k);
-	task->buffers[0].mode = STARPU_R;
-	task->buffers[1].handle = get_block(dataAp, nblocks, j, k);
-	task->buffers[1].mode = STARPU_RW;
+	task->handles[0] = get_block(dataAp, nblocks, k, k);
+	task->handles[1] = get_block(dataAp, nblocks, j, k);
 
 	if (!no_prio && (j == k+1))
 	{
@@ -168,10 +164,8 @@ static void create_task_21(starpu_data_handle_t *dataAp, unsigned nblocks, unsig
 	task->cl = &cl21;
 	
 	/* which sub-data is manipulated ? */
-	task->buffers[0].handle = get_block(dataAp, nblocks, k, k); 
-	task->buffers[0].mode = STARPU_R;
-	task->buffers[1].handle = get_block(dataAp, nblocks, k, i); 
-	task->buffers[1].mode = STARPU_RW;
+	task->handles[0] = get_block(dataAp, nblocks, k, k); 
+	task->handles[1] = get_block(dataAp, nblocks, k, i); 
 
 	if (!no_prio && (i == k+1))
 	{
@@ -198,12 +192,9 @@ static void create_task_22(starpu_data_handle_t *dataAp, unsigned nblocks, unsig
 	task->cl_arg = (void *)(task->tag_id);
 
 	/* which sub-data is manipulated ? */
-	task->buffers[0].handle = get_block(dataAp, nblocks, k, i); /* produced by TAG21(k, i) */
-	task->buffers[0].mode = STARPU_R;
-	task->buffers[1].handle = get_block(dataAp, nblocks, j, k); /* produced by TAG12(k, j) */ 
-	task->buffers[1].mode = STARPU_R;
-	task->buffers[2].handle = get_block(dataAp, nblocks, j, i);  /* produced by TAG22(k-1, i, j) */
-	task->buffers[2].mode = STARPU_RW;
+	task->handles[0] = get_block(dataAp, nblocks, k, i); /* produced by TAG21(k, i) */
+	task->handles[1] = get_block(dataAp, nblocks, j, k); /* produced by TAG12(k, j) */ 
+	task->handles[2] = get_block(dataAp, nblocks, j, i);  /* produced by TAG22(k-1, i, j) */
 
 	if (!no_prio &&  (i == k + 1) && (j == k +1) )
 	{

+ 7 - 7
examples/matvecmult/matvecmult.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010, 2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -184,17 +184,17 @@ int main(int argc, char **argv)
         cl.opencl_funcs[0] = opencl_codelet;
 #endif
         cl.nbuffers = 3;
+	cl.modes[0] = STARPU_R;
+	cl.modes[1] = STARPU_R;
+	cl.modes[2] = STARPU_RW;
         cl.model = NULL;
 
         struct starpu_task *task = starpu_task_create();
         task->cl = &cl;
         task->callback_func = NULL;
-        task->buffers[0].handle = matrix_handle;
-        task->buffers[0].mode = STARPU_R;
-        task->buffers[1].handle = vector_handle;
-        task->buffers[1].mode = STARPU_R;
-        task->buffers[2].handle = mult_handle;
-        task->buffers[2].mode = STARPU_RW;
+        task->handles[0] = matrix_handle;
+        task->handles[1] = vector_handle;
+        task->handles[2] = mult_handle;
 
         submit = starpu_task_submit(task);
         if (STARPU_UNLIKELY(submit == -ENODEV))

+ 18 - 20
examples/mult/xgemm.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2009, 2010, 2011  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -48,7 +48,7 @@ static void check_output(void)
 {
 	/* compute C = C - AB */
 	CPU_GEMM("N", "N", ydim, xdim, zdim, (TYPE)-1.0f, A, ydim, B, zdim, (TYPE)1.0f, C, ydim);
-		
+
 	/* make sure C = 0 */
 	TYPE err;
 	err = CPU_ASUM(xdim*ydim, C, 1);
@@ -103,23 +103,23 @@ static void init_problem_data(void)
 
 static void partition_mult_data(void)
 {
-	starpu_matrix_data_register(&A_handle, 0, (uintptr_t)A, 
+	starpu_matrix_data_register(&A_handle, 0, (uintptr_t)A,
 		ydim, ydim, zdim, sizeof(TYPE));
-	starpu_matrix_data_register(&B_handle, 0, (uintptr_t)B, 
+	starpu_matrix_data_register(&B_handle, 0, (uintptr_t)B,
 		zdim, zdim, xdim, sizeof(TYPE));
-	starpu_matrix_data_register(&C_handle, 0, (uintptr_t)C, 
+	starpu_matrix_data_register(&C_handle, 0, (uintptr_t)C,
 		ydim, ydim, xdim, sizeof(TYPE));
 
 	struct starpu_data_filter vert;
 	memset(&vert, 0, sizeof(vert));
 	vert.filter_func = starpu_vertical_block_filter_func;
 	vert.nchildren = nslicesx;
-		
+
 	struct starpu_data_filter horiz;
 	memset(&horiz, 0, sizeof(horiz));
 	horiz.filter_func = starpu_block_filter_func;
 	horiz.nchildren = nslicesy;
-		
+
 	starpu_data_partition(B_handle, &vert);
 	starpu_data_partition(A_handle, &horiz);
 
@@ -153,7 +153,7 @@ static void mult_kernel_common(void *descr[], int type)
 		{
 			/* Parallel CPU task */
 			int rank = starpu_combined_worker_get_rank();
-		
+
 			int block_size = (nyC + worker_size - 1)/worker_size;
 			int new_nyC = STARPU_MIN(nyC, block_size*(rank+1)) - block_size*rank;
 
@@ -203,6 +203,7 @@ static struct starpu_codelet cl =
 	.cuda_funcs = {cublas_mult, NULL},
 #endif
 	.nbuffers = 3,
+	.modes = {STARPU_R, STARPU_R, STARPU_RW},
 	.model = &starpu_gemm_model
 };
 
@@ -284,20 +285,17 @@ int main(int argc, char **argv)
 	unsigned x, y, iter;
 	for (iter = 0; iter < niter; iter++)
 	{
-		for (x = 0; x < nslicesx; x++) 
+		for (x = 0; x < nslicesx; x++)
 		for (y = 0; y < nslicesy; y++)
 		{
 			struct starpu_task *task = starpu_task_create();
-	
+
 			task->cl = &cl;
-	
-			task->buffers[0].handle = starpu_data_get_sub_data(A_handle, 1, y);
-			task->buffers[0].mode = STARPU_R;
-			task->buffers[1].handle = starpu_data_get_sub_data(B_handle, 1, x);
-			task->buffers[1].mode = STARPU_R;
-			task->buffers[2].handle = starpu_data_get_sub_data(C_handle, 2, x, y);
-			task->buffers[2].mode = STARPU_RW;
-	
+
+			task->handles[0] = starpu_data_get_sub_data(A_handle, 1, y);
+			task->handles[1] = starpu_data_get_sub_data(B_handle, 1, x);
+			task->handles[2] = starpu_data_get_sub_data(C_handle, 2, x, y);
+
 			int ret = starpu_task_submit(task);
 			STARPU_ASSERT(!ret);
 		}
@@ -320,10 +318,10 @@ int main(int argc, char **argv)
 	starpu_data_unregister(A_handle);
 	starpu_data_unregister(B_handle);
 	starpu_data_unregister(C_handle);
-	
+
 	if (check)
 		check_output();
-	
+
 	starpu_helper_cublas_shutdown();
 	starpu_shutdown();
 

+ 17 - 22
examples/ppm_downscaler/yuv_downscaler.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010-2011  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -89,6 +89,7 @@ static struct starpu_codelet ds_codelet =
 	.where = STARPU_CPU,
 	.cpu_funcs = {ds_kernel_cpu, NULL},
 	.nbuffers = 2, /* input -> output */
+	.modes = {STARPU_R, STARPU_W},
 	.model = NULL
 };
 
@@ -212,15 +213,13 @@ int main(int argc, char **argv)
 		for (blocky = 0; blocky < nblocks_y; blocky++)
 		{
 			struct starpu_task *task = starpu_task_create();
-				task->cl = &ds_codelet;
+			task->cl = &ds_codelet;
 
-				/* input */
-				task->buffers[0].handle = starpu_data_get_sub_data(frame_y_handle[frame], 1, blocky);
-				task->buffers[0].mode = STARPU_R;
+			/* input */
+			task->handles[0] = starpu_data_get_sub_data(frame_y_handle[frame], 1, blocky);
 
-				/* output */
-				task->buffers[1].handle = starpu_data_get_sub_data(new_frame_y_handle[frame], 1, blocky);
-				task->buffers[1].mode = STARPU_W;
+			/* output */
+			task->handles[1] = starpu_data_get_sub_data(new_frame_y_handle[frame], 1, blocky);
 
 			starpu_task_submit(task);
 		}
@@ -229,15 +228,13 @@ int main(int argc, char **argv)
 		for (blocku = 0; blocku < nblocks_uv; blocku++)
 		{
 			struct starpu_task *task = starpu_task_create();
-				task->cl = &ds_codelet;
+			task->cl = &ds_codelet;
 
-				/* input */
-				task->buffers[0].handle = starpu_data_get_sub_data(frame_u_handle[frame], 1, blocku);
-				task->buffers[0].mode = STARPU_R;
+			/* input */
+			task->handles[0] = starpu_data_get_sub_data(frame_u_handle[frame], 1, blocku);
 
-				/* output */
-				task->buffers[1].handle = starpu_data_get_sub_data(new_frame_u_handle[frame], 1, blocku);
-				task->buffers[1].mode = STARPU_W;
+			/* output */
+			task->handles[1] = starpu_data_get_sub_data(new_frame_u_handle[frame], 1, blocku);
 
 			starpu_task_submit(task);
 		}
@@ -246,15 +243,13 @@ int main(int argc, char **argv)
 		for (blockv = 0; blockv < nblocks_uv; blockv++)
 		{
 			struct starpu_task *task = starpu_task_create();
-				task->cl = &ds_codelet;
+			task->cl = &ds_codelet;
 
-				/* input */
-				task->buffers[0].handle = starpu_data_get_sub_data(frame_v_handle[frame], 1, blockv);
-				task->buffers[0].mode = STARPU_R;
+			/* input */
+			task->handles[0] = starpu_data_get_sub_data(frame_v_handle[frame], 1, blockv);
 
-				/* output */
-				task->buffers[1].handle = starpu_data_get_sub_data(new_frame_v_handle[frame], 1, blockv);
-				task->buffers[1].mode = STARPU_W;
+			/* output */
+			task->handles[1] = starpu_data_get_sub_data(new_frame_v_handle[frame], 1, blockv);
 
 			starpu_task_submit(task);
 		}

+ 5 - 7
examples/reductions/dot_product.c

@@ -171,7 +171,8 @@ static struct starpu_codelet dot_codelet =
 #ifdef STARPU_USE_CUDA
 	.cuda_funcs = {dot_cuda_func, NULL},
 #endif
-	.nbuffers = 3
+	.nbuffers = 3,
+	.modes = {STARPU_R, STARPU_R, STARPU_REDUX}
 };
 
 /*
@@ -231,12 +232,9 @@ int main(int argc, char **argv)
 		task->cl = &dot_codelet;
 		task->destroy = 1;
 
-		task->buffers[0].handle = x_handles[block];
-		task->buffers[0].mode = STARPU_R;
-		task->buffers[1].handle = y_handles[block];
-		task->buffers[1].mode = STARPU_R;
-		task->buffers[2].handle = dot_handle;
-		task->buffers[2].mode = STARPU_REDUX;
+		task->handles[0] = x_handles[block];
+		task->handles[1] = y_handles[block];
+		task->handles[2] = dot_handle;
 
 		int ret = starpu_task_submit(task);
 		if (ret == -ENODEV) goto enodev;

+ 4 - 5
examples/reductions/minmax_reduction.c

@@ -116,7 +116,8 @@ static struct starpu_codelet minmax_codelet =
 {
 	.where = STARPU_CPU,
 	.cpu_funcs = {minmax_cpu_func, NULL},
-	.nbuffers = 2
+	.nbuffers = 2,
+	.modes = {STARPU_R, STARPU_REDUX}
 };
 
 /*
@@ -167,10 +168,8 @@ int main(int argc, char **argv)
 
 		task->cl = &minmax_codelet;
 
-		task->buffers[0].handle = x_handles[block];
-		task->buffers[0].mode = STARPU_R;
-		task->buffers[1].handle = minmax_handle;
-		task->buffers[1].mode = STARPU_REDUX;
+		task->handles[0] = x_handles[block];
+		task->handles[1] = minmax_handle;
 
 		int ret = starpu_task_submit(task);
 		if (ret)

+ 5 - 7
examples/spmv/spmv.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2009, 2010, 2011  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -104,6 +104,7 @@ static struct starpu_codelet spmv_cl =
         .opencl_funcs = {spmv_kernel_opencl, NULL},
 #endif
 	.nbuffers = 3,
+	.modes = {STARPU_R, STARPU_R, STARPU_W},
 	.model = NULL
 };
 
@@ -217,12 +218,9 @@ int main(int argc, char **argv)
 		struct starpu_task *task = starpu_task_create();
 		task->cl = &spmv_cl;
 	
-		task->buffers[0].handle = starpu_data_get_sub_data(sparse_matrix, 1, part);
-		task->buffers[0].mode  = STARPU_R;
-		task->buffers[1].handle = vector_in;
-		task->buffers[1].mode = STARPU_R;
-		task->buffers[2].handle = starpu_data_get_sub_data(vector_out, 1, part);
-		task->buffers[2].mode = STARPU_W;
+		task->handles[0] = starpu_data_get_sub_data(sparse_matrix, 1, part);
+		task->handles[1] = vector_in;
+		task->handles[2] = starpu_data_get_sub_data(vector_out, 1, part);
 	
 		ret = starpu_task_submit(task);
 		if (STARPU_UNLIKELY(ret == -ENODEV))

+ 3 - 3
examples/starpufft/starpufftx.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -191,7 +191,7 @@ STARPUFFT(start)(STARPUFFT(plan) plan, void *_in, void *_out)
 				if (PARALLEL)
 				{
 					for (z = 0; z < plan->totsize1; z++)
-						plan->twist1_tasks[z]->buffers[0].handle = plan->in_handle;
+						plan->twist1_tasks[z]->handles[0] = plan->in_handle;
 				}
 				task = STARPUFFT(start1dC2C)(plan, plan->in_handle, plan->out_handle);
 				break;
@@ -208,7 +208,7 @@ STARPUFFT(start)(STARPUFFT(plan) plan, void *_in, void *_out)
 			if (PARALLEL)
 			{
 				for (z = 0; z < plan->totsize1; z++)
-					plan->twist1_tasks[z]->buffers[0].handle = plan->in_handle;
+					plan->twist1_tasks[z]->handles[0] = plan->in_handle;
 			}
 			task = STARPUFFT(start2dC2C)(plan, plan->in_handle, plan->out_handle);
 			break;

+ 24 - 29
examples/starpufft/starpufftx1d.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -330,7 +330,8 @@ static struct starpu_codelet STARPUFFT(twist1_1d_codelet) = {
 #endif
 	.cpu_funcs = {STARPUFFT(twist1_1d_kernel_cpu), NULL},
 	.model = &STARPUFFT(twist1_1d_model),
-	.nbuffers = 2
+	.nbuffers = 2,
+	.modes = {STARPU_R, STARPU_W}
 };
 
 static struct starpu_codelet STARPUFFT(fft1_1d_codelet) = {
@@ -349,14 +350,16 @@ static struct starpu_codelet STARPUFFT(fft1_1d_codelet) = {
 	.cpu_funcs = {STARPUFFT(fft1_1d_kernel_cpu), NULL},
 #endif
 	.model = &STARPUFFT(fft1_1d_model),
-	.nbuffers = 3
+	.nbuffers = 3,
+	.modes = {STARPU_R, STARPU_W, STARPU_R}
 };
 
 static struct starpu_codelet STARPUFFT(twist2_1d_codelet) = {
 	.where = STARPU_CPU,
 	.cpu_funcs = {STARPUFFT(twist2_1d_kernel_cpu), NULL},
 	.model = &STARPUFFT(twist2_1d_model),
-	.nbuffers = 1
+	.nbuffers = 1,
+	.modes = {STARPU_W}
 };
 
 static struct starpu_codelet STARPUFFT(fft2_1d_codelet) = {
@@ -375,14 +378,16 @@ static struct starpu_codelet STARPUFFT(fft2_1d_codelet) = {
 	.cpu_funcs = {STARPUFFT(fft2_1d_kernel_cpu), NULL},
 #endif
 	.model = &STARPUFFT(fft2_1d_model),
-	.nbuffers = 2
+	.nbuffers = 2,
+	.modes = {STARPU_R, STARPU_W}
 };
 
 static struct starpu_codelet STARPUFFT(twist3_1d_codelet) = {
 	.where = STARPU_CPU,
 	.cpu_funcs = {STARPUFFT(twist3_1d_kernel_cpu), NULL},
 	.model = &STARPUFFT(twist3_1d_model),
-	.nbuffers = 1
+	.nbuffers = 1,
+	.modes = {STARPU_R}
 };
 
 /*
@@ -465,7 +470,8 @@ static struct starpu_codelet STARPUFFT(fft_1d_codelet) = {
 	.cpu_funcs = {STARPUFFT(fft_1d_kernel_cpu), NULL},
 #endif
 	.model = &STARPUFFT(fft_1d_model),
-	.nbuffers = 2
+	.nbuffers = 2,
+	.modes = {STARPU_R, STARPU_W}
 };
 
 /* Planning:
@@ -643,11 +649,9 @@ if (PARALLEL) {
 		/* Create twist1 task */
 		plan->twist1_tasks[z] = task = starpu_task_create();
 		task->cl = &STARPUFFT(twist1_1d_codelet);
-		/* task->buffers[0].handle = to be filled at execution to point
+		/* task->handles[0] = to be filled at execution to point
 		   to the application input. */
-		task->buffers[0].mode = STARPU_R;
-		task->buffers[1].handle = plan->twisted1_handle[z];
-		task->buffers[1].mode = STARPU_W;
+		task->handles[1] = plan->twisted1_handle[z];
 		task->cl_arg = &plan->fft1_args[z];
 		task->tag_id = STEP_TAG(TWIST1);
 		task->use_tag = 1;
@@ -660,12 +664,9 @@ if (PARALLEL) {
 		/* Create FFT1 task */
 		plan->fft1_tasks[z] = task = starpu_task_create();
 		task->cl = &STARPUFFT(fft1_1d_codelet);
-		task->buffers[0].handle = plan->twisted1_handle[z];
-		task->buffers[0].mode = STARPU_R;
-		task->buffers[1].handle = plan->fft1_handle[z];
-		task->buffers[1].mode = STARPU_W;
-		task->buffers[2].handle = plan->roots_handle[0];
-		task->buffers[2].mode = STARPU_R;
+		task->handles[0] = plan->twisted1_handle[z];
+		task->handles[1] = plan->fft1_handle[z];
+		task->handles[2] = plan->roots_handle[0];
 		task->cl_arg = &plan->fft1_args[z];
 		task->tag_id = STEP_TAG(FFT1);
 		task->use_tag = 1;
@@ -710,8 +711,7 @@ if (PARALLEL) {
 		/* Create twist2 task */
 		plan->twist2_tasks[z] = task = starpu_task_create();
 		task->cl = &STARPUFFT(twist2_1d_codelet);
-		task->buffers[0].handle = plan->twisted2_handle[z];
-		task->buffers[0].mode = STARPU_W;
+		task->handles[0] = plan->twisted2_handle[z];
 		task->cl_arg = &plan->fft2_args[z];
 		task->tag_id = STEP_TAG(TWIST2);
 		task->use_tag = 1;
@@ -724,10 +724,8 @@ if (PARALLEL) {
 		/* Create FFT2 task */
 		plan->fft2_tasks[z] = task = starpu_task_create();
 		task->cl = &STARPUFFT(fft2_1d_codelet);
-		task->buffers[0].handle = plan->twisted2_handle[z];
-		task->buffers[0].mode = STARPU_R;
-		task->buffers[1].handle = plan->fft2_handle[z];
-		task->buffers[1].mode = STARPU_W;
+		task->handles[0] = plan->twisted2_handle[z];
+		task->handles[1] = plan->fft2_handle[z];
 		task->cl_arg = &plan->fft2_args[z];
 		task->tag_id = STEP_TAG(FFT2);
 		task->use_tag = 1;
@@ -742,8 +740,7 @@ if (PARALLEL) {
 		 * application output buffer. */
 		plan->twist3_tasks[z] = task = starpu_task_create();
 		task->cl = &STARPUFFT(twist3_1d_codelet);
-		task->buffers[0].handle = plan->fft2_handle[z];
-		task->buffers[0].mode = STARPU_R;
+		task->handles[0] = plan->fft2_handle[z];
 		task->cl_arg = &plan->fft2_args[z];
 		task->tag_id = STEP_TAG(TWIST3);
 		task->use_tag = 1;
@@ -798,10 +795,8 @@ if (PARALLEL) {
 	/* Create FFT task */
 	task = starpu_task_create();
 	task->cl = &STARPUFFT(fft_1d_codelet);
-	task->buffers[0].handle = in;
-	task->buffers[0].mode = STARPU_R;
-	task->buffers[1].handle = out;
-	task->buffers[1].mode = STARPU_W;
+	task->handles[0] = in;
+	task->handles[1] = out;
 	task->cl_arg = plan;
 
 	starpu_task_submit(task);

+ 25 - 31
examples/starpufft/starpufftx2d.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 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
@@ -315,7 +315,8 @@ static struct starpu_codelet STARPUFFT(twist1_2d_codelet) = {
 #endif
 	.cpu_funcs = {STARPUFFT(twist1_2d_kernel_cpu), NULL},
 	.model = &STARPUFFT(twist1_2d_model),
-	.nbuffers = 2
+	.nbuffers = 2,
+	.modes = {STARPU_R, STARPU_W}
 };
 
 static struct starpu_codelet STARPUFFT(fft1_2d_codelet) = {
@@ -334,14 +335,16 @@ static struct starpu_codelet STARPUFFT(fft1_2d_codelet) = {
 	.cpu_funcs = {STARPUFFT(fft1_2d_kernel_cpu), NULL},
 #endif
 	.model = &STARPUFFT(fft1_2d_model),
-	.nbuffers = 4
+	.nbuffers = 4,
+	.modes = {STARPU_R, STARPU_W, STARPU_R, STARPU_R}
 };
 
 static struct starpu_codelet STARPUFFT(twist2_2d_codelet) = {
 	.where = STARPU_CPU,
 	.cpu_funcs = {STARPUFFT(twist2_2d_kernel_cpu), NULL},
 	.model = &STARPUFFT(twist2_2d_model),
-	.nbuffers = 1
+	.nbuffers = 1,
+	.modes = {STARPU_W}
 };
 
 static struct starpu_codelet STARPUFFT(fft2_2d_codelet) = {
@@ -360,14 +363,16 @@ static struct starpu_codelet STARPUFFT(fft2_2d_codelet) = {
 	.cpu_funcs = {STARPUFFT(fft2_2d_kernel_cpu), NULL},
 #endif
 	.model = &STARPUFFT(fft2_2d_model),
-	.nbuffers = 2
+	.nbuffers = 2,
+	.modes = {STARPU_R, STARPU_W}
 };
 
 static struct starpu_codelet STARPUFFT(twist3_2d_codelet) = {
 	.where = STARPU_CPU,
 	.cpu_funcs = {STARPUFFT(twist3_2d_kernel_cpu), NULL},
 	.model = &STARPUFFT(twist3_2d_model),
-	.nbuffers = 1
+	.nbuffers = 1,
+	.modes = {STARPU_R}
 };
 
 /*
@@ -451,7 +456,8 @@ static struct starpu_codelet STARPUFFT(fft_2d_codelet) = {
 	.cpu_funcs = {STARPUFFT(fft_2d_kernel_cpu), NULL},
 #endif
 	.model = &STARPUFFT(fft_2d_model),
-	.nbuffers = 2
+	.nbuffers = 2,
+	.modes = {STARPU_R, STARPU_W}
 };
 
 STARPUFFT(plan)
@@ -643,10 +649,8 @@ if (PARALLEL) {
 		/* Create twist1 task */
 		plan->twist1_tasks[z] = task = starpu_task_create();
 		task->cl = &STARPUFFT(twist1_2d_codelet);
-		/* task->buffers[0].handle = to be filled at execution */
-		task->buffers[0].mode = STARPU_R;
-		task->buffers[1].handle = plan->twisted1_handle[z];
-		task->buffers[1].mode = STARPU_W;
+		/* task->handles[0] = to be filled at execution */
+		task->handles[1] = plan->twisted1_handle[z];
 		task->cl_arg = &plan->fft1_args[z];
 		task->tag_id = STEP_TAG(TWIST1);
 		task->use_tag = 1;
@@ -659,14 +663,10 @@ if (PARALLEL) {
 		/* Create FFT1 task */
 		plan->fft1_tasks[z] = task = starpu_task_create();
 		task->cl = &STARPUFFT(fft1_2d_codelet);
-		task->buffers[0].handle = plan->twisted1_handle[z];
-		task->buffers[0].mode = STARPU_R;
-		task->buffers[1].handle = plan->fft1_handle[z];
-		task->buffers[1].mode = STARPU_W;
-		task->buffers[2].handle = plan->roots_handle[0];
-		task->buffers[2].mode = STARPU_R;
-		task->buffers[3].handle = plan->roots_handle[1];
-		task->buffers[3].mode = STARPU_R;
+		task->handles[0] = plan->twisted1_handle[z];
+		task->handles[1] = plan->fft1_handle[z];
+		task->handles[2] = plan->roots_handle[0];
+		task->handles[3] = plan->roots_handle[1];
 		task->cl_arg = &plan->fft1_args[z];
 		task->tag_id = STEP_TAG(FFT1);
 		task->use_tag = 1;
@@ -710,8 +710,7 @@ if (PARALLEL) {
 		/* Create twist2 task */
 		plan->twist2_tasks[z] = task = starpu_task_create();
 		task->cl = &STARPUFFT(twist2_2d_codelet);
-		task->buffers[0].handle = plan->twisted2_handle[z];
-		task->buffers[0].mode = STARPU_W;
+		task->handles[0] = plan->twisted2_handle[z];
 		task->cl_arg = &plan->fft2_args[z];
 		task->tag_id = STEP_TAG(TWIST2);
 		task->use_tag = 1;
@@ -724,10 +723,8 @@ if (PARALLEL) {
 		/* Create FFT2 task */
 		plan->fft2_tasks[z] = task = starpu_task_create();
 		task->cl = &STARPUFFT(fft2_2d_codelet);
-		task->buffers[0].handle = plan->twisted2_handle[z];
-		task->buffers[0].mode = STARPU_R;
-		task->buffers[1].handle = plan->fft2_handle[z];
-		task->buffers[1].mode = STARPU_W;
+		task->handles[0] = plan->twisted2_handle[z];
+		task->handles[1] = plan->fft2_handle[z];
 		task->cl_arg = &plan->fft2_args[z];
 		task->tag_id = STEP_TAG(FFT2);
 		task->use_tag = 1;
@@ -742,8 +739,7 @@ if (PARALLEL) {
 		 * application output buffer. */
 		plan->twist3_tasks[z] = task = starpu_task_create();
 		task->cl = &STARPUFFT(twist3_2d_codelet);
-		task->buffers[0].handle = plan->fft2_handle[z];
-		task->buffers[0].mode = STARPU_R;
+		task->handles[0] = plan->fft2_handle[z];
 		task->cl_arg = &plan->fft2_args[z];
 		task->tag_id = STEP_TAG(TWIST3);
 		task->use_tag = 1;
@@ -797,10 +793,8 @@ if (PARALLEL) {
 	/* Create FFT task */
 	task = starpu_task_create();
 	task->cl = &STARPUFFT(fft_2d_codelet);
-	task->buffers[0].handle = in;
-	task->buffers[0].mode = STARPU_R;
-	task->buffers[1].handle = out;
-	task->buffers[1].mode = STARPU_W;
+	task->handles[0] = in;
+	task->handles[1] = out;
 	task->cl_arg = plan;
 
 	starpu_task_submit(task);

+ 8 - 3
examples/stencil/stencil-kernels.c

@@ -1,6 +1,8 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2011  Université de Bordeaux 1
+ * Copyright (C) 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
  * the Free Software Foundation; either version 2.1 of the License, or (at
@@ -468,7 +470,8 @@ struct starpu_codelet cl_update =
 	.opencl_funcs = {update_func_opencl, NULL},
 #endif
 	.model = &cl_update_model,
-	.nbuffers = 6
+	.nbuffers = 6,
+	.modes = {STARPU_RW, STARPU_RW, STARPU_R, STARPU_R, STARPU_R, STARPU_R}
 };
 
 /*
@@ -671,7 +674,8 @@ struct starpu_codelet save_cl_bottom =
 	.opencl_funcs = {dummy_func_bottom_opencl, NULL},
 #endif
 	.model = &save_cl_bottom_model,
-	.nbuffers = 4
+	.nbuffers = 4,
+	.modes = {STARPU_R, STARPU_R, STARPU_W, STARPU_W}
 };
 
 struct starpu_codelet save_cl_top =
@@ -692,5 +696,6 @@ struct starpu_codelet save_cl_top =
 	.opencl_funcs = {dummy_func_top_opencl, NULL},
 #endif
 	.model = &save_cl_top_model,
-	.nbuffers = 4
+	.nbuffers = 4,
+	.modes = {STARPU_R, STARPU_R, STARPU_W, STARPU_W}
 };

+ 13 - 22
examples/stencil/stencil-tasks.c

@@ -1,6 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010  Université de Bordeaux 1
+ * Copyright (C) 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
@@ -48,17 +49,13 @@ static void create_task_save_local(unsigned iter, unsigned z, int dir, unsigned
 	save_task->cl_arg = descr;
 
 	/* Saving our border... */
-	save_task->buffers[0].handle = descr->layers_handle[0];
-	save_task->buffers[0].mode = STARPU_R;
-	save_task->buffers[1].handle = descr->layers_handle[1];
-	save_task->buffers[1].mode = STARPU_R;
+	save_task->handles[0] = descr->layers_handle[0];
+	save_task->handles[1] = descr->layers_handle[1];
 
 	/* ... to the neighbour's copy */
 	struct block_description *neighbour = descr->boundary_blocks[(1+dir)/2];
-	save_task->buffers[2].handle = neighbour->boundaries_handle[(1-dir)/2][0];
-	save_task->buffers[2].mode = STARPU_W;
-	save_task->buffers[3].handle = neighbour->boundaries_handle[(1-dir)/2][1];
-	save_task->buffers[3].mode = STARPU_W;
+	save_task->handles[2] = neighbour->boundaries_handle[(1-dir)/2][0];
+	save_task->handles[3] = neighbour->boundaries_handle[(1-dir)/2][1];
 
 	/* Bind */
 	if (iter <= BIND_LAST)
@@ -191,20 +188,14 @@ void create_task_update(unsigned iter, unsigned z, unsigned local_rank)
 	unsigned new_layer = (old_layer + 1) % 2;
 
 	struct block_description *descr = get_block_description(z);
-	task->buffers[0].handle = descr->layers_handle[new_layer];
-	task->buffers[0].mode = STARPU_RW;
-	task->buffers[1].handle = descr->layers_handle[old_layer];
-	task->buffers[1].mode = STARPU_RW;
-
-	task->buffers[2].handle = descr->boundaries_handle[T][new_layer];
-	task->buffers[2].mode = STARPU_R;
-	task->buffers[3].handle = descr->boundaries_handle[T][old_layer];
-	task->buffers[3].mode = STARPU_R;
-
-	task->buffers[4].handle = descr->boundaries_handle[B][new_layer];
-	task->buffers[4].mode = STARPU_R;
-	task->buffers[5].handle = descr->boundaries_handle[B][old_layer];
-	task->buffers[5].mode = STARPU_R;
+	task->handles[0] = descr->layers_handle[new_layer];
+	task->handles[1] = descr->layers_handle[old_layer];
+
+	task->handles[2] = descr->boundaries_handle[T][new_layer];
+	task->handles[3] = descr->boundaries_handle[T][old_layer];
+
+	task->handles[4] = descr->boundaries_handle[B][new_layer];
+	task->handles[5] = descr->boundaries_handle[B][old_layer];
 
 	task->cl = &cl_update;
 	task->cl_arg = descr;