Browse Source

examples: avoid shadowed declarations

Nathalie Furmento 12 years ago
parent
commit
9063cf5133

+ 29 - 29
examples/axpy/axpy.c

@@ -2,7 +2,7 @@
  *
  *
  * Copyright (C) 2009-2012  Université de Bordeaux 1
  * Copyright (C) 2009-2012  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  *
  * StarPU is free software; you can redistribute it and/or modify
  * 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
  * it under the terms of the GNU Lesser General Public License as published by
@@ -42,11 +42,11 @@
 
 
 #define EPSILON 1e-6
 #define EPSILON 1e-6
 
 
-TYPE *vec_x, *vec_y;
-TYPE alpha = 3.41;
+TYPE *_vec_x, *_vec_y;
+TYPE _alpha = 3.41;
 
 
 /* descriptors for StarPU */
 /* descriptors for StarPU */
-starpu_data_handle_t handle_y, handle_x;
+starpu_data_handle_t _handle_y, _handle_x;
 
 
 void axpy_cpu(void *descr[], __attribute__((unused)) void *arg)
 void axpy_cpu(void *descr[], __attribute__((unused)) void *arg)
 {
 {
@@ -98,9 +98,9 @@ check(void)
 	int i;
 	int i;
 	for (i = 0; i < N; i++)
 	for (i = 0; i < N; i++)
 	{
 	{
-		TYPE expected_value = alpha * vec_x[i] + 4.0;
-		if (fabs(vec_y[i] - expected_value) > expected_value * EPSILON) {
-			FPRINTF(stderr,"at %d, %f*%f+%f=%f, expected %f\n", i, alpha, vec_x[i], 4.0, vec_y[i], expected_value);
+		TYPE expected_value = _alpha * _vec_x[i] + 4.0;
+		if (fabs(_vec_y[i] - expected_value) > expected_value * EPSILON) {
+			FPRINTF(stderr,"at %d, %f*%f+%f=%f, expected %f\n", i, _alpha, _vec_x[i], 4.0, _vec_y[i], expected_value);
 			return EXIT_FAILURE;
 			return EXIT_FAILURE;
 		}
 		}
 	}
 	}
@@ -134,25 +134,25 @@ int main(int argc, char **argv)
 		vec_a = malloc(N*sizeof(TYPE));
 		vec_a = malloc(N*sizeof(TYPE));
 		vec_b = malloc(N*sizeof(TYPE));
 		vec_b = malloc(N*sizeof(TYPE));
 	*/
 	*/
-	starpu_malloc((void **)&vec_x, N*sizeof(TYPE));
-	assert(vec_x);
+	starpu_malloc((void **)&_vec_x, N*sizeof(TYPE));
+	assert(_vec_x);
 
 
-	starpu_malloc((void **)&vec_y, N*sizeof(TYPE));
-	assert(vec_y);
+	starpu_malloc((void **)&_vec_y, N*sizeof(TYPE));
+	assert(_vec_y);
 
 
 	unsigned i;
 	unsigned i;
 	for (i = 0; i < N; i++)
 	for (i = 0; i < N; i++)
 	{
 	{
-		vec_x[i] = 1.0f; /*(TYPE)starpu_drand48(); */
-		vec_y[i] = 4.0f; /*(TYPE)starpu_drand48(); */
+		_vec_x[i] = 1.0f; /*(TYPE)starpu_drand48(); */
+		_vec_y[i] = 4.0f; /*(TYPE)starpu_drand48(); */
 	}
 	}
 
 
-	FPRINTF(stderr, "BEFORE x[0] = %2.2f\n", vec_x[0]);
-	FPRINTF(stderr, "BEFORE y[0] = %2.2f\n", vec_y[0]);
+	FPRINTF(stderr, "BEFORE x[0] = %2.2f\n", _vec_x[0]);
+	FPRINTF(stderr, "BEFORE y[0] = %2.2f\n", _vec_y[0]);
 
 
 	/* Declare the data to StarPU */
 	/* Declare the data to StarPU */
-	starpu_vector_data_register(&handle_x, 0, (uintptr_t)vec_x, N, sizeof(TYPE));
-	starpu_vector_data_register(&handle_y, 0, (uintptr_t)vec_y, N, sizeof(TYPE));
+	starpu_vector_data_register(&_handle_x, 0, (uintptr_t)_vec_x, N, sizeof(TYPE));
+	starpu_vector_data_register(&_handle_y, 0, (uintptr_t)_vec_y, N, sizeof(TYPE));
 
 
 	/* Divide the vector into blocks */
 	/* Divide the vector into blocks */
 	struct starpu_data_filter block_filter =
 	struct starpu_data_filter block_filter =
@@ -161,8 +161,8 @@ int main(int argc, char **argv)
 		.nchildren = NBLOCKS
 		.nchildren = NBLOCKS
 	};
 	};
 
 
-	starpu_data_partition(handle_x, &block_filter);
-	starpu_data_partition(handle_y, &block_filter);
+	starpu_data_partition(_handle_x, &block_filter);
+	starpu_data_partition(_handle_y, &block_filter);
 
 
 	struct timeval start;
 	struct timeval start;
 	struct timeval end;
 	struct timeval end;
@@ -176,10 +176,10 @@ int main(int argc, char **argv)
 
 
 		task->cl = &axpy_cl;
 		task->cl = &axpy_cl;
 
 
-		task->cl_arg = &alpha;
+		task->cl_arg = &_alpha;
 
 
-		task->handles[0] = starpu_data_get_sub_data(handle_x, 1, b);
-		task->handles[1] = starpu_data_get_sub_data(handle_y, 1, b);
+		task->handles[0] = starpu_data_get_sub_data(_handle_x, 1, b);
+		task->handles[1] = starpu_data_get_sub_data(_handle_y, 1, b);
 
 
 		ret = starpu_task_submit(task);
 		ret = starpu_task_submit(task);
 		if (ret == -ENODEV)
 		if (ret == -ENODEV)
@@ -193,10 +193,10 @@ int main(int argc, char **argv)
 	starpu_task_wait_for_all();
 	starpu_task_wait_for_all();
 
 
 enodev:
 enodev:
-	starpu_data_unpartition(handle_x, 0);
-	starpu_data_unpartition(handle_y, 0);
-	starpu_data_unregister(handle_x);
-	starpu_data_unregister(handle_y);
+	starpu_data_unpartition(_handle_x, 0);
+	starpu_data_unpartition(_handle_y, 0);
+	starpu_data_unregister(_handle_x);
+	starpu_data_unregister(_handle_y);
 
 
 	gettimeofday(&end, NULL);
 	gettimeofday(&end, NULL);
         double timing = (double)((end.tv_sec - start.tv_sec)*1000000 +
         double timing = (double)((end.tv_sec - start.tv_sec)*1000000 +
@@ -204,13 +204,13 @@ enodev:
 
 
 	FPRINTF(stderr, "timing -> %2.2f us %2.2f MB/s\n", timing, 3*N*sizeof(TYPE)/timing);
 	FPRINTF(stderr, "timing -> %2.2f us %2.2f MB/s\n", timing, 3*N*sizeof(TYPE)/timing);
 
 
-	FPRINTF(stderr, "AFTER y[0] = %2.2f (ALPHA = %2.2f)\n", vec_y[0], alpha);
+	FPRINTF(stderr, "AFTER y[0] = %2.2f (ALPHA = %2.2f)\n", _vec_y[0], _alpha);
 
 
 	if (exit_value != 77)
 	if (exit_value != 77)
 		exit_value = check();
 		exit_value = check();
 
 
-	starpu_free((void *)vec_x);
-	starpu_free((void *)vec_y);
+	starpu_free((void *)_vec_x);
+	starpu_free((void *)_vec_y);
 
 
 #ifdef STARPU_USE_OPENCL
 #ifdef STARPU_USE_OPENCL
         ret = starpu_opencl_unload_opencl(&opencl_program);
         ret = starpu_opencl_unload_opencl(&opencl_program);

+ 8 - 8
examples/basic_examples/block_opencl.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  *
  * Copyright (C) 2010, 2011  Université de Bordeaux 1
  * Copyright (C) 2010, 2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  *
  * StarPU is free software; you can redistribute it and/or modify
  * 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
  * it under the terms of the GNU Lesser General Public License as published by
@@ -17,13 +17,13 @@
 
 
 #include <starpu.h>
 #include <starpu.h>
 
 
-#define CHECK_CL_SET_KERNEL_ARG(kernel, n, size, ptr)       \
-do						    	    \
-{							    \
-	int err;                                            \
-	err = clSetKernelArg(kernel, n, size, ptr);         \
-	if (err != CL_SUCCESS)                              \
-       		STARPU_OPENCL_REPORT_ERROR(err);            \
+#define CHECK_CL_SET_KERNEL_ARG(kernel, n, size, ptr)       	\
+do						    		\
+{								\
+	int check_err;                                          \
+	check_err = clSetKernelArg(kernel, n, size, ptr);       \
+	if (check_err != CL_SUCCESS)                            \
+       		STARPU_OPENCL_REPORT_ERROR(check_err);          \
 } while (0)
 } while (0)
 
 
 extern struct starpu_opencl_program opencl_code;
 extern struct starpu_opencl_program opencl_code;

+ 2 - 2
examples/filters/custom_mf/conversion_opencl.c

@@ -18,7 +18,7 @@
 #include "custom_types.h"
 #include "custom_types.h"
 #include "custom_interface.h"
 #include "custom_interface.h"
 
 
-extern struct starpu_opencl_program opencl_conversion_program;
+extern struct starpu_opencl_program _opencl_conversion_program;
 
 
 void cpu_to_opencl_opencl_func(void *buffers[], void *args)
 void cpu_to_opencl_opencl_func(void *buffers[], void *args)
 {
 {
@@ -39,7 +39,7 @@ void cpu_to_opencl_opencl_func(void *buffers[], void *args)
 
 
 	err = starpu_opencl_load_kernel(&kernel,
 	err = starpu_opencl_load_kernel(&kernel,
 					&queue,
 					&queue,
-					&opencl_conversion_program,
+					&_opencl_conversion_program,
 					"custom_opencl_conversion",
 					"custom_opencl_conversion",
 					devid);
 					devid);
 	if (err != CL_SUCCESS)
 	if (err != CL_SUCCESS)

+ 30 - 30
examples/filters/custom_mf/custom_mf_filter.c

@@ -22,16 +22,16 @@
 #define DEBUG 1
 #define DEBUG 1
 
 
 #ifdef STARPU_USE_CUDA
 #ifdef STARPU_USE_CUDA
-static unsigned int ncuda;
+static unsigned int _ncuda;
 #endif
 #endif
 #ifdef STARPU_USE_OPENCL
 #ifdef STARPU_USE_OPENCL
-static unsigned int nopencl;
+static unsigned int _nopencl;
 #endif
 #endif
 
 
 
 
-static struct point array_of_structs[N];
-static starpu_data_handle_t handle;
-static unsigned int nchunks = 6;
+static struct point _array_of_structs[N];
+static starpu_data_handle_t _handle;
+static unsigned int _nchunks = 6;
 
 
 #ifdef STARPU_USE_CUDA
 #ifdef STARPU_USE_CUDA
 extern struct starpu_codelet cpu_to_cuda_cl;
 extern struct starpu_codelet cpu_to_cuda_cl;
@@ -107,26 +107,26 @@ register_and_partition_data(void)
 	int i;
 	int i;
 	for (i = 0; i < N; i++)
 	for (i = 0; i < N; i++)
 	{
 	{
-		array_of_structs[i].x = i+1.0;
-		array_of_structs[i].y = 42.0;
+		_array_of_structs[i].x = i+1.0;
+		_array_of_structs[i].y = 42.0;
 	}
 	}
-	custom_data_register(&handle, 0, &array_of_structs, N, &format_ops);
+	custom_data_register(&_handle, 0, &_array_of_structs, N, &format_ops);
 
 
 	struct starpu_data_filter f =
 	struct starpu_data_filter f =
 	{
 	{
 		.filter_func   = custom_filter,
 		.filter_func   = custom_filter,
-		.nchildren     = nchunks,
+		.nchildren     = _nchunks,
 		.get_nchildren = NULL,
 		.get_nchildren = NULL,
 		.get_child_ops = NULL
 		.get_child_ops = NULL
 	};
 	};
-	starpu_data_partition(handle, &f);
+	starpu_data_partition(_handle, &f);
 }
 }
 
 
 static void
 static void
 unpartition_and_unregister_data(void)
 unpartition_and_unregister_data(void)
 {
 {
-	starpu_data_unpartition(handle, 0);
-	starpu_data_unregister(handle);
+	starpu_data_unpartition(_handle, 0);
+	starpu_data_unregister(_handle);
 }
 }
 
 
 static void
 static void
@@ -181,7 +181,7 @@ create_and_submit_tasks(void)
 {
 {
 	int err;
 	int err;
 	unsigned int i;
 	unsigned int i;
-	for (i = 0; i < nchunks; i++)
+	for (i = 0; i < _nchunks; i++)
 	{
 	{
 		struct starpu_task *task = starpu_task_create();
 		struct starpu_task *task = starpu_task_create();
 		switch (i%3)
 		switch (i%3)
@@ -191,7 +191,7 @@ create_and_submit_tasks(void)
 			break;
 			break;
 		case 1:
 		case 1:
 #ifdef STARPU_USE_CUDA
 #ifdef STARPU_USE_CUDA
-			if (ncuda > 0)
+			if (_ncuda > 0)
 				task->cl = &cuda_cl;
 				task->cl = &cuda_cl;
 			else
 			else
 #endif
 #endif
@@ -199,7 +199,7 @@ create_and_submit_tasks(void)
 			break;
 			break;
 		case 2:
 		case 2:
 #ifdef STARPU_USE_OPENCL
 #ifdef STARPU_USE_OPENCL
-			if (nopencl > 0)
+			if (_nopencl > 0)
 				task->cl = &opencl_cl;
 				task->cl = &opencl_cl;
 			else
 			else
 #endif
 #endif
@@ -210,7 +210,7 @@ create_and_submit_tasks(void)
 			assert(0);
 			assert(0);
 		}
 		}
 
 
-		task->handles[0] = starpu_data_get_sub_data(handle, 1, i);
+		task->handles[0] = starpu_data_get_sub_data(_handle, 1, i);
 		err = starpu_task_submit(task);
 		err = starpu_task_submit(task);
 		if (err != 0)
 		if (err != 0)
 			return err;
 			return err;
@@ -232,8 +232,8 @@ print_it(void)
 	for (i = 0; i < N; i++)
 	for (i = 0; i < N; i++)
 	{
 	{
 		FPRINTF(stderr, "(%.2f, %.2f) ",
 		FPRINTF(stderr, "(%.2f, %.2f) ",
-			array_of_structs[i].x,
-			array_of_structs[i].y);
+			_array_of_structs[i].x,
+			_array_of_structs[i].y);
 	}
 	}
 	FPRINTF(stderr, "\n");
 	FPRINTF(stderr, "\n");
 }
 }
@@ -246,7 +246,7 @@ check_it(void)
 	for (i = 0; i < N; i++)
 	for (i = 0; i < N; i++)
 	{
 	{
 		float expected_value = (i + 1.0)*42.0;
 		float expected_value = (i + 1.0)*42.0;
-		if (array_of_structs[i].x != expected_value)
+		if (_array_of_structs[i].x != expected_value)
 			return EXIT_FAILURE;
 			return EXIT_FAILURE;
 	}
 	}
 
 
@@ -254,8 +254,8 @@ check_it(void)
 }
 }
 
 
 #ifdef STARPU_USE_OPENCL
 #ifdef STARPU_USE_OPENCL
-struct starpu_opencl_program opencl_program;
-struct starpu_opencl_program opencl_conversion_program;
+struct starpu_opencl_program _opencl_program;
+struct starpu_opencl_program _opencl_conversion_program;
 #endif /* !STARPU_USE_OPENCL */
 #endif /* !STARPU_USE_OPENCL */
 
 
 int
 int
@@ -271,20 +271,20 @@ main(void)
 		goto enodev;
 		goto enodev;
 
 
 #ifdef STARPU_USE_CUDA
 #ifdef STARPU_USE_CUDA
-	ncuda = starpu_cuda_worker_get_count();
+	_ncuda = starpu_cuda_worker_get_count();
 #endif /* !STARPU_USE_CUDA */
 #endif /* !STARPU_USE_CUDA */
 #ifdef STARPU_USE_OPENCL
 #ifdef STARPU_USE_OPENCL
-	nopencl = starpu_opencl_worker_get_count();
-	if (nopencl > 0)
+	_nopencl = starpu_opencl_worker_get_count();
+	if (_nopencl > 0)
 	{
 	{
 		char *f1 = "examples/filters/custom_mf/custom_opencl.cl";
 		char *f1 = "examples/filters/custom_mf/custom_opencl.cl";
 		char *f2 = "examples/filters/custom_mf/conversion_opencl.cl";
 		char *f2 = "examples/filters/custom_mf/conversion_opencl.cl";
-		err = starpu_opencl_load_opencl_from_file(f1, &opencl_program,
+		err = starpu_opencl_load_opencl_from_file(f1, &_opencl_program,
 							  NULL);
 							  NULL);
 		assert(err == 0);
 		assert(err == 0);
 		err = starpu_opencl_load_opencl_from_file(f2,
 		err = starpu_opencl_load_opencl_from_file(f2,
-						&opencl_conversion_program,
-						NULL);
+							  &_opencl_conversion_program,
+							  NULL);
 		assert(err == 0);
 		assert(err == 0);
 	}
 	}
 #endif /* !STARPU_USE_OPENCL */
 #endif /* !STARPU_USE_OPENCL */
@@ -306,11 +306,11 @@ main(void)
 #endif
 #endif
 
 
 #ifdef STARPU_USE_OPENCL
 #ifdef STARPU_USE_OPENCL
-	if (nopencl > 0)
+	if (_nopencl > 0)
 	{
 	{
-        	err = starpu_opencl_unload_opencl(&opencl_program);
+        	err = starpu_opencl_unload_opencl(&_opencl_program);
 		assert(err == 0);
 		assert(err == 0);
-		err = starpu_opencl_unload_opencl(&opencl_conversion_program);
+		err = starpu_opencl_unload_opencl(&_opencl_conversion_program);
 		assert(err == 0);
 		assert(err == 0);
 	}
 	}
 #endif /* !STARPU_USE_OPENCL */
 #endif /* !STARPU_USE_OPENCL */

+ 2 - 2
examples/filters/custom_mf/custom_opencl.c

@@ -18,7 +18,7 @@
 #include "custom_types.h"
 #include "custom_types.h"
 #include "custom_interface.h"
 #include "custom_interface.h"
 
 
-extern struct starpu_opencl_program opencl_program;
+extern struct starpu_opencl_program _opencl_program;
 
 
 void custom_scal_opencl_func(void *buffers[], void *args)
 void custom_scal_opencl_func(void *buffers[], void *args)
 {
 {
@@ -38,7 +38,7 @@ void custom_scal_opencl_func(void *buffers[], void *args)
 
 
 	err = starpu_opencl_load_kernel(&kernel,
 	err = starpu_opencl_load_kernel(&kernel,
 					&queue,
 					&queue,
-					&opencl_program,
+					&_opencl_program,
 					"custom_scal_opencl",
 					"custom_scal_opencl",
 					devid);
 					devid);
 	if (err != CL_SUCCESS)
 	if (err != CL_SUCCESS)

+ 21 - 21
examples/heat/dw_sparse_cg.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  *
  * Copyright (C) 2009, 2010, 2011  Université de Bordeaux 1
  * Copyright (C) 2009, 2010, 2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  *
  * StarPU is free software; you can redistribute it and/or modify
  * 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
  * it under the terms of the GNU Lesser General Public License as published by
@@ -38,18 +38,18 @@ static struct starpu_task *create_task(starpu_tag_t id)
 static void create_data(float **_nzvalA, float **_vecb, float **_vecx, uint32_t *_nnz, uint32_t *_nrow, uint32_t **_colind, uint32_t **_rowptr)
 static void create_data(float **_nzvalA, float **_vecb, float **_vecx, uint32_t *_nnz, uint32_t *_nrow, uint32_t **_colind, uint32_t **_rowptr)
 {
 {
 	/* we need a sparse symetric (definite positive ?) matrix and a "dense" vector */
 	/* we need a sparse symetric (definite positive ?) matrix and a "dense" vector */
-	
+
 	/* example of 3-band matrix */
 	/* example of 3-band matrix */
 	float *nzval;
 	float *nzval;
 	uint32_t nnz;
 	uint32_t nnz;
 	uint32_t *colind;
 	uint32_t *colind;
 	uint32_t *rowptr;
 	uint32_t *rowptr;
 
 
-	nnz = 3*size-2;
+	nnz = 3*_size-2;
 
 
 	nzval = malloc(nnz*sizeof(float));
 	nzval = malloc(nnz*sizeof(float));
 	colind = malloc(nnz*sizeof(uint32_t));
 	colind = malloc(nnz*sizeof(uint32_t));
-	rowptr = malloc(size*sizeof(uint32_t));
+	rowptr = malloc(_size*sizeof(uint32_t));
 
 
 	assert(nzval);
 	assert(nzval);
 	assert(colind);
 	assert(colind);
@@ -59,7 +59,7 @@ static void create_data(float **_nzvalA, float **_vecb, float **_vecx, uint32_t
 	/* fill the matrix */
 	/* fill the matrix */
 	unsigned row;
 	unsigned row;
 	unsigned pos = 0;
 	unsigned pos = 0;
-	for (row = 0; row < size; row++)
+	for (row = 0; row < _size; row++)
 	{
 	{
 		rowptr[row] = pos;
 		rowptr[row] = pos;
 
 
@@ -69,12 +69,12 @@ static void create_data(float **_nzvalA, float **_vecb, float **_vecx, uint32_t
 			colind[pos] = row-1;
 			colind[pos] = row-1;
 			pos++;
 			pos++;
 		}
 		}
-		
+
 		nzval[pos] = 5.0f;
 		nzval[pos] = 5.0f;
 		colind[pos] = row;
 		colind[pos] = row;
 		pos++;
 		pos++;
 
 
-		if (row < size - 1)
+		if (row < _size - 1)
 		{
 		{
 			nzval[pos] = 1.0f;
 			nzval[pos] = 1.0f;
 			colind[pos] = row+1;
 			colind[pos] = row+1;
@@ -83,24 +83,24 @@ static void create_data(float **_nzvalA, float **_vecb, float **_vecx, uint32_t
 	}
 	}
 
 
 	*_nnz = nnz;
 	*_nnz = nnz;
-	*_nrow = size;
+	*_nrow = _size;
 	*_nzvalA = nzval;
 	*_nzvalA = nzval;
 	*_colind = colind;
 	*_colind = colind;
 	*_rowptr = rowptr;
 	*_rowptr = rowptr;
 
 
 	STARPU_ASSERT(pos == nnz);
 	STARPU_ASSERT(pos == nnz);
-	
+
 	/* initiate the 2 vectors */
 	/* initiate the 2 vectors */
 	float *invec, *outvec;
 	float *invec, *outvec;
-	invec = malloc(size*sizeof(float));
+	invec = malloc(_size*sizeof(float));
 	assert(invec);
 	assert(invec);
 
 
-	outvec = malloc(size*sizeof(float));
+	outvec = malloc(_size*sizeof(float));
 	assert(outvec);
 	assert(outvec);
 
 
 	/* fill those */
 	/* fill those */
 	unsigned ind;
 	unsigned ind;
-	for (ind = 0; ind < size; ind++)
+	for (ind = 0; ind < _size; ind++)
 	{
 	{
 		invec[ind] = 2.0f;
 		invec[ind] = 2.0f;
 		outvec[ind] = 0.0f;
 		outvec[ind] = 0.0f;
@@ -127,10 +127,10 @@ void init_problem(void)
 }
 }
 
 
 /*
 /*
- *	cg initialization phase 
+ *	cg initialization phase
  */
  */
 
 
-void init_cg(struct cg_problem *problem) 
+void init_cg(struct cg_problem *problem)
 {
 {
 	int ret;
 	int ret;
 
 
@@ -178,7 +178,7 @@ void init_cg(struct cg_problem *problem)
 
 
 	task3->callback_func = iteration_cg;
 	task3->callback_func = iteration_cg;
 	task3->callback_arg = problem;
 	task3->callback_arg = problem;
-	
+
 	/* XXX 3 should only depend on 1 ... */
 	/* XXX 3 should only depend on 1 ... */
 	starpu_tag_declare_deps((starpu_tag_t)3UL, 1, (starpu_tag_t)2UL);
 	starpu_tag_declare_deps((starpu_tag_t)3UL, 1, (starpu_tag_t)2UL);
 
 
@@ -192,7 +192,7 @@ void init_cg(struct cg_problem *problem)
 }
 }
 
 
 /*
 /*
- *	the inner iteration of the cg algorithm 
+ *	the inner iteration of the cg algorithm
  *		the codelet code launcher is its own callback !
  *		the codelet code launcher is its own callback !
  */
  */
 
 
@@ -301,7 +301,7 @@ void launch_new_cg_iteration(struct cg_problem *problem)
 
 
 	task9->callback_func = iteration_cg;
 	task9->callback_func = iteration_cg;
 	task9->callback_arg = problem;
 	task9->callback_arg = problem;
-	
+
 	/* launch the computation now */
 	/* launch the computation now */
 	ret = starpu_task_submit(task4);
 	ret = starpu_task_submit(task4);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
@@ -323,7 +323,7 @@ void iteration_cg(void *problem)
 
 
 	FPRINTF(stdout, "i : %d (MAX %d)\n\tdelta_new %f (%f)\n", pb->i, MAXITER, pb->delta_new, sqrt(pb->delta_new / pb->size));
 	FPRINTF(stdout, "i : %d (MAX %d)\n\tdelta_new %f (%f)\n", pb->i, MAXITER, pb->delta_new, sqrt(pb->delta_new / pb->size));
 
 
-	if ((pb->i < MAXITER) && 
+	if ((pb->i < MAXITER) &&
 		(pb->delta_new > pb->epsilon) )
 		(pb->delta_new > pb->epsilon) )
 	{
 	{
 		if (pb->i % 1000 == 0)
 		if (pb->i % 1000 == 0)
@@ -344,7 +344,7 @@ void iteration_cg(void *problem)
 }
 }
 
 
 /*
 /*
- *	initializing the problem 
+ *	initializing the problem
  */
  */
 
 
 void conjugate_gradient(float *nzvalA, float *vecb, float *vecx, uint32_t nnz,
 void conjugate_gradient(float *nzvalA, float *vecb, float *vecx, uint32_t nnz,
@@ -354,10 +354,10 @@ void conjugate_gradient(float *nzvalA, float *vecb, float *vecx, uint32_t nnz,
 
 
 	starpu_data_handle_t ds_matrixA;
 	starpu_data_handle_t ds_matrixA;
 	starpu_data_handle_t ds_vecx, ds_vecb;
 	starpu_data_handle_t ds_vecx, ds_vecb;
-	starpu_data_handle_t ds_vecr, ds_vecd, ds_vecq; 
+	starpu_data_handle_t ds_vecr, ds_vecd, ds_vecq;
 
 
 	/* first the user-allocated data */
 	/* first the user-allocated data */
-	starpu_csr_data_register(&ds_matrixA, 0, nnz, nrow, 
+	starpu_csr_data_register(&ds_matrixA, 0, nnz, nrow,
 			(uintptr_t)nzvalA, colind, rowptr, 0, sizeof(float));
 			(uintptr_t)nzvalA, colind, rowptr, 0, sizeof(float));
 	starpu_vector_data_register(&ds_vecx, 0, (uintptr_t)vecx, nrow, sizeof(float));
 	starpu_vector_data_register(&ds_vecx, 0, (uintptr_t)vecx, nrow, sizeof(float));
 	starpu_vector_data_register(&ds_vecb, 0, (uintptr_t)vecb, nrow, sizeof(float));
 	starpu_vector_data_register(&ds_vecb, 0, (uintptr_t)vecb, nrow, sizeof(float));

+ 9 - 9
examples/heat/dw_sparse_cg.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  *
  * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
  * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  *
  * StarPU is free software; you can redistribute it and/or modify
  * 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
  * it under the terms of the GNU Lesser General Public License as published by
@@ -40,10 +40,10 @@
 #define EPSILON	0.0000001f
 #define EPSILON	0.0000001f
 
 
 /* code parameters */
 /* code parameters */
-static uint32_t size = 33554432;
-static unsigned usecpu = 0;
-static unsigned blocks = 512;
-static unsigned grids  = 8;
+static uint32_t _size = 33554432;
+static unsigned _usecpu = 0;
+static unsigned _blocks = 512;
+static unsigned _grids  = 8;
 
 
 struct cg_problem
 struct cg_problem
 {
 {
@@ -76,24 +76,24 @@ static void __attribute__((unused)) parse_args(int argc, char **argv)
 		if (strcmp(argv[i], "-size") == 0)
 		if (strcmp(argv[i], "-size") == 0)
 		{
 		{
 			char *argptr;
 			char *argptr;
-			size = strtol(argv[++i], &argptr, 10);
+			_size = strtol(argv[++i], &argptr, 10);
 		}
 		}
 
 
 		if (strcmp(argv[i], "-block") == 0)
 		if (strcmp(argv[i], "-block") == 0)
 		{
 		{
 			char *argptr;
 			char *argptr;
-			blocks = strtol(argv[++i], &argptr, 10);
+			_blocks = strtol(argv[++i], &argptr, 10);
 		}
 		}
 
 
 		if (strcmp(argv[i], "-grid") == 0)
 		if (strcmp(argv[i], "-grid") == 0)
 		{
 		{
 			char *argptr;
 			char *argptr;
-			grids = strtol(argv[++i], &argptr, 10);
+			_grids = strtol(argv[++i], &argptr, 10);
 		}
 		}
 
 
 		if (strcmp(argv[i], "-cpu") == 0)
 		if (strcmp(argv[i], "-cpu") == 0)
 		{
 		{
-			usecpu = 1;
+			_usecpu = 1;
 		}
 		}
 	}
 	}
 }
 }

+ 43 - 43
examples/reductions/dot_product.c

@@ -28,19 +28,19 @@
 
 
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 
-static float *x;
-static float *y;
-static starpu_data_handle_t *x_handles;
-static starpu_data_handle_t *y_handles;
+static float *_x;
+static float *_y;
+static starpu_data_handle_t *_x_handles;
+static starpu_data_handle_t *_y_handles;
 #ifdef STARPU_USE_OPENCL
 #ifdef STARPU_USE_OPENCL
-static struct starpu_opencl_program opencl_program;
+static struct starpu_opencl_program _opencl_program;
 #endif
 #endif
 
 
-static unsigned nblocks = 4096;
-static unsigned entries_per_block = 1024;
+static unsigned _nblocks = 4096;
+static unsigned _entries_per_block = 1024;
 
 
-static DOT_TYPE dot = 0.0f;
-static starpu_data_handle_t dot_handle;
+static DOT_TYPE _dot = 0.0f;
+static starpu_data_handle_t _dot_handle;
 
 
 static int can_execute(unsigned workerid, struct starpu_task *task, unsigned nimpl)
 static int can_execute(unsigned workerid, struct starpu_task *task, unsigned nimpl)
 {
 {
@@ -148,7 +148,7 @@ void redux_opencl_func(void *buffers[], void *args)
 	id = starpu_worker_get_id();
 	id = starpu_worker_get_id();
 	devid = starpu_worker_get_devid(id);
 	devid = starpu_worker_get_devid(id);
 
 
-	err = starpu_opencl_load_kernel(&kernel, &queue, &opencl_program, "_redux_opencl", devid);
+	err = starpu_opencl_load_kernel(&kernel, &queue, &_opencl_program, "_redux_opencl", devid);
 	if (err != CL_SUCCESS)
 	if (err != CL_SUCCESS)
 		STARPU_OPENCL_REPORT_ERROR(err);
 		STARPU_OPENCL_REPORT_ERROR(err);
 
 
@@ -262,7 +262,7 @@ void dot_opencl_func(void *buffers[], void *args)
 	id = starpu_worker_get_id();
 	id = starpu_worker_get_id();
 	devid = starpu_worker_get_devid(id);
 	devid = starpu_worker_get_devid(id);
 
 
-	err = starpu_opencl_load_kernel(&kernel, &queue, &opencl_program, "_dot_opencl", devid);
+	err = starpu_opencl_load_kernel(&kernel, &queue, &_opencl_program, "_dot_opencl", devid);
 	if (err != CL_SUCCESS)
 	if (err != CL_SUCCESS)
 		STARPU_OPENCL_REPORT_ERROR(err);
 		STARPU_OPENCL_REPORT_ERROR(err);
 
 
@@ -329,22 +329,22 @@ int main(int argc, char **argv)
 
 
 #ifdef STARPU_USE_OPENCL
 #ifdef STARPU_USE_OPENCL
 	ret = starpu_opencl_load_opencl_from_file("examples/reductions/dot_product_opencl_kernels.cl",
 	ret = starpu_opencl_load_opencl_from_file("examples/reductions/dot_product_opencl_kernels.cl",
-						  &opencl_program, NULL);
+						  &_opencl_program, NULL);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_load_opencl_from_file");
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_load_opencl_from_file");
 #endif
 #endif
 
 
 	starpu_cublas_init();
 	starpu_cublas_init();
 
 
-	unsigned long nelems = nblocks*entries_per_block;
+	unsigned long nelems = _nblocks*_entries_per_block;
 	size_t size = nelems*sizeof(float);
 	size_t size = nelems*sizeof(float);
 
 
-	x = (float *) malloc(size);
-	y = (float *) malloc(size);
+	_x = (float *) malloc(size);
+	_y = (float *) malloc(size);
 
 
-	x_handles = (starpu_data_handle_t *) calloc(nblocks, sizeof(starpu_data_handle_t));
-	y_handles = (starpu_data_handle_t *) calloc(nblocks, sizeof(starpu_data_handle_t));
+	_x_handles = (starpu_data_handle_t *) calloc(_nblocks, sizeof(starpu_data_handle_t));
+	_y_handles = (starpu_data_handle_t *) calloc(_nblocks, sizeof(starpu_data_handle_t));
 
 
-	assert(x && y);
+	assert(_x && _y);
 
 
         starpu_srand48(0);
         starpu_srand48(0);
 
 
@@ -353,67 +353,67 @@ int main(int argc, char **argv)
 	unsigned long i;
 	unsigned long i;
 	for (i = 0; i < nelems; i++)
 	for (i = 0; i < nelems; i++)
 	{
 	{
-		x[i] = (float)starpu_drand48();
-		y[i] = (float)starpu_drand48();
+		_x[i] = (float)starpu_drand48();
+		_y[i] = (float)starpu_drand48();
 
 
-		reference_dot += (DOT_TYPE)x[i]*(DOT_TYPE)y[i];
+		reference_dot += (DOT_TYPE)_x[i]*(DOT_TYPE)_y[i];
 	}
 	}
 
 
 	unsigned block;
 	unsigned block;
-	for (block = 0; block < nblocks; block++)
+	for (block = 0; block < _nblocks; block++)
 	{
 	{
-		starpu_vector_data_register(&x_handles[block], 0,
-			(uintptr_t)&x[entries_per_block*block], entries_per_block, sizeof(float));
-		starpu_vector_data_register(&y_handles[block], 0,
-			(uintptr_t)&y[entries_per_block*block], entries_per_block, sizeof(float));
+		starpu_vector_data_register(&_x_handles[block], 0,
+			(uintptr_t)&_x[_entries_per_block*block], _entries_per_block, sizeof(float));
+		starpu_vector_data_register(&_y_handles[block], 0,
+			(uintptr_t)&_y[_entries_per_block*block], _entries_per_block, sizeof(float));
 	}
 	}
 
 
-	starpu_variable_data_register(&dot_handle, 0, (uintptr_t)&dot, sizeof(DOT_TYPE));
+	starpu_variable_data_register(&_dot_handle, 0, (uintptr_t)&_dot, sizeof(DOT_TYPE));
 
 
 	/*
 	/*
 	 *	Compute dot product with StarPU
 	 *	Compute dot product with StarPU
 	 */
 	 */
-	starpu_data_set_reduction_methods(dot_handle, &redux_codelet, &init_codelet);
+	starpu_data_set_reduction_methods(_dot_handle, &redux_codelet, &init_codelet);
 
 
-	for (block = 0; block < nblocks; block++)
+	for (block = 0; block < _nblocks; block++)
 	{
 	{
 		struct starpu_task *task = starpu_task_create();
 		struct starpu_task *task = starpu_task_create();
 
 
 		task->cl = &dot_codelet;
 		task->cl = &dot_codelet;
 		task->destroy = 1;
 		task->destroy = 1;
 
 
-		task->handles[0] = x_handles[block];
-		task->handles[1] = y_handles[block];
-		task->handles[2] = dot_handle;
+		task->handles[0] = _x_handles[block];
+		task->handles[1] = _y_handles[block];
+		task->handles[2] = _dot_handle;
 
 
 		ret = starpu_task_submit(task);
 		ret = starpu_task_submit(task);
 		if (ret == -ENODEV) goto enodev;
 		if (ret == -ENODEV) goto enodev;
 		STARPU_ASSERT(!ret);
 		STARPU_ASSERT(!ret);
 	}
 	}
 
 
-	for (block = 0; block < nblocks; block++)
+	for (block = 0; block < _nblocks; block++)
 	{
 	{
-		starpu_data_unregister(x_handles[block]);
-		starpu_data_unregister(y_handles[block]);
+		starpu_data_unregister(_x_handles[block]);
+		starpu_data_unregister(_y_handles[block]);
 	}
 	}
-	starpu_data_unregister(dot_handle);
+	starpu_data_unregister(_dot_handle);
 
 
-	FPRINTF(stderr, "Reference : %e vs. %e (Delta %e)\n", reference_dot, dot, reference_dot - dot);
+	FPRINTF(stderr, "Reference : %e vs. %e (Delta %e)\n", reference_dot, _dot, reference_dot - _dot);
 
 
 	starpu_cublas_shutdown();
 	starpu_cublas_shutdown();
 
 
 #ifdef STARPU_USE_OPENCL
 #ifdef STARPU_USE_OPENCL
-        ret = starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&_opencl_program);
         STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
         STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 #endif
 #endif
 	starpu_shutdown();
 	starpu_shutdown();
 
 
-	free(x);
-	free(y);
-	free(x_handles);
-	free(y_handles);
+	free(_x);
+	free(_y);
+	free(_x_handles);
+	free(_y_handles);
 
 
-	if (fabs(reference_dot - dot) < reference_dot * 1e-6)
+	if (fabs(reference_dot - _dot) < reference_dot * 1e-6)
 		return EXIT_SUCCESS;
 		return EXIT_SUCCESS;
 	else
 	else
 		return EXIT_FAILURE;
 		return EXIT_FAILURE;

+ 34 - 34
examples/reductions/minmax_reduction.c

@@ -20,11 +20,11 @@
 #include <starpu.h>
 #include <starpu.h>
 
 
 #ifdef STARPU_QUICK_CHECK
 #ifdef STARPU_QUICK_CHECK
-static unsigned nblocks = 512;
-static unsigned entries_per_bock = 64;
+static unsigned _nblocks = 512;
+static unsigned _entries_per_bock = 64;
 #else
 #else
-static unsigned nblocks = 8192;
-static unsigned entries_per_bock = 1024;
+static unsigned _nblocks = 8192;
+static unsigned _entries_per_bock = 1024;
 #endif
 #endif
 
 
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
@@ -33,12 +33,12 @@ static unsigned entries_per_bock = 1024;
 #define TYPE_MAX	DBL_MAX
 #define TYPE_MAX	DBL_MAX
 #define TYPE_MIN	DBL_MIN
 #define TYPE_MIN	DBL_MIN
 
 
-static TYPE *x;
-static starpu_data_handle_t *x_handles;
+static TYPE *_x;
+static starpu_data_handle_t *_x_handles;
 
 
 /* The first element (resp. second) stores the min element (resp. max). */
 /* The first element (resp. second) stores the min element (resp. max). */
-static TYPE minmax[2];
-static starpu_data_handle_t minmax_handle;
+static TYPE _minmax[2];
+static starpu_data_handle_t _minmax_handle;
 
 
 /*
 /*
  *	Codelet to create a neutral element
  *	Codelet to create a neutral element
@@ -136,46 +136,46 @@ int main(int argc, char **argv)
 		return 77;
 		return 77;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 
-	unsigned long nelems = nblocks*entries_per_bock;
+	unsigned long nelems = _nblocks*_entries_per_bock;
 	size_t size = nelems*sizeof(TYPE);
 	size_t size = nelems*sizeof(TYPE);
 
 
-	x = (TYPE *) malloc(size);
-	x_handles = (starpu_data_handle_t *) calloc(nblocks, sizeof(starpu_data_handle_t));
-	
-	assert(x && x_handles);
+	_x = (TYPE *) malloc(size);
+	_x_handles = (starpu_data_handle_t *) calloc(_nblocks, sizeof(starpu_data_handle_t));
+
+	assert(_x && _x_handles);
 
 
 	/* Initialize the vector with random values */
 	/* Initialize the vector with random values */
         starpu_srand48(0);
         starpu_srand48(0);
 	for (i = 0; i < nelems; i++)
 	for (i = 0; i < nelems; i++)
-		x[i] = (TYPE)starpu_drand48();
-	
+		_x[i] = (TYPE)starpu_drand48();
+
 	unsigned block;
 	unsigned block;
-	for (block = 0; block < nblocks; block++)
+	for (block = 0; block < _nblocks; block++)
 	{
 	{
-		uintptr_t block_start = (uintptr_t)&x[entries_per_bock*block];
-		starpu_vector_data_register(&x_handles[block], 0, block_start,
-						entries_per_bock, sizeof(TYPE));
+		uintptr_t block_start = (uintptr_t)&_x[_entries_per_bock*block];
+		starpu_vector_data_register(&_x_handles[block], 0, block_start,
+					    _entries_per_bock, sizeof(TYPE));
 	}
 	}
 
 
 	/* Initialize current min */
 	/* Initialize current min */
-	minmax[0] = TYPE_MAX;
+	_minmax[0] = TYPE_MAX;
 
 
 	/* Initialize current max */
 	/* Initialize current max */
-	minmax[1] = TYPE_MIN;
+	_minmax[1] = TYPE_MIN;
 
 
-	starpu_variable_data_register(&minmax_handle, 0, (uintptr_t)minmax, 2*sizeof(TYPE));
+	starpu_variable_data_register(&_minmax_handle, 0, (uintptr_t)_minmax, 2*sizeof(TYPE));
 
 
 	/* Set the methods to define neutral elements and to perform the reduction operation */
 	/* Set the methods to define neutral elements and to perform the reduction operation */
-	starpu_data_set_reduction_methods(minmax_handle, &minmax_redux_codelet, &minmax_init_codelet);
+	starpu_data_set_reduction_methods(_minmax_handle, &minmax_redux_codelet, &minmax_init_codelet);
 
 
-	for (block = 0; block < nblocks; block++)
+	for (block = 0; block < _nblocks; block++)
 	{
 	{
 		struct starpu_task *task = starpu_task_create();
 		struct starpu_task *task = starpu_task_create();
 
 
 		task->cl = &minmax_codelet;
 		task->cl = &minmax_codelet;
 
 
-		task->handles[0] = x_handles[block];
-		task->handles[1] = minmax_handle;
+		task->handles[0] = _x_handles[block];
+		task->handles[1] = _minmax_handle;
 
 
 		ret = starpu_task_submit(task);
 		ret = starpu_task_submit(task);
 		if (ret)
 		if (ret)
@@ -186,19 +186,19 @@ int main(int argc, char **argv)
 		}
 		}
 	}
 	}
 
 
-	for (block = 0; block < nblocks; block++)
+	for (block = 0; block < _nblocks; block++)
 	{
 	{
-		starpu_data_unregister(x_handles[block]);
+		starpu_data_unregister(_x_handles[block]);
 	}
 	}
-	starpu_data_unregister(minmax_handle);
+	starpu_data_unregister(_minmax_handle);
 
 
-	FPRINTF(stderr, "Min : %e\n", minmax[0]);
-	FPRINTF(stderr, "Max : %e\n", minmax[1]);
+	FPRINTF(stderr, "Min : %e\n", _minmax[0]);
+	FPRINTF(stderr, "Max : %e\n", _minmax[1]);
 
 
-	STARPU_ASSERT(minmax[0] <= minmax[1]);
+	STARPU_ASSERT(_minmax[0] <= _minmax[1]);
 
 
-	free(x);
-	free(x_handles);
+	free(_x);
+	free(_x_handles);
 	starpu_shutdown();
 	starpu_shutdown();
 
 
 	return 0;
 	return 0;

+ 1 - 1
examples/spmd/vector_scal_spmd.c

@@ -62,7 +62,7 @@ void scal_cpu_func(void *buffers[], void *_args)
 
 
 
 
 	for (i = 0; i < nel_worker; i++) {
 	for (i = 0; i < nel_worker; i++) {
-		int rank = i + begin;
+		rank = i + begin;
 
 
 		float v = val[rank];
 		float v = val[rank];
 		int j;
 		int j;

+ 14 - 14
examples/tag_example/tag_example.c

@@ -86,25 +86,25 @@ static void parse_args(int argc, char **argv)
 void callback_cpu(void *argcb);
 void callback_cpu(void *argcb);
 static void express_deps(unsigned i, unsigned j, unsigned iter);
 static void express_deps(unsigned i, unsigned j, unsigned iter);
 
 
-static void tag_cleanup_grid(unsigned ni, unsigned nj, unsigned iter)
+static void tag_cleanup_grid(unsigned piter)
 {
 {
 	unsigned i,j;
 	unsigned i,j;
 
 
 	for (j = 0; j < nj; j++)
 	for (j = 0; j < nj; j++)
 	for (i = 0; i < ni; i++)
 	for (i = 0; i < ni; i++)
 	{
 	{
-		starpu_tag_remove(TAG(i,j,iter));
+		starpu_tag_remove(TAG(i,j,piter));
 	}
 	}
 
 
 
 
 } 
 } 
 
 
-static int create_task_grid(unsigned iter)
+static int create_task_grid(unsigned piter)
 {
 {
 	unsigned i, j;
 	unsigned i, j;
 	int ret;
 	int ret;
 
 
-/*	FPRINTF(stderr, "start iter %d...\n", iter); */
+/*	FPRINTF(stderr, "start iter %d...\n", piter); */
 	callback_cnt = (ni*nj);
 	callback_cnt = (ni*nj);
 
 
 	/* create non-entry tasks */
 	/* create non-entry tasks */
@@ -119,10 +119,10 @@ static int create_task_grid(unsigned iter)
 		task->cl_arg = NULL;
 		task->cl_arg = NULL;
 
 
 		task->use_tag = 1;
 		task->use_tag = 1;
-		task->tag_id = TAG(i, j, iter);
+		task->tag_id = TAG(i, j, piter);
 
 
 		/* express deps : (i,j) depends on (i-1, j-1) & (i-1, j+1) */
 		/* express deps : (i,j) depends on (i-1, j-1) & (i-1, j+1) */
-		express_deps(i, j, iter);
+		express_deps(i, j, piter);
 
 
 		ret = starpu_task_submit(task);
 		ret = starpu_task_submit(task);
 		if (ret == -ENODEV) return 77;
 		if (ret == -ENODEV) return 77;
@@ -140,7 +140,7 @@ static int create_task_grid(unsigned iter)
 
 
 		task->use_tag = 1;
 		task->use_tag = 1;
 		/* this is an entry task */
 		/* this is an entry task */
-		task->tag_id = TAG(0, j, iter);
+		task->tag_id = TAG(0, j, piter);
 
 
 		ret = starpu_task_submit(task);
 		ret = starpu_task_submit(task);
 		if (ret == -ENODEV) return 77;
 		if (ret == -ENODEV) return 77;
@@ -160,7 +160,7 @@ void callback_cpu(void *argcb __attribute__ ((unused)))
 		{
 		{
 			/* cleanup old grids ... */
 			/* cleanup old grids ... */
 			if (iter > 2)
 			if (iter > 2)
-				tag_cleanup_grid(ni, nj, iter-2);
+				tag_cleanup_grid(iter-2);
 
 
 			/* create a new iteration */
 			/* create a new iteration */
 			create_task_grid(iter);
 			create_task_grid(iter);
@@ -174,7 +174,7 @@ void cpu_codelet(void *descr[] __attribute__((unused)),
 /*	printf("execute task\n"); */
 /*	printf("execute task\n"); */
 }
 }
 
 
-static void express_deps(unsigned i, unsigned j, unsigned iter)
+static void express_deps(unsigned i, unsigned j, unsigned piter)
 {
 {
 	if (j > 0)
 	if (j > 0)
 	{
 	{
@@ -182,12 +182,12 @@ static void express_deps(unsigned i, unsigned j, unsigned iter)
 		if (j < nj - 1)
 		if (j < nj - 1)
 		{
 		{
 			/* (i,j+1) exists */
 			/* (i,j+1) exists */
-			starpu_tag_declare_deps(TAG(i,j,iter), 2, TAG(i-1,j-1,iter), TAG(i-1,j+1,iter));
+			starpu_tag_declare_deps(TAG(i,j,piter), 2, TAG(i-1,j-1,piter), TAG(i-1,j+1,piter));
 		}
 		}
 		else
 		else
 		{
 		{
 			/* (i,j+1) does not exist */
 			/* (i,j+1) does not exist */
-			starpu_tag_declare_deps(TAG(i,j,iter), 1, TAG(i-1,j-1,iter));
+			starpu_tag_declare_deps(TAG(i,j,piter), 1, TAG(i-1,j-1,piter));
 		}
 		}
 	}
 	}
 	else
 	else
@@ -196,7 +196,7 @@ static void express_deps(unsigned i, unsigned j, unsigned iter)
 		if (j < nj - 1)
 		if (j < nj - 1)
 		{
 		{
 			/* (i,j+1) exists */
 			/* (i,j+1) exists */
-			starpu_tag_declare_deps(TAG(i,j,iter), 1, TAG(i-1,j+1,iter));
+			starpu_tag_declare_deps(TAG(i,j,piter), 1, TAG(i-1,j+1,piter));
 		}
 		}
 		else
 		else
 		{
 		{
@@ -229,8 +229,8 @@ int main(int argc __attribute__((unused)) , char **argv __attribute__((unused)))
 	if (ret == 0)
 	if (ret == 0)
 	     starpu_task_wait_for_all();
 	     starpu_task_wait_for_all();
 
 
-	tag_cleanup_grid(ni, nj, nk-2);
-	tag_cleanup_grid(ni, nj, nk-1);
+	tag_cleanup_grid(nk-2);
+	tag_cleanup_grid(nk-1);
 
 
 	starpu_shutdown();
 	starpu_shutdown();
 
 

+ 3 - 3
examples/tag_example/tag_example2.c

@@ -66,7 +66,7 @@ static void parse_args(int argc, char **argv)
 
 
 void callback_cpu(void *argcb);
 void callback_cpu(void *argcb);
 
 
-static void tag_cleanup_grid(unsigned ni, unsigned iter)
+static void tag_cleanup_grid(unsigned iter)
 {
 {
 	unsigned i;
 	unsigned i;
 
 
@@ -140,13 +140,13 @@ int main(int argc __attribute__((unused)) , char **argv __attribute__((unused)))
 
 
 		/* cleanup old grids ... */
 		/* cleanup old grids ... */
 		if (i > 1)
 		if (i > 1)
-			tag_cleanup_grid(ni, i-1);
+			tag_cleanup_grid(i-1);
 	}
 	}
 
 
 	starpu_task_wait_for_all();
 	starpu_task_wait_for_all();
 
 
 enodev:
 enodev:
-	tag_cleanup_grid(ni, nk-1);
+	tag_cleanup_grid(nk-1);
 
 
 	starpu_shutdown();
 	starpu_shutdown();
 
 

+ 2 - 2
examples/tag_example/tag_example3.c

@@ -68,7 +68,7 @@ static void parse_args(int argc, char **argv)
 
 
 void callback_cpu(void *argcb);
 void callback_cpu(void *argcb);
 
 
-static void tag_cleanup_grid(unsigned ni, unsigned iter)
+static void tag_cleanup_grid(unsigned iter)
 {
 {
 	unsigned i;
 	unsigned i;
 
 
@@ -142,7 +142,7 @@ int main(int argc __attribute__((unused)) , char **argv __attribute__((unused)))
 
 
 		/* cleanup old grids ... */
 		/* cleanup old grids ... */
 		if (i > 1)
 		if (i > 1)
-			tag_cleanup_grid(ni, i-1);
+			tag_cleanup_grid(i-1);
 	}
 	}
 
 
 enodev:
 enodev: