Prechádzať zdrojové kódy

examples/: do not display messages when environment variable STARPU_SSILENT is set

Nathalie Furmento 14 rokov pred
rodič
commit
d6c6d3663f
46 zmenil súbory, kde vykonal 366 pridanie a 315 odobranie
  1. 7 5
      examples/axpy/axpy.c
  2. 7 5
      examples/basic_examples/block.c
  3. 5 3
      examples/basic_examples/hello_world.c
  4. 4 2
      examples/basic_examples/variable.c
  5. 4 3
      examples/basic_examples/vector_scal.c
  6. 3 1
      examples/callback/callback.c
  7. 15 12
      examples/cg/cg.c
  8. 2 1
      examples/cholesky/cholesky.h
  9. 20 20
      examples/cholesky/cholesky_grain_tag.c
  10. 17 17
      examples/cholesky/cholesky_implicit.c
  11. 7 7
      examples/cholesky/cholesky_models.c
  12. 23 23
      examples/cholesky/cholesky_tag.c
  13. 7 7
      examples/cholesky/cholesky_tile_tag.c
  14. 14 12
      examples/filters/fblock.c
  15. 11 9
      examples/filters/fmatrix.c
  16. 9 7
      examples/filters/fvector.c
  17. 9 9
      examples/heat/dw_factolu.c
  18. 24 22
      examples/heat/dw_factolu.h
  19. 9 9
      examples/heat/dw_factolu_grain.c
  20. 13 13
      examples/heat/dw_factolu_kernels.c
  21. 5 5
      examples/heat/dw_factolu_tag.c
  22. 7 6
      examples/heat/dw_sparse_cg.c
  23. 5 5
      examples/heat/heat.c
  24. 3 1
      examples/heat/heat.h
  25. 2 2
      examples/heat/heat_display.c
  26. 5 4
      examples/incrementer/incrementer.c
  27. 16 14
      examples/lu/lu_example.c
  28. 5 5
      examples/lu/xlu.c
  29. 4 2
      examples/lu/xlu.h
  30. 4 4
      examples/lu/xlu_implicit.c
  31. 7 7
      examples/lu/xlu_implicit_pivot.c
  32. 8 8
      examples/lu/xlu_pivot.c
  33. 7 5
      examples/matvecmult/matvecmult.c
  34. 8 6
      examples/mult/xgemm.c
  35. 7 5
      examples/pi/pi.c
  36. 5 4
      examples/pi/pi_redux.c
  37. 10 8
      examples/profiling/profiling.c
  38. 4 2
      examples/reductions/dot_product.c
  39. 5 3
      examples/reductions/minmax_reduction.c
  40. 4 3
      examples/scheduler/dummy_sched.c
  41. 7 6
      examples/spmv/dw_block_spmv.c
  42. 7 6
      examples/spmv/dw_spmv.c
  43. 5 4
      examples/tag_example/tag_example.c
  44. 5 4
      examples/tag_example/tag_example2.c
  45. 5 4
      examples/tag_example/tag_example3.c
  46. 6 5
      examples/tag_example/tag_restartable.c

+ 7 - 5
examples/axpy/axpy.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -36,6 +36,8 @@
 
 #define NBLOCKS	8
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 TYPE *vec_x, *vec_y;
 
 /* descriptors for StarPU */
@@ -106,8 +108,8 @@ int main(int argc, char **argv)
 		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 */
 	starpu_vector_data_register(&handle_x, 0, (uintptr_t)vec_x, N, sizeof(TYPE));
@@ -158,9 +160,9 @@ int main(int argc, char **argv)
         double timing = (double)((end.tv_sec - start.tv_sec)*1000000 +
                                         (end.tv_usec - start.tv_usec));
 
-	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);
 
 	/* Stop StarPU */
 	starpu_shutdown();

+ 7 - 5
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  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -20,6 +20,8 @@
 #include <pthread.h>
 #include <math.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 extern void cpu_codelet(void *descr[], void *_args);
 #ifdef STARPU_USE_CUDA
 extern void cuda_codelet(void *descr[], void *_args);
@@ -55,7 +57,7 @@ int execute_on(uint32_t where, device_func func, float *block, int pnx, int pny,
 
         int ret = starpu_task_submit(task);
         if (STARPU_UNLIKELY(ret == -ENODEV)) {
-                fprintf(stderr, "No worker may execute this task\n");
+                FPRINTF(stderr, "No worker may execute this task\n");
                 return 1;
 	}
 
@@ -65,9 +67,9 @@ int execute_on(uint32_t where, device_func func, float *block, int pnx, int pny,
         starpu_data_acquire(block_handle, STARPU_R);
 
         for(i=0 ; i<pnx*pny*pnz; i++) {
-          fprintf(stderr, "%f ", block[i]);
+          FPRINTF(stderr, "%f ", block[i]);
         }
-        fprintf(stderr, "\n");
+        FPRINTF(stderr, "\n");
 
         starpu_data_release(block_handle);
 
@@ -116,7 +118,7 @@ int main(int argc, char **argv)
           }
         }
 
-        fprintf(stderr,"TEST %s\n", ret==1?"PASSED":"FAILED");
+        FPRINTF(stderr,"TEST %s\n", ret==1?"PASSED":"FAILED");
         starpu_shutdown();
 
 	return 0;

+ 5 - 3
examples/basic_examples/hello_world.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -31,12 +31,14 @@
 #include <stdint.h>
 #include <starpu.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 /* When the task is done, task->callback_func(task->callback_arg) is called. Any
  * callback function must have the prototype void (*)(void *).
  * NB: Callback are NOT allowed to perform potentially blocking operations */
 void callback_func(void *callback_arg)
 {
-	printf("Callback function got argument %p\n", callback_arg);
+        FPRINTF(stdout, "Callback function got argument %p\n", callback_arg);
 }
 
 /* Every implementation of a codelet must have this prototype, the first
@@ -52,7 +54,7 @@ void cpu_func(void *buffers[], void *cl_arg)
 {
 	struct params *params = cl_arg;
 
-	printf("Hello world (params = {%i, %f} )\n", params->i, params->f);
+	FPRINTF(stdout, "Hello world (params = {%i, %f} )\n", params->i, params->f);
 }
 
 starpu_codelet cl =

+ 4 - 2
examples/basic_examples/variable.c

@@ -18,6 +18,8 @@
 #include <starpu.h>
 #include <pthread.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 static unsigned niter = 50000;
 
 extern void cpu_codelet(void *descr[], __attribute__ ((unused)) void *_args);
@@ -77,7 +79,7 @@ int main(int argc, char **argv)
 		ret = starpu_task_submit(task);
 		if (STARPU_UNLIKELY(ret == -ENODEV))
 		{
-			fprintf(stderr, "No worker may execute this task\n");
+			FPRINTF(stderr, "No worker may execute this task\n");
 			exit(0);
 		}
 	}
@@ -87,7 +89,7 @@ int main(int argc, char **argv)
 	/* update the array in RAM */
 	starpu_data_acquire(float_array_handle, STARPU_R);
 
-	fprintf(stderr, "variable -> %f\n", foo);
+	FPRINTF(stderr, "variable -> %f\n", foo);
 
 	starpu_data_release(float_array_handle);
 

+ 4 - 3
examples/basic_examples/vector_scal.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -28,6 +28,7 @@
 #include <stdio.h>
 
 #define	NX	2048
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 extern void scal_cpu_func(void *buffers[], void *_args);
 extern void scal_cuda_func(void *buffers[], void *_args);
@@ -73,7 +74,7 @@ int main(int argc, char **argv)
 	for (i = 0; i < NX; i++)
 		vector[i] = 1.0f;
 
-	fprintf(stderr, "BEFORE : First element was %f\n", vector[0]);
+	FPRINTF(stderr, "BEFORE : First element was %f\n", vector[0]);
 
 	/* Initialize StarPU with default configuration */
 	starpu_init(NULL);
@@ -132,7 +133,7 @@ int main(int argc, char **argv)
 	/* terminate StarPU, no task can be submitted after */
 	starpu_shutdown();
 
-	fprintf(stderr, "AFTER First element is %f\n", vector[0]);
+	FPRINTF(stderr, "AFTER First element is %f\n", vector[0]);
 
 	return 0;
 }

+ 3 - 1
examples/callback/callback.c

@@ -19,6 +19,8 @@
 #include <pthread.h>
 #include <sys/time.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 starpu_data_handle handle;
 
 void cpu_codelet(void *descr[], __attribute__ ((unused)) void *_args)
@@ -62,7 +64,7 @@ int main(int argc, char **argv)
 
 	starpu_task_wait_for_all();
 
-	fprintf(stderr, "v -> %d\n", v);
+	FPRINTF(stderr, "v -> %d\n", v);
 
 	starpu_shutdown();
 

+ 15 - 12
examples/cg/cg.c

@@ -13,6 +13,7 @@
  *
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
+
 #include <math.h>
 #include <assert.h>
 #include <sys/time.h>
@@ -24,6 +25,8 @@
 #include <cublas.h>
 #endif
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 /*
  *	Conjugate Gradient
  *
@@ -201,12 +204,12 @@ static void display_vector(starpu_data_handle handle, TYPE *ptr)
 		starpu_data_acquire(starpu_data_get_sub_data(handle, 1, b), STARPU_R);
 		for (ind = 0; ind < block_size; ind++)
 		{
-			fprintf(stderr, "%2.2e ", ptr[b*block_size + ind]);
+			FPRINTF(stderr, "%2.2e ", ptr[b*block_size + ind]);
 		}
-		fprintf(stderr, "| ");
+		FPRINTF(stderr, "| ");
 		starpu_data_release(starpu_data_get_sub_data(handle, 1, b));
 	}
-	fprintf(stderr, "\n");
+	FPRINTF(stderr, "\n");
 }
 
 static void display_matrix(void)
@@ -216,9 +219,9 @@ static void display_matrix(void)
 	{
 		for (j = 0; j < n; j++)
 		{
-			fprintf(stderr, "%2.2e ", A[j*n + i]);
+			FPRINTF(stderr, "%2.2e ", A[j*n + i]);
 		}
-		fprintf(stderr, "\n");
+		FPRINTF(stderr, "\n");
 	}
 }
 #endif
@@ -251,8 +254,8 @@ static void cg(void)
 	delta_0 = delta_new;
 	starpu_data_release(rtr_handle);
 
-	fprintf(stderr, "*************** INITIAL ************ \n");
-	fprintf(stderr, "Delta 0: %e\n", delta_new);
+	FPRINTF(stderr, "*************** INITIAL ************ \n");
+	FPRINTF(stderr, "Delta 0: %e\n", delta_new);
 
 	struct timeval start;
 	struct timeval end;
@@ -303,8 +306,8 @@ static void cg(void)
 		{
 			/* We here take the error as ||r||_2 / (n||b||_2) */
 			double error = sqrt(delta_new/delta_0)/(1.0*n);
-			fprintf(stderr, "*****************************************\n");
-			fprintf(stderr, "iter %d DELTA %e - %e\n", i, delta_new, error);
+			FPRINTF(stderr, "*****************************************\n");
+			FPRINTF(stderr, "iter %d DELTA %e - %e\n", i, delta_new, error);
 		}
 
 		i++;
@@ -313,8 +316,8 @@ static void cg(void)
 	gettimeofday(&end, NULL);
 
 	double timing = (double)(((double)end.tv_sec - (double)start.tv_sec)*10e6 + ((double)end.tv_usec - (double)start.tv_usec));
-	fprintf(stderr, "Total timing : %2.2f seconds\n", timing/10e6);
-	fprintf(stderr, "Seconds per iteration : %2.2e\n", timing/10e6/i);
+	FPRINTF(stderr, "Total timing : %2.2f seconds\n", timing/10e6);
+	FPRINTF(stderr, "Seconds per iteration : %2.2e\n", timing/10e6/i);
 }
 
 static int check(void)
@@ -347,7 +350,7 @@ static void parse_args(int argc, char **argv)
 		}
 
 	        if (strcmp(argv[i], "-h") == 0) {
-			fprintf(stderr, "usage: %s [-h] [-nblocks #blocks] [-n problem_size] [-no-reduction] [-maxiter i]\n", argv[0]);
+			FPRINTF(stderr, "usage: %s [-h] [-nblocks #blocks] [-n problem_size] [-no-reduction] [-maxiter i]\n", argv[0]);
 			exit(-1);
 			continue;
 		}

+ 2 - 1
examples/cholesky/cholesky.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010, 2011  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -31,6 +31,7 @@
 #include <common/blas.h>
 #include <starpu.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 #define NMAXBLOCKS	32
 
 #define TAG11(k)	((starpu_tag_t)( (1ULL<<60) | (unsigned long long)(k)))

+ 20 - 20
examples/cholesky/cholesky_grain_tag.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  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -49,7 +49,7 @@ static starpu_codelet cl11 =
 
 static struct starpu_task * create_task_11(starpu_data_handle dataA, unsigned k, unsigned reclevel)
 {
-//	printf("task 11 k = %d TAG = %llx\n", k, (TAG11(k)));
+//	FPRINTF(stdout, "task 11 k = %d TAG = %llx\n", k, (TAG11(k)));
 
 	struct starpu_task *task = create_task(TAG11_AUX(k, reclevel));
 	
@@ -121,7 +121,7 @@ static starpu_codelet cl22 =
 
 static void create_task_22(starpu_data_handle dataA, unsigned k, unsigned i, unsigned j, unsigned reclevel)
 {
-//	printf("task 22 k,i,j = %d,%d,%d TAG = %llx\n", k,i,j, TAG22_AUX(k,i,j));
+//	FPRINTF(stdout, "task 22 k,i,j = %d,%d,%d TAG = %llx\n", k,i,j, TAG22_AUX(k,i,j));
 
 	struct starpu_task *task = create_task(TAG22_AUX(k, i, j, reclevel));
 
@@ -214,7 +214,7 @@ static void cholesky_grain_rec(float *matA, unsigned size, unsigned ld, unsigned
 	int ret = starpu_task_submit(entry_task);
 	if (STARPU_UNLIKELY(ret == -ENODEV))
 	{
-		fprintf(stderr, "No worker may execute this task\n");
+		FPRINTF(stderr, "No worker may execute this task\n");
 		exit(-1);
 	}
 
@@ -280,11 +280,11 @@ void cholesky_grain(float *matA, unsigned size, unsigned ld, unsigned nblocks, u
 	gettimeofday(&end, NULL);
 
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
-	fprintf(stderr, "Computation took (in ms)\n");
-	printf("%2.2f\n", timing/1000);
+	FPRINTF(stderr, "Computation took (in ms)\n");
+	FPRINTF(stdout, "%2.2f\n", timing/1000);
 
 	double flop = (1.0f*size*size*size)/3.0f;
-	fprintf(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
 
 	starpu_helper_cublas_shutdown();
 
@@ -317,20 +317,20 @@ int main(int argc, char **argv)
 
 
 #ifdef CHECK_OUTPUT
-	printf("Input :\n");
+	FPRINTF(stdout, "Input :\n");
 
 	for (j = 0; j < size; j++)
 	{
 		for (i = 0; i < size; i++)
 		{
 			if (i <= j) {
-				printf("%2.2f\t", mat[j +i*size]);
+				FPRINTF(stdout, "%2.2f\t", mat[j +i*size]);
 			}
 			else {
-				printf(".\t");
+				FPRINTF(stdout, ".\t");
 			}
 		}
-		printf("\n");
+		FPRINTF(stdout, "\n");
 	}
 #endif
 
@@ -338,43 +338,43 @@ int main(int argc, char **argv)
 	cholesky_grain(mat, size, size, nblocks, nbigblocks);
 
 #ifdef CHECK_OUTPUT
-	printf("Results :\n");
+	FPRINTF(stdout, "Results :\n");
 
 	for (j = 0; j < size; j++)
 	{
 		for (i = 0; i < size; i++)
 		{
 			if (i <= j) {
-				printf("%2.2f\t", mat[j +i*size]);
+				FPRINTF(stdout, "%2.2f\t", mat[j +i*size]);
 			}
 			else {
-				printf(".\t");
+				FPRINTF(stdout, ".\t");
 				mat[j+i*size] = 0.0f; // debug
 			}
 		}
-		printf("\n");
+		FPRINTF(stdout, "\n");
 	}
 
-	fprintf(stderr, "compute explicit LLt ...\n");
+	FPRINTF(stderr, "compute explicit LLt ...\n");
 	float *test_mat = malloc(size*size*sizeof(float));
 	STARPU_ASSERT(test_mat);
 
 	SSYRK("L", "N", size, size, 1.0f, 
 				mat, size, 0.0f, test_mat, size);
 
-	fprintf(stderr, "comparing results ...\n");
+	FPRINTF(stderr, "comparing results ...\n");
 	for (j = 0; j < size; j++)
 	{
 		for (i = 0; i < size; i++)
 		{
 			if (i <= j) {
-				printf("%2.2f\t", test_mat[j +i*size]);
+                                FPRINTF(stdout, "%2.2f\t", test_mat[j +i*size]);
 			}
 			else {
-				printf(".\t");
+				FPRINTF(stdout, ".\t");
 			}
 		}
-		printf("\n");
+		FPRINTF(stdout, "\n");
 	}
 #endif
 

+ 17 - 17
examples/cholesky/cholesky_implicit.c

@@ -126,13 +126,13 @@ static void _cholesky(starpu_data_handle dataA, unsigned nblocks)
 	gettimeofday(&end, NULL);
 
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
-	fprintf(stderr, "Computation took (in ms)\n");
-	printf("%2.2f\n", timing/1000);
+	FPRINTF(stderr, "Computation took (in ms)\n");
+	FPRINTF(stdout, "%2.2f\n", timing/1000);
 
 	unsigned long n = starpu_matrix_get_nx(dataA);
 
 	double flop = (1.0f*n*n*n)/3.0f;
-	fprintf(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
 }
 
 static void cholesky(float *matA, unsigned size, unsigned ld, unsigned nblocks)
@@ -188,46 +188,46 @@ int main(int argc, char **argv)
 
 //#define PRINT_OUTPUT
 #ifdef PRINT_OUTPUT
-	printf("Input :\n");
+	FPRINTF(stdout, "Input :\n");
 
 	for (j = 0; j < size; j++)
 	{
 		for (i = 0; i < size; i++)
 		{
 			if (i <= j) {
-				printf("%2.2f\t", mat[j +i*size]);
+				FPRINTF(stdout, "%2.2f\t", mat[j +i*size]);
 			}
 			else {
-				printf(".\t");
+				FPRINTF(stdout, ".\t");
 			}
 		}
-		printf("\n");
+		FPRINTF(stdout, "\n");
 	}
 #endif
 
 	cholesky(mat, size, size, nblocks);
 
 #ifdef PRINT_OUTPUT
-	printf("Results :\n");
+	FPRINTF(stdout, "Results :\n");
 	for (j = 0; j < size; j++)
 	{
 		for (i = 0; i < size; i++)
 		{
 			if (i <= j) {
-				printf("%2.2f\t", mat[j +i*size]);
+				FPRINTF(stdout, "%2.2f\t", mat[j +i*size]);
 			}
 			else {
-				printf(".\t");
+				FPRINTF(stdout, ".\t");
 				mat[j+i*size] = 0.0f; // debug
 			}
 		}
-		printf("\n");
+		FPRINTF(stdout, "\n");
 	}
 #endif
 
 	if (check)
 	{
-		fprintf(stderr, "compute explicit LLt ...\n");
+		FPRINTF(stderr, "compute explicit LLt ...\n");
 		for (j = 0; j < size; j++)
 		{
 			for (i = 0; i < size; i++)
@@ -243,20 +243,20 @@ int main(int argc, char **argv)
 		SSYRK("L", "N", size, size, 1.0f,
 					mat, size, 0.0f, test_mat, size);
 	
-		fprintf(stderr, "comparing results ...\n");
+		FPRINTF(stderr, "comparing results ...\n");
 #ifdef PRINT_OUTPUT
 		for (j = 0; j < size; j++)
 		{
 			for (i = 0; i < size; i++)
 			{
 				if (i <= j) {
-					printf("%2.2f\t", test_mat[j +i*size]);
+					FPRINTF(stdout, "%2.2f\t", test_mat[j +i*size]);
 				}
 				else {
-					printf(".\t");
+					FPRINTF(stdout, ".\t");
 				}
 			}
-			printf("\n");
+			FPRINTF(stdout, "\n");
 		}
 #endif
 	
@@ -268,7 +268,7 @@ int main(int argc, char **argv)
 	                                float orig = (1.0f/(1.0f+i+j)) + ((i == j)?1.0f*size:0.0f);
 	                                float err = abs(test_mat[j +i*size] - orig);
 	                                if (err > 0.00001) {
-	                                        fprintf(stderr, "Error[%d, %d] --> %2.2f != %2.2f (err %2.2f)\n", i, j, test_mat[j +i*size], orig, err);
+	                                        FPRINTF(stderr, "Error[%d, %d] --> %2.2f != %2.2f (err %2.2f)\n", i, j, test_mat[j +i*size], orig, err);
 	                                        assert(0);
 	                                }
 	                        }

+ 7 - 7
examples/cholesky/cholesky_models.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -43,7 +43,7 @@ static double cpu_chol_task_11_cost(starpu_buffer_descr *descr)
 	double cost = (((double)(n)*n*n)/1000.0f*0.894/0.79176);
 
 #ifdef STARPU_MODEL_DEBUG
-	printf("cpu_chol_task_11_cost n %d cost %e\n", n, cost);
+	FPRINTF(stdout, "cpu_chol_task_11_cost n %d cost %e\n", n, cost);
 #endif
 
 	return PERTURBATE(cost);
@@ -58,7 +58,7 @@ static double cuda_chol_task_11_cost(starpu_buffer_descr *descr)
 	double cost = (((double)(n)*n*n)/50.0f/10.75/5.088633/0.9883);
 
 #ifdef STARPU_MODEL_DEBUG
-	printf("cuda_chol_task_11_cost n %d cost %e\n", n, cost);
+	FPRINTF(stdout, "cuda_chol_task_11_cost n %d cost %e\n", n, cost);
 #endif
 
 	return PERTURBATE(cost);
@@ -73,7 +73,7 @@ static double cpu_chol_task_21_cost(starpu_buffer_descr *descr)
 	double cost = (((double)(n)*n*n)/7706.674/0.95/0.9965);
 
 #ifdef STARPU_MODEL_DEBUG
-	printf("cpu_chol_task_21_cost n %d cost %e\n", n, cost);
+	FPRINTF(stdout, "cpu_chol_task_21_cost n %d cost %e\n", n, cost);
 #endif
 
 	return PERTURBATE(cost);
@@ -88,7 +88,7 @@ static double cuda_chol_task_21_cost(starpu_buffer_descr *descr)
 	double cost = (((double)(n)*n*n)/50.0f/10.75/87.29520);
 
 #ifdef STARPU_MODEL_DEBUG
-	printf("cuda_chol_task_21_cost n %d cost %e\n", n, cost);
+	FPRINTF(stdout, "cuda_chol_task_21_cost n %d cost %e\n", n, cost);
 #endif
 
 	return PERTURBATE(cost);
@@ -103,7 +103,7 @@ static double cpu_chol_task_22_cost(starpu_buffer_descr *descr)
 	double cost = (((double)(n)*n*n)/50.0f/10.75/8.0760);
 
 #ifdef STARPU_MODEL_DEBUG
-	printf("cpu_chol_task_22_cost n %d cost %e\n", n, cost);
+	FPRINTF(stdout, "cpu_chol_task_22_cost n %d cost %e\n", n, cost);
 #endif
 
 	return PERTURBATE(cost);
@@ -118,7 +118,7 @@ static double cuda_chol_task_22_cost(starpu_buffer_descr *descr)
 	double cost = (((double)(n)*n*n)/50.0f/10.75/76.30666);
 
 #ifdef STARPU_MODEL_DEBUG
-	printf("cuda_chol_task_22_cost n %d cost %e\n", n, cost);
+	FPRINTF(stdout, "cuda_chol_task_22_cost n %d cost %e\n", n, cost);
 #endif
 
 	return PERTURBATE(cost);

+ 23 - 23
examples/cholesky/cholesky_tag.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  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -49,7 +49,7 @@ static starpu_codelet cl11 =
 
 static struct starpu_task * create_task_11(starpu_data_handle dataA, unsigned k)
 {
-//	printf("task 11 k = %d TAG = %llx\n", k, (TAG11(k)));
+//	FPRINTF(stdout, "task 11 k = %d TAG = %llx\n", k, (TAG11(k)));
 
 	struct starpu_task *task = create_task(TAG11(k));
 	
@@ -108,7 +108,7 @@ static void create_task_21(starpu_data_handle dataA, unsigned k, unsigned j)
 
 	int ret = starpu_task_submit(task);
         if (STARPU_UNLIKELY(ret == -ENODEV)) {
-                fprintf(stderr, "No worker may execute this task\n");
+                FPRINTF(stderr, "No worker may execute this task\n");
                 exit(0);
         }
 
@@ -127,7 +127,7 @@ static starpu_codelet cl22 =
 
 static void create_task_22(starpu_data_handle dataA, unsigned k, unsigned i, unsigned j)
 {
-//	printf("task 22 k,i,j = %d,%d,%d TAG = %llx\n", k,i,j, TAG22(k,i,j));
+//	FPRINTF(stdout, "task 22 k,i,j = %d,%d,%d TAG = %llx\n", k,i,j, TAG22(k,i,j));
 
 	struct starpu_task *task = create_task(TAG22(k, i, j));
 
@@ -155,7 +155,7 @@ static void create_task_22(starpu_data_handle dataA, unsigned k, unsigned i, uns
 
 	int ret = starpu_task_submit(task);
         if (STARPU_UNLIKELY(ret == -ENODEV)) {
-                fprintf(stderr, "No worker may execute this task\n");
+                FPRINTF(stderr, "No worker may execute this task\n");
                 exit(0);
         }
 }
@@ -189,7 +189,7 @@ static void _cholesky(starpu_data_handle dataA, unsigned nblocks)
 		else {
 			int ret = starpu_task_submit(task);
                         if (STARPU_UNLIKELY(ret == -ENODEV)) {
-                                fprintf(stderr, "No worker may execute this task\n");
+                                FPRINTF(stderr, "No worker may execute this task\n");
                                 exit(0);
                         }
 
@@ -210,7 +210,7 @@ static void _cholesky(starpu_data_handle dataA, unsigned nblocks)
 	/* schedule the codelet */
 	int ret = starpu_task_submit(entry_task);
         if (STARPU_UNLIKELY(ret == -ENODEV)) {
-                fprintf(stderr, "No worker may execute this task\n");
+                FPRINTF(stderr, "No worker may execute this task\n");
                 exit(0);
         }
 
@@ -224,13 +224,13 @@ static void _cholesky(starpu_data_handle dataA, unsigned nblocks)
 
 
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
-	fprintf(stderr, "Computation took (in ms)\n");
-	printf("%2.2f\n", timing/1000);
+	FPRINTF(stderr, "Computation took (in ms)\n");
+	FPRINTF(stdout, "%2.2f\n", timing/1000);
 
 	unsigned n = starpu_matrix_get_nx(dataA);
 
 	double flop = (1.0f*n*n*n)/3.0f;
-	fprintf(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
 }
 
 static void initialize_system(float **A, unsigned dim, unsigned pinned)
@@ -305,20 +305,20 @@ int main(int argc, char **argv)
 
 
 #ifdef CHECK_OUTPUT
-	printf("Input :\n");
+	FPRINTF(stdout, "Input :\n");
 
 	for (j = 0; j < size; j++)
 	{
 		for (i = 0; i < size; i++)
 		{
 			if (i <= j) {
-				printf("%2.2f\t", mat[j +i*size]);
+				FPRINTF(stdout, "%2.2f\t", mat[j +i*size]);
 			}
 			else {
-				printf(".\t");
+				FPRINTF(stdout, ".\t");
 			}
 		}
-		printf("\n");
+		FPRINTF(stdout, "\n");
 	}
 #endif
 
@@ -326,43 +326,43 @@ int main(int argc, char **argv)
 	cholesky(mat, size, size, nblocks);
 
 #ifdef CHECK_OUTPUT
-	printf("Results :\n");
+	FPRINTF(stdout, "Results :\n");
 
 	for (j = 0; j < size; j++)
 	{
 		for (i = 0; i < size; i++)
 		{
 			if (i <= j) {
-				printf("%2.2f\t", mat[j +i*size]);
+				FPRINTF(stdout, "%2.2f\t", mat[j +i*size]);
 			}
 			else {
-				printf(".\t");
+				FPRINTF(stdout, ".\t");
 				mat[j+i*size] = 0.0f; // debug
 			}
 		}
-		printf("\n");
+		FPRINTF(stdout, "\n");
 	}
 
-	fprintf(stderr, "compute explicit LLt ...\n");
+	FPRINTF(stderr, "compute explicit LLt ...\n");
 	float *test_mat = malloc(size*size*sizeof(float));
 	STARPU_ASSERT(test_mat);
 
 	SSYRK("L", "N", size, size, 1.0f, 
 				mat, size, 0.0f, test_mat, size);
 
-	fprintf(stderr, "comparing results ...\n");
+	FPRINTF(stderr, "comparing results ...\n");
 	for (j = 0; j < size; j++)
 	{
 		for (i = 0; i < size; i++)
 		{
 			if (i <= j) {
-				printf("%2.2f\t", test_mat[j +i*size]);
+				FPRINTF(stdout, "%2.2f\t", test_mat[j +i*size]);
 			}
 			else {
-				printf(".\t");
+				FPRINTF(stdout, ".\t");
 			}
 		}
-		printf("\n");
+		FPRINTF(stdout, "\n");
 	}
 #endif
 

+ 7 - 7
examples/cholesky/cholesky_tile_tag.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010, 2011  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -59,7 +59,7 @@ static starpu_codelet cl11 =
 
 static struct starpu_task * create_task_11(unsigned k, unsigned nblocks)
 {
-//	printf("task 11 k = %d TAG = %llx\n", k, (TAG11(k)));
+//	FPRINTF(stdout, "task 11 k = %d TAG = %llx\n", k, (TAG11(k)));
 
 	struct starpu_task *task = create_task(TAG11(k));
 	
@@ -145,7 +145,7 @@ static starpu_codelet cl22 =
 
 static void create_task_22(unsigned k, unsigned i, unsigned j)
 {
-//	printf("task 22 k,i,j = %d,%d,%d TAG = %llx\n", k,i,j, TAG22(k,i,j));
+//	FPRINTF(stdout, "task 22 k,i,j = %d,%d,%d TAG = %llx\n", k,i,j, TAG22(k,i,j));
 
 	struct starpu_task *task = create_task(TAG22(k, i, j));
 
@@ -224,11 +224,11 @@ static void cholesky_no_stride(void)
 	gettimeofday(&end, NULL);
 
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
-	fprintf(stderr, "Computation took (in ms)\n");
-	printf("%2.2f\n", timing/1000);
+	FPRINTF(stderr, "Computation took (in ms)\n");
+	FPRINTF(stdout, "%2.2f\n", timing/1000);
 
 	double flop = (1.0f*size*size*size)/3.0f;
-	fprintf(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
 }
 
 int main(int argc, char **argv)
@@ -239,7 +239,7 @@ int main(int argc, char **argv)
 	parse_args(argc, argv);
 	assert(nblocks <= NMAXBLOCKS);
 
-	fprintf(stderr, "BLOCK SIZE = %d\n", size / nblocks);
+	FPRINTF(stderr, "BLOCK SIZE = %d\n", size / nblocks);
 
 	starpu_init(NULL);
 

+ 14 - 12
examples/filters/fblock.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -23,6 +23,8 @@
 #define NZ    3
 #define PARTS 2
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 extern void cpu_func(void *buffers[], void *cl_arg);
 
 #ifdef STARPU_USE_CUDA
@@ -36,17 +38,17 @@ extern void opencl_func(void *buffers[], void *cl_arg);
 void print_block(int *block, int nx, int ny, int nz, unsigned ldy, unsigned ldz)
 {
         int i, j, k;
-        fprintf(stderr, "block=%p nx=%d ny=%d nz=%d ldy=%d ldz=%d\n", block, nx, ny, nz, ldy, ldz);
+        FPRINTF(stderr, "block=%p nx=%d ny=%d nz=%d ldy=%d ldz=%d\n", block, nx, ny, nz, ldy, ldz);
         for(k=0 ; k<nz ; k++) {
                 for(j=0 ; j<ny ; j++) {
                         for(i=0 ; i<nx ; i++) {
-                                fprintf(stderr, "%2d ", block[(k*ldz)+(j*ldy)+i]);
+                                FPRINTF(stderr, "%2d ", block[(k*ldz)+(j*ldy)+i]);
                         }
-                        fprintf(stderr,"\n");
+                        FPRINTF(stderr,"\n");
                 }
-                fprintf(stderr,"\n");
+                FPRINTF(stderr,"\n");
         }
-        fprintf(stderr,"\n");
+        FPRINTF(stderr,"\n");
 }
 
 void print_data(starpu_data_handle block_handle)
@@ -101,7 +103,7 @@ int main(int argc, char **argv)
 
         /* Declare data to StarPU */
         starpu_block_data_register(&handle, 0, (uintptr_t)block, NX, NX*NY, NX, NY, NZ, sizeof(int));
-        fprintf(stderr, "IN  Block\n");
+        FPRINTF(stderr, "IN  Block\n");
         print_data(handle);
 
         /* Partition the block in PARTS sub-blocks */
@@ -114,12 +116,12 @@ int main(int argc, char **argv)
 	};
         starpu_data_partition(handle, &f);
 
-        fprintf(stderr,"Nb of partitions : %d\n",starpu_data_get_nb_children(handle));
+        FPRINTF(stderr,"Nb of partitions : %d\n",starpu_data_get_nb_children(handle));
 
         for(i=0 ; i<starpu_data_get_nb_children(handle) ; i++)
         {
                 starpu_data_handle sblock = starpu_data_get_sub_data(handle, 1, i);
-                fprintf(stderr, "Sub block %d\n", i);
+                FPRINTF(stderr, "Sub block %d\n", i);
                 print_data(sblock);
         }
 
@@ -129,7 +131,7 @@ int main(int argc, char **argv)
                 int ret,multiplier=i;
                 struct starpu_task *task = starpu_task_create();
 
-                fprintf(stderr,"Dealing with sub-block %d\n", i);
+                FPRINTF(stderr,"Dealing with sub-block %d\n", i);
                 task->cl = &cl;
                 task->synchronous = 1;
                 task->callback_func = NULL;
@@ -139,7 +141,7 @@ int main(int argc, char **argv)
 
                 ret = starpu_task_submit(task);
                 if (ret) {
-                        fprintf(stderr, "Error when submitting task\n");
+                        FPRINTF(stderr, "Error when submitting task\n");
                         exit(ret);
                 }
         }
@@ -150,7 +152,7 @@ int main(int argc, char **argv)
         starpu_data_unregister(handle);
 
         /* Print result block */
-        fprintf(stderr, "OUT Block\n");
+        FPRINTF(stderr, "OUT Block\n");
         print_block(block, NX, NY, NZ, NX, NX*NY);
 
 	starpu_shutdown();

+ 11 - 9
examples/filters/fmatrix.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -20,6 +20,8 @@
 #define NY    4
 #define PARTS 2
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 void cpu_func(void *buffers[], void *cl_arg)
 {
         unsigned i, j;
@@ -43,15 +45,15 @@ int main(int argc, char **argv)
 	unsigned i, j, n=1;
         int matrix[NX*NY];
 
-        fprintf(stderr,"IN  Matrix: \n");
+        FPRINTF(stderr,"IN  Matrix: \n");
         for(j=0 ; j<NY ; j++) {
                 for(i=0 ; i<NX ; i++) {
                         matrix[(j*NX)+i] = n++;
-                        fprintf(stderr, "%2d ", matrix[(j*NX)+i]);
+                        FPRINTF(stderr, "%2d ", matrix[(j*NX)+i]);
                 }
-                fprintf(stderr,"\n");
+                FPRINTF(stderr,"\n");
         }
-        fprintf(stderr,"\n");
+        FPRINTF(stderr,"\n");
 
         starpu_data_handle handle;
         starpu_codelet cl = {
@@ -94,14 +96,14 @@ int main(int argc, char **argv)
 	starpu_shutdown();
 
         /* Print result matrix */
-        fprintf(stderr,"OUT Matrix: \n");
+        FPRINTF(stderr,"OUT Matrix: \n");
         for(j=0 ; j<NY ; j++) {
                 for(i=0 ; i<NX ; i++) {
-                        fprintf(stderr, "%2d ", matrix[(j*NX)+i]);
+                        FPRINTF(stderr, "%2d ", matrix[(j*NX)+i]);
                 }
-                fprintf(stderr,"\n");
+                FPRINTF(stderr,"\n");
         }
-        fprintf(stderr,"\n");
+        FPRINTF(stderr,"\n");
 
 	return 0;
 }

+ 9 - 7
examples/filters/fvector.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -19,6 +19,8 @@
 #define NX    21
 #define PARTS 3
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 void cpu_func(void *buffers[], void *cl_arg)
 {
         unsigned i;
@@ -47,9 +49,9 @@ int main(int argc, char **argv)
         };
 
         for(i=0 ; i<NX ; i++) vector[i] = i;
-        fprintf(stderr,"IN  Vector: ");
-        for(i=0 ; i<NX ; i++) fprintf(stderr, "%5d ", vector[i]);
-        fprintf(stderr,"\n");
+        FPRINTF(stderr,"IN  Vector: ");
+        for(i=0 ; i<NX ; i++) FPRINTF(stderr, "%5d ", vector[i]);
+        FPRINTF(stderr,"\n");
 
 	starpu_init(NULL);
 
@@ -87,9 +89,9 @@ int main(int argc, char **argv)
         starpu_data_unregister(handle);
 	starpu_shutdown();
 
-        fprintf(stderr,"OUT Vector: ");
-        for(i=0 ; i<NX ; i++) fprintf(stderr, "%5d ", vector[i]);
-        fprintf(stderr,"\n");
+        FPRINTF(stderr,"OUT Vector: ");
+        for(i=0 ; i<NX ; i++) FPRINTF(stderr, "%5d ", vector[i]);
+        FPRINTF(stderr,"\n");
 
 	return 0;
 }

+ 9 - 9
examples/heat/dw_factolu.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -624,12 +624,12 @@ void dw_codelet_facto(starpu_data_handle dataA, unsigned nblocks)
 	gettimeofday(&end, NULL);
 
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
-	fprintf(stderr, "Computation took (in ms)\n");
-	printf("%2.2f\n", timing/1000);
+	FPRINTF(stderr, "Computation took (in ms)\n");
+	FPRINTF(stdout, "%2.2f\n", timing/1000);
 
 	unsigned n = starpu_matrix_get_nx(dataA);
 	double flop = (2.0f*n*n*n)/3.0f;
-	fprintf(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
 }
 
 void dw_codelet_facto_v2(starpu_data_handle dataA, unsigned nblocks)
@@ -666,7 +666,7 @@ void dw_codelet_facto_v2(starpu_data_handle dataA, unsigned nblocks)
 	int ret = starpu_task_submit(task);
 	if (STARPU_UNLIKELY(ret == -ENODEV))
 	{
-		fprintf(stderr, "No worker may execute this task\n");
+		FPRINTF(stderr, "No worker may execute this task\n");
 		exit(0);
 	}
 
@@ -681,12 +681,12 @@ void dw_codelet_facto_v2(starpu_data_handle dataA, unsigned nblocks)
 	gettimeofday(&end, NULL);
 
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
-	fprintf(stderr, "Computation took (in ms)\n");
-	printf("%2.2f\n", timing/1000);
+	FPRINTF(stderr, "Computation took (in ms)\n");
+	FPRINTF(stdout, "%2.2f\n", timing/1000);
 
 	unsigned n = starpu_matrix_get_nx(dataA);
 	double flop = (2.0f*n*n*n)/3.0f;
-	fprintf(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
 }
 
 void initialize_system(float **A, float **B, unsigned dim, unsigned pinned)
@@ -714,7 +714,7 @@ void dw_factoLU(float *matA, unsigned size,
 {
 
 #ifdef CHECK_RESULTS
-	fprintf(stderr, "Checking results ...\n");
+	FPRINTF(stderr, "Checking results ...\n");
 	float *Asaved;
 	Asaved = malloc((size_t)ld*ld*sizeof(float));
 

+ 24 - 22
examples/heat/dw_factolu.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -36,6 +36,8 @@
 
 #include "lu_kernels_model.h"
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 #define BLAS3_FLOP(n1,n2,n3)    \
         (2*((uint64_t)n1)*((uint64_t)n2)*((uint64_t)n3))
 
@@ -82,53 +84,53 @@ static void __attribute__ ((unused)) compare_A_LU(float *A, float *LU,
 
 #if 0
 	/* display L */
-	printf("(LU): \n");
+	FPRINTF(stdout, "(LU): \n");
 	for (j = 0; j < size; j++)
 	{
 		for (i = 0; i < size; i++)
 		{
 //			if (i <= j) {
-				printf("%2.2f\t", LU[j +i*size]);
+				FPRINTF(stdout, "%2.2f\t", LU[j +i*size]);
 //			}
 //			else {
-//				printf(".\t");
+//				FPRINTF(stdout, ".\t");
 //			}
 		}
-		printf("\n");
+		FPRINTF(stdout, "\n");
 	}
 
 
 
 	/* display L */
-	printf("L: \n");
+	FPRINTF(stdout, "L: \n");
 	for (j = 0; j < size; j++)
 	{
 		for (i = 0; i < size; i++)
 		{
 //			if (i <= j) {
-				printf("%2.2f\t", L[j +i*size]);
+				FPRINTF(stdout, "%2.2f\t", L[j +i*size]);
 //			}
 //			else {
-//				printf(".\t");
+//				FPRINTF(stdout, ".\t");
 //			}
 		}
-		printf("\n");
+		FPRINTF(stdout, "\n");
 	}
 
 	/* display U */
-	printf("U: \n");
+	FPRINTF(stdout, "U: \n");
 	for (j = 0; j < size; j++)
 	{
 		for (i = 0; i < size; i++)
 		{
 //			if (i <= j) {
-				printf("%2.2f\t", U[j +i*size]);
+				FPRINTF(stdout, "%2.2f\t", U[j +i*size]);
 //			}
 //			else {
-//				printf(".\t");
+//				FPRINTF(stdout, ".\t");
 //			}
 		}
-		printf("\n");
+		FPRINTF(stdout, "\n");
 	}
 
 #endif
@@ -148,40 +150,40 @@ static void __attribute__ ((unused)) compare_A_LU(float *A, float *LU,
 
 #if 0
 	/* display A */
-	printf("A: \n");
+	FPRINTF(stdout, "A: \n");
 	for (j = 0; j < size; j++)
 	{
 		for (i = 0; i < size; i++)
 		{
 	//		if (i <= j) {
-	      			printf("%2.2f\t", A[j +i*size]);
+	      			FPRINTF(stdout, "%2.2f\t", A[j +i*size]);
 	//		}
 	//		else {
-	//			printf(".\t");
+	//			FPRINTF(stdout, ".\t");
 	//		}
 		}
-		printf("\n");
+		FPRINTF(stdout, "\n");
 	}
 
 
 	/* display LU */
-	printf("LU: \n");
+	FPRINTF(stdout, "LU: \n");
 	for (j = 0; j < size; j++)
 	{
 		for (i = 0; i < size; i++)
 		{
 	//		if (i <= j) {
-	      			printf("%2.2f\t", L[j +i*size]);
+	      			FPRINTF(stdout, "%2.2f\t", L[j +i*size]);
 	//		}
 	//		else {
-	//			printf(".\t");
+	//			FPRINTF(stdout, ".\t");
 	//		}
 		}
-		printf("\n");
+		FPRINTF(stdout, "\n");
 	}
 #endif
 
-	printf("max error between A and L*U = %f \n", max_err);
+	FPRINTF(stdout, "max error between A and L*U = %f \n", max_err);
 }
 #endif // CHECK_RESULTS
 

+ 9 - 9
examples/heat/dw_factolu_grain.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -54,7 +54,7 @@ static starpu_codelet cl11 = {
 
 static struct starpu_task *create_task_11(starpu_data_handle dataA, unsigned k, unsigned tag_prefix)
 {
-//	printf("task 11 k = %d TAG = %llx\n", k, (TAG11(k)));
+//	FPRINTF(stdout, "task 11 k = %d TAG = %llx\n", k, (TAG11(k)));
 
 	struct starpu_task *task = create_task(TAG11(k, tag_prefix));
 
@@ -87,7 +87,7 @@ static starpu_codelet cl12 = {
 
 static void create_task_12(starpu_data_handle dataA, unsigned k, unsigned i, unsigned tag_prefix)
 {
-//	printf("task 12 k,i = %d,%d TAG = %llx\n", k,i, TAG12(k,i));
+//	FPRINTF(stdout, "task 12 k,i = %d,%d TAG = %llx\n", k,i, TAG12(k,i));
 
 	struct starpu_task *task = create_task(TAG12(k, i, tag_prefix));
 	
@@ -163,7 +163,7 @@ static starpu_codelet cl22 = {
 
 static void create_task_22(starpu_data_handle dataA, unsigned k, unsigned i, unsigned j, unsigned tag_prefix)
 {
-//	printf("task 22 k,i,j = %d,%d,%d TAG = %llx\n", k,i,j, TAG22(k,i,j));
+//	FPRINTF(stdout, "task 22 k,i,j = %d,%d,%d TAG = %llx\n", k,i,j, TAG22(k,i,j));
 
 	struct starpu_task *task = create_task(TAG22(k, i, j, tag_prefix));
 
@@ -262,7 +262,7 @@ static void dw_factoLU_grain_inner(float *matA, unsigned size, unsigned inner_si
 	int ret = starpu_task_submit(entry_task);
 	if (STARPU_UNLIKELY(ret == -ENODEV))
 	{
-		fprintf(stderr, "No worker may execute this task\n");
+		FPRINTF(stderr, "No worker may execute this task\n");
 		exit(-1);
 	}
 
@@ -314,7 +314,7 @@ void dw_factoLU_grain(float *matA, unsigned size, unsigned ld, unsigned nblocks,
 {
 
 #ifdef CHECK_RESULTS
-	fprintf(stderr, "Checking results ...\n");
+	FPRINTF(stderr, "Checking results ...\n");
 	float *Asaved;
 	Asaved = malloc(ld*ld*sizeof(float));
 
@@ -333,12 +333,12 @@ void dw_factoLU_grain(float *matA, unsigned size, unsigned ld, unsigned nblocks,
 	gettimeofday(&end, NULL);
 
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
-	fprintf(stderr, "Computation took (in ms)\n");
-	printf("%2.2f\n", timing/1000);
+	FPRINTF(stderr, "Computation took (in ms)\n");
+	FPRINTF(stdout, "%2.2f\n", timing/1000);
 
 	unsigned n = size;
 	double flop = (2.0f*n*n*n)/3.0f;
-	fprintf(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
 
 #ifdef CHECK_RESULTS
 	compare_A_LU(Asaved, matA, size, ld);

+ 13 - 13
examples/heat/dw_factolu_kernels.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -33,7 +33,7 @@ void display_stat_heat(void)
 {
 	unsigned nworkers = starpu_worker_get_count();
 
-	fprintf(stderr, "STATS : \n");
+	FPRINTF(stderr, "STATS : \n");
 
 	unsigned worker;
 	for (worker = 0; worker < nworkers; worker++)
@@ -49,7 +49,7 @@ void display_stat_heat(void)
 		count_22_total += count_22_per_worker[worker];
 	}
 
-	fprintf(stderr, "\t11 (diagonal block LU)\n");
+	FPRINTF(stderr, "\t11 (diagonal block LU)\n");
 	for (worker = 0; worker < nworkers; worker++)
 	{
 		if (count_total_per_worker[worker])
@@ -57,11 +57,11 @@ void display_stat_heat(void)
 			char name[32];
 			starpu_worker_get_name(worker, name, 32);
 			
-			fprintf(stderr, "\t\t%s -> %d / %d (%2.2f %%)\n", name, count_11_per_worker[worker], count_11_total, (100.0*count_11_per_worker[worker])/count_11_total);
+			FPRINTF(stderr, "\t\t%s -> %d / %d (%2.2f %%)\n", name, count_11_per_worker[worker], count_11_total, (100.0*count_11_per_worker[worker])/count_11_total);
 		}
 	}
 
-	fprintf(stderr, "\t12 (TRSM)\n");
+	FPRINTF(stderr, "\t12 (TRSM)\n");
 	for (worker = 0; worker < nworkers; worker++)
 	{
 		if (count_total_per_worker[worker])
@@ -69,12 +69,12 @@ void display_stat_heat(void)
 			char name[32];
 			starpu_worker_get_name(worker, name, 32);
 			
-			fprintf(stderr, "\t\t%s -> %d / %d (%2.2f %%)\n", name, count_12_per_worker[worker], count_12_total, (100.0*count_12_per_worker[worker])/count_12_total);
+			FPRINTF(stderr, "\t\t%s -> %d / %d (%2.2f %%)\n", name, count_12_per_worker[worker], count_12_total, (100.0*count_12_per_worker[worker])/count_12_total);
 		}
 	}
 	
 	
-	fprintf(stderr, "\t21 (TRSM)\n");
+	FPRINTF(stderr, "\t21 (TRSM)\n");
 	for (worker = 0; worker < nworkers; worker++)
 	{
 		if (count_total_per_worker[worker])
@@ -82,11 +82,11 @@ void display_stat_heat(void)
 			char name[32];
 			starpu_worker_get_name(worker, name, 32);
 			
-			fprintf(stderr, "\t\t%s -> %d / %d (%2.2f %%)\n", name, count_21_per_worker[worker], count_21_total, (100.0*count_21_per_worker[worker])/count_21_total);
+			FPRINTF(stderr, "\t\t%s -> %d / %d (%2.2f %%)\n", name, count_21_per_worker[worker], count_21_total, (100.0*count_21_per_worker[worker])/count_21_total);
 		}
 	}
 	
-	fprintf(stderr, "\t22 (SGEMM)\n");
+	FPRINTF(stderr, "\t22 (SGEMM)\n");
 	for (worker = 0; worker < nworkers; worker++)
 	{
 		if (count_total_per_worker[worker])
@@ -94,7 +94,7 @@ void display_stat_heat(void)
 			char name[32];
 			starpu_worker_get_name(worker, name, 32);
 			
-			fprintf(stderr, "\t\t%s -> %d / %d (%2.2f %%)\n", name, count_22_per_worker[worker], count_22_total, (100.0*count_22_per_worker[worker])/count_22_total);
+			FPRINTF(stderr, "\t\t%s -> %d / %d (%2.2f %%)\n", name, count_22_per_worker[worker], count_22_total, (100.0*count_22_per_worker[worker])/count_22_total);
 		}
 	}
 }
@@ -298,12 +298,12 @@ static inline void debug_print(float *tab, unsigned ld, unsigned n)
 	{
 		for (i = 0; i < n; i++)
 		{
-			fprintf(stderr, "%2.2f\t", tab[(size_t)j+(size_t)i*ld]);
+			FPRINTF(stderr, "%2.2f\t", tab[(size_t)j+(size_t)i*ld]);
 		}
-		fprintf(stderr, "\n");
+		FPRINTF(stderr, "\n");
 	}
 	
-	fprintf(stderr, "\n");
+	FPRINTF(stderr, "\n");
 }
 
 static inline void dw_common_codelet_update_u11(void *descr[], int s, __attribute__((unused)) void *_args) 

+ 5 - 5
examples/heat/dw_factolu_tag.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -241,7 +241,7 @@ static void dw_codelet_facto_v3(starpu_data_handle dataA, unsigned nblocks)
 	int ret = starpu_task_submit(entry_task);
 	if (STARPU_UNLIKELY(ret == -ENODEV))
 	{
-		fprintf(stderr, "No worker may execute this task\n");
+		FPRINTF(stderr, "No worker may execute this task\n");
 		exit(-1);
 	}
 
@@ -253,19 +253,19 @@ static void dw_codelet_facto_v3(starpu_data_handle dataA, unsigned nblocks)
 	gettimeofday(&end, NULL);
 
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
-	fprintf(stderr, "Computation took (in ms)\n");
+	FPRINTF(stderr, "Computation took (in ms)\n");
 	printf("%2.2f\n", timing/1000);
 
 	unsigned n = starpu_matrix_get_nx(dataA);
 	double flop = (2.0f*n*n*n)/3.0f;
-	fprintf(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
 }
 
 void dw_factoLU_tag(float *matA, unsigned size, unsigned ld, unsigned nblocks, unsigned _no_prio)
 {
 
 #ifdef CHECK_RESULTS
-	fprintf(stderr, "Checking results ...\n");
+	FPRINTF(stderr, "Checking results ...\n");
 	float *Asaved;
 	Asaved = malloc((size_t)ld*ld*sizeof(float));
 

+ 7 - 6
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  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -20,6 +20,7 @@
  */
 
 #include "dw_sparse_cg.h"
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 static struct starpu_task *create_task(starpu_tag_t id)
 {
@@ -298,13 +299,13 @@ void iteration_cg(void *problem)
 {
 	struct cg_problem *pb = problem;
 
-	printf("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) && 
 		(pb->delta_new > pb->epsilon) )
 	{
 		if (pb->i % 1000 == 0)
-			printf("i : %d\n\tdelta_new %f (%f)\n", pb->i, pb->delta_new, sqrt(pb->delta_new / pb->size));
+			FPRINTF(stdout, "i : %d\n\tdelta_new %f (%f)\n", pb->i, pb->delta_new, sqrt(pb->delta_new / pb->size));
 
 		pb->i++;
 
@@ -313,8 +314,8 @@ void iteration_cg(void *problem)
 	}
 	else {
 		/* we may stop */
-		printf("We are done ... after %d iterations \n", pb->i - 1);
-		printf("i : %d\n\tdelta_new %2.5f\n", pb->i, pb->delta_new);
+		FPRINTF(stdout, "We are done ... after %d iterations \n", pb->i - 1);
+		FPRINTF(stdout, "i : %d\n\tdelta_new %2.5f\n", pb->i, pb->delta_new);
 		sem_post(pb->sem);
 	}
 }
@@ -353,7 +354,7 @@ void conjugate_gradient(float *nzvalA, float *vecb, float *vecx, uint32_t nnz,
 		ptr_vecq[i] = 0.0f;
 	}
 
-	printf("nrow = %d \n", nrow);
+	FPRINTF(stdout, "nrow = %d \n", nrow);
 
 	/* and register them as well */
 	starpu_vector_data_register(&ds_vecr, 0, (uintptr_t)ptr_vecr, nrow, sizeof(float));

+ 5 - 5
examples/heat/heat.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -321,7 +321,7 @@ static void solve_system(unsigned size, unsigned subsize, float *result, int *Re
 	/* solve the actual problem LU X = B */
         /* solve LX' = Y with X' = UX */
         /* solve UX = X' */
-	fprintf(stderr, "Solving the problem ...\n");
+	FPRINTF(stderr, "Solving the problem ...\n");
 
 	float *savedB;
 	float *LUB;
@@ -360,10 +360,10 @@ static void solve_system(unsigned size, unsigned subsize, float *result, int *Re
 	
 		/* check if LUB is close to the 0 vector */
 		int maxind = ISAMAX(subsize, LUB, 1);
-		fprintf(stderr, "max error (LUX - B) = %e\n",LUB[maxind - 1]);
+		FPRINTF(stderr, "max error (LUX - B) = %e\n",LUB[maxind - 1]);
 
 		float sum = SASUM(subsize, LUB, 1);
-		fprintf(stderr,"avg. error %e\n", sum/subsize);
+		FPRINTF(stderr,"avg. error %e\n", sum/subsize);
 	
 		free(LUB);
 		free(savedB);
@@ -729,7 +729,7 @@ int main(int argc, char **argv)
 
 		build_dense_stiffness_matrix_A(pmesh, A, newsize, RefArray, RefArrayBack);
 
-		fprintf(stderr, "Problem size : %dx%d (%dx%d) (%ld MB)\n", newsize, newsize, DIM, DIM, ((unsigned long)newsize*newsize*4UL)/(1024*1024));
+		FPRINTF(stderr, "Problem size : %dx%d (%dx%d) (%ld MB)\n", newsize, newsize, DIM, DIM, ((unsigned long)newsize*newsize*4UL)/(1024*1024));
 
 		STARPU_ASSERT(newsize % nblocks == 0);
 

+ 3 - 1
examples/heat/heat.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010, 2011  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -36,6 +36,8 @@
 #include <GL/glut.h>
 #endif
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 #define X	0
 #define Y	1
 

+ 2 - 2
examples/heat/heat_display.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -211,7 +211,7 @@ void find_limits(void)
 
 void opengl_render(unsigned _ntheta, unsigned _nthick, float *_result, point *_pmesh, int argc_, char **argv_)
 {
-	fprintf(stderr, "OpenGL rendering ... \n");
+	FPRINTF(stderr, "OpenGL rendering ... \n");
 
 	ntheta = _ntheta;
 	nthick = _nthick;

+ 5 - 4
examples/incrementer/incrementer.c

@@ -20,6 +20,7 @@
 #include <sys/time.h>
 
 static unsigned niter = 50000;
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 #ifdef STARPU_USE_CUDA
 extern void cuda_codelet(void *descr[], __attribute__ ((unused)) void *_args);
@@ -88,7 +89,7 @@ int main(int argc, char **argv)
 		int ret = starpu_task_submit(task);
 		if (STARPU_UNLIKELY(ret == -ENODEV))
 		{
-			fprintf(stderr, "No worker may execute this task\n");
+			FPRINTF(stderr, "No worker may execute this task\n");
 			exit(0);
 		}
 	}
@@ -100,11 +101,11 @@ int main(int argc, char **argv)
 
 	gettimeofday(&end, NULL);
 
-	fprintf(stderr, "array -> %f, %f, %f, %f\n", float_array[0],
+	FPRINTF(stderr, "array -> %f, %f, %f, %f\n", float_array[0],
                 float_array[1], float_array[2], float_array[3]);
 
 	if (float_array[0] != float_array[1] + float_array[2] + float_array[3]) {
-		fprintf(stderr, "Incorrect result\n");
+		FPRINTF(stderr, "Incorrect result\n");
 		return 1;
 	}
 
@@ -113,7 +114,7 @@ int main(int argc, char **argv)
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 +
 					(end.tv_usec - start.tv_usec));
 
-	fprintf(stderr, "%d elems took %lf ms\n", niter, timing/1000);
+	FPRINTF(stderr, "%d elems took %lf ms\n", niter, timing/1000);
 
 	starpu_shutdown();
 

+ 16 - 14
examples/lu/lu_example.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -36,6 +36,8 @@ static unsigned bound = 0;
 static unsigned bounddeps = 0;
 static unsigned boundprio = 0;
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 TYPE *A, *A_saved;
 
 /* in case we use non-strided blocks */
@@ -89,18 +91,18 @@ static void parse_args(int argc, char **argv)
 static void display_matrix(TYPE *m, unsigned n, unsigned ld, char *str)
 {
 #if 0
-	fprintf(stderr, "***********\n");
-	fprintf(stderr, "Display matrix %s\n", str);
+	FPRINTF(stderr, "***********\n");
+	FPRINTF(stderr, "Display matrix %s\n", str);
 	unsigned i,j;
 	for (j = 0; j < n; j++)
 	{
 		for (i = 0; i < n; i++)
 		{
-			fprintf(stderr, "%2.2f\t", m[i+j*ld]);
+			FPRINTF(stderr, "%2.2f\t", m[i+j*ld]);
 		}
-		fprintf(stderr, "\n");
+		FPRINTF(stderr, "\n");
 	}
-	fprintf(stderr, "***********\n");
+	FPRINTF(stderr, "***********\n");
 #endif
 }
 
@@ -199,7 +201,7 @@ static void pivot_saved_matrix(unsigned *ipiv)
 	{
 		if (k != ipiv[k])
 		{
-	//		fprintf(stderr, "SWAP %d and %d\n", k, ipiv[k]);
+	//		FPRINTF(stderr, "SWAP %d and %d\n", k, ipiv[k]);
 			CPU_SWAP(size, &A_saved[k*size], 1, &A_saved[ipiv[k]*size], 1);
 		}
 	}
@@ -250,13 +252,13 @@ static void check_result(void)
 	TYPE err = CPU_ASUM(size*size, L, 1);
 	int max = CPU_IAMAX(size*size, L, 1);
 
-	fprintf(stderr, "Avg error : %e\n", err/(size*size));
-	fprintf(stderr, "Max error : %e\n", L[max]);
+	FPRINTF(stderr, "Avg error : %e\n", err/(size*size));
+	FPRINTF(stderr, "Max error : %e\n", L[max]);
 
 	double residual = frobenius_norm(L, size);
 	double matnorm = frobenius_norm(A_saved, size);
 
-	fprintf(stderr, "||%sA-LU|| / (||A||*N) : %e\n", pivot?"P":"", residual/(matnorm*size));
+	FPRINTF(stderr, "||%sA-LU|| / (||A||*N) : %e\n", pivot?"P":"", residual/(matnorm*size));
 
 	if (residual/(matnorm*size) > 1e-5)
 		exit(-1);
@@ -314,8 +316,8 @@ int main(int argc, char **argv)
 			
 			unsigned n = size;
 			double flop = (2.0f*n*n*n)/3.0f;
-			fprintf(stderr, "Synthetic GFlops (TOTAL) : \n");
-			fprintf(stdout, "%d	%6.2f\n", n, (flop/timing/1000.0f));
+			FPRINTF(stderr, "Synthetic GFlops (TOTAL) : \n");
+			FPRINTF(stdout, "%d	%6.2f\n", n, (flop/timing/1000.0f));
 		}
 	}
 	else
@@ -335,11 +337,11 @@ int main(int argc, char **argv)
 		if (bounddeps) {
 			FILE *f = fopen("lu.pl", "w");
 			starpu_bound_print_lp(f);
-			fprintf(stderr,"system printed to lu.pl\n");
+			FPRINTF(stderr,"system printed to lu.pl\n");
 		} else {
 			starpu_bound_compute(&min, NULL, 0);
 			if (min != 0.)
-				fprintf(stderr, "theoretical min: %lf ms\n", min);
+				FPRINTF(stderr, "theoretical min: %lf ms\n", min);
 		}
 	}
 

+ 5 - 5
examples/lu/xlu.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -205,7 +205,7 @@ static void dw_codelet_facto_v3(starpu_data_handle dataA, unsigned nblocks)
 	int ret = starpu_task_submit(entry_task);
 	if (STARPU_UNLIKELY(ret == -ENODEV))
 	{
-		fprintf(stderr, "No worker may execute this task\n");
+		FPRINTF(stderr, "No worker may execute this task\n");
 		exit(-1);
 	}
 
@@ -217,12 +217,12 @@ static void dw_codelet_facto_v3(starpu_data_handle dataA, unsigned nblocks)
 	gettimeofday(&end, NULL);
 
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
-	fprintf(stderr, "Computation took (in ms)\n");
-	printf("%2.2f\n", timing/1000);
+	FPRINTF(stderr, "Computation took (in ms)\n");
+	FPRINTF(stdout, "%2.2f\n", timing/1000);
 
 	unsigned n = starpu_matrix_get_nx(dataA);
 	double flop = (2.0f*n*n*n)/3.0f;
-	fprintf(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
 }
 
 void STARPU_LU(lu_decomposition)(TYPE *matA, unsigned size, unsigned ld, unsigned nblocks)

+ 4 - 2
examples/lu/xlu.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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,6 +27,8 @@
 
 #include <common/blas.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 #define BLAS3_FLOP(n1,n2,n3)    \
         (2*((uint64_t)n1)*((uint64_t)n2)*((uint64_t)n3))
 
@@ -74,7 +76,7 @@ static void __attribute__ ((unused)) compare_A_LU(float *A, float *LU,
 		}
 	}
 
-	printf("max error between A and L*U = %f \n", max_err);
+	FPRINTF(stdout, "max error between A and L*U = %f \n", max_err);
 }
 #endif // CHECK_RESULTS
 

+ 4 - 4
examples/lu/xlu_implicit.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -127,12 +127,12 @@ static void dw_codelet_facto_v3(starpu_data_handle dataA, unsigned nblocks)
 	gettimeofday(&end, NULL);
 
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
-	fprintf(stderr, "Computation took (in ms)\n");
-	printf("%2.2f\n", timing/1000);
+	FPRINTF(stderr, "Computation took (in ms)\n");
+	FPRINTF(stdout, "%2.2f\n", timing/1000);
 
 	unsigned n = starpu_matrix_get_nx(dataA);
 	double flop = (2.0f*n*n*n)/3.0f;
-	fprintf(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
 }
 
 void STARPU_LU(lu_decomposition)(TYPE *matA, unsigned size, unsigned ld, unsigned nblocks)

+ 7 - 7
examples/lu/xlu_implicit_pivot.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -219,12 +219,12 @@ void STARPU_LU(lu_decomposition_pivot)(TYPE *matA, unsigned *ipiv, unsigned size
 	double timing;
 	timing = dw_codelet_facto_pivot(&dataA, piv_description, nblocks, get_block_with_striding);
 
-	fprintf(stderr, "Computation took (in ms)\n");
-	fprintf(stderr, "%2.2f\n", timing/1000);
+	FPRINTF(stderr, "Computation took (in ms)\n");
+	FPRINTF(stderr, "%2.2f\n", timing/1000);
 
 	unsigned n = starpu_matrix_get_nx(dataA);
 	double flop = (2.0f*n*n*n)/3.0f;
-	fprintf(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
 
 	/* gather all the data */
 	starpu_data_unpartition(dataA, 0);
@@ -268,12 +268,12 @@ void STARPU_LU(lu_decomposition_pivot_no_stride)(TYPE **matA, unsigned *ipiv, un
 	double timing;
 	timing = dw_codelet_facto_pivot(dataAp, piv_description, nblocks, get_block_with_no_striding);
 
-	fprintf(stderr, "Computation took (in ms)\n");
-	fprintf(stderr, "%2.2f\n", timing/1000);
+	FPRINTF(stderr, "Computation took (in ms)\n");
+	FPRINTF(stderr, "%2.2f\n", timing/1000);
 
 	unsigned n = starpu_matrix_get_nx(dataAp[0])*nblocks;
 	double flop = (2.0f*n*n*n)/3.0f;
-	fprintf(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
 
 	for (bj = 0; bj < nblocks; bj++)
 	for (bi = 0; bi < nblocks; bi++)

+ 8 - 8
examples/lu/xlu_pivot.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -281,7 +281,7 @@ static double dw_codelet_facto_pivot(starpu_data_handle *dataAp,
 	int ret = starpu_task_submit(entry_task);
 	if (STARPU_UNLIKELY(ret == -ENODEV))
 	{
-		fprintf(stderr, "No worker may execute this task\n");
+		FPRINTF(stderr, "No worker may execute this task\n");
 		exit(-1);
 	}
 
@@ -349,12 +349,12 @@ void STARPU_LU(lu_decomposition_pivot)(TYPE *matA, unsigned *ipiv, unsigned size
 	double timing;
 	timing = dw_codelet_facto_pivot(&dataA, piv_description, nblocks, get_block_with_striding);
 
-	fprintf(stderr, "Computation took (in ms)\n");
-	fprintf(stderr, "%2.2f\n", timing/1000);
+	FPRINTF(stderr, "Computation took (in ms)\n");
+	FPRINTF(stderr, "%2.2f\n", timing/1000);
 
 	unsigned n = starpu_matrix_get_nx(dataA);
 	double flop = (2.0f*n*n*n)/3.0f;
-	fprintf(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
 
 	/* gather all the data */
 	starpu_data_unpartition(dataA, 0);
@@ -401,12 +401,12 @@ void STARPU_LU(lu_decomposition_pivot_no_stride)(TYPE **matA, unsigned *ipiv, un
 	double timing;
 	timing = dw_codelet_facto_pivot(dataAp, piv_description, nblocks, get_block_with_no_striding);
 
-	fprintf(stderr, "Computation took (in ms)\n");
-	fprintf(stderr, "%2.2f\n", timing/1000);
+	FPRINTF(stderr, "Computation took (in ms)\n");
+	FPRINTF(stderr, "%2.2f\n", timing/1000);
 
 	unsigned n = starpu_matrix_get_nx(dataAp[0])*nblocks;
 	double flop = (2.0f*n*n*n)/3.0f;
-	fprintf(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
 
 	for (bj = 0; bj < nblocks; bj++)
 	for (bi = 0; bi < nblocks; bi++)

+ 7 - 5
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  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -20,6 +20,8 @@
 #include <pthread.h>
 #include <math.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 #ifdef STARPU_USE_OPENCL
 struct starpu_opencl_program opencl_code;
 void opencl_codelet(void *descr[], __attribute__ ((unused)) void *_args)
@@ -73,9 +75,9 @@ void fillArray(float* pfData, int iSize) {
 void printArray(float* pfData, int iSize) {
     int i;
     for (i = 0; i < iSize; ++i) {
-            fprintf(stderr, "%f ", pfData[i]);
+            FPRINTF(stderr, "%f ", pfData[i]);
     }
-    fprintf(stderr, "\n");
+    FPRINTF(stderr, "\n");
 }
 
 void matVecMult(const float *matrix, const float *vector, int width, int height, float *mult) {
@@ -179,7 +181,7 @@ int main(int argc, char **argv)
 
         int ret = starpu_task_submit(task);
         if (STARPU_UNLIKELY(ret == -ENODEV)) {
-                fprintf(stderr, "No worker may execute this task. This application requires an OpenCL worker.\n");
+                FPRINTF(stderr, "No worker may execute this task. This application requires an OpenCL worker.\n");
                 exit(0);
 	}
 
@@ -191,7 +193,7 @@ int main(int argc, char **argv)
         starpu_data_acquire(mult_handle, STARPU_R);
 
         int res = compareL2fe(correctResult, mult, height, 1e-6f);
-        printf("TEST %s\n\n", (res == 0) ? "PASSED" : "FAILED !!!");
+        FPRINTF(stdout, "TEST %s\n\n", (res == 0) ? "PASSED" : "FAILED !!!");
 #if 0
         printArray(matrix, width*height);
         printArray(vector, width);

+ 8 - 6
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  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -42,6 +42,8 @@ static unsigned check = 0;
 static TYPE *A, *B, *C;
 static starpu_data_handle A_handle, B_handle, C_handle;
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 static void check_output(void)
 {
 	/* compute C = C - AB */
@@ -52,14 +54,14 @@ static void check_output(void)
 	err = CPU_ASUM(xdim*ydim, C, 1);
 
 	if (err < xdim*ydim*0.001) {
-		fprintf(stderr, "Results are OK\n");
+		FPRINTF(stderr, "Results are OK\n");
 	}
 	else {
 		int max;
 		max = CPU_IAMAX(xdim*ydim, C, 1);
 
-		fprintf(stderr, "There were errors ... err = %f\n", err);
-		fprintf(stderr, "Max error : %e\n", C[max]);
+		FPRINTF(stderr, "There were errors ... err = %f\n", err);
+		FPRINTF(stderr, "Max error : %e\n", C[max]);
 	}
 }
 
@@ -284,11 +286,11 @@ int main(int argc, char **argv)
 	gettimeofday(&end, NULL);
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 
-	fprintf(stderr, "Time: %2.2f ms\n", timing/1000.0);
+	FPRINTF(stderr, "Time: %2.2f ms\n", timing/1000.0);
 
 	double flops = 2.0*((unsigned long)niter)*((unsigned long)xdim)
 				*((unsigned long)ydim)*((unsigned long)zdim);
-	fprintf(stderr, "GFlop/s: %.2f\n", flops/timing/1000.0);
+	FPRINTF(stderr, "GFlop/s: %.2f\n", flops/timing/1000.0);
 
 	starpu_data_unpartition(C_handle, 0);
 	starpu_data_unregister(C_handle);

+ 7 - 5
examples/pi/pi.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -25,6 +25,8 @@
 void cuda_kernel(void **descr, void *cl_arg);
 #endif
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 /* default value */
 static unsigned ntasks = 1024;
 
@@ -163,13 +165,13 @@ int main(int argc, char **argv)
 	unsigned long total_shot_cnt = ntasks * NSHOT_PER_TASK;
 
 	/* Total surface : Pi * r^ 2 = Pi*1^2, total square surface : 2^2 = 4, probability to impact the disk: pi/4 */
-	fprintf(stderr, "Pi approximation : %f (%ld / %ld)\n", ((TYPE)total_cnt*4)/(total_shot_cnt), total_cnt, total_shot_cnt);
-	fprintf(stderr, "Total time : %f ms\n", timing/1000.0);
-	fprintf(stderr, "Speed : %f GShot/s\n", total_shot_cnt/(1e3*timing));
+	FPRINTF(stderr, "Pi approximation : %f (%ld / %ld)\n", ((TYPE)total_cnt*4)/(total_shot_cnt), total_cnt, total_shot_cnt);
+	FPRINTF(stderr, "Total time : %f ms\n", timing/1000.0);
+	FPRINTF(stderr, "Speed : %f GShot/s\n", total_shot_cnt/(1e3*timing));
 
 	starpu_data_release(cnt_array_handle);
 
-	starpu_display_codelet_stats(&cl);
+	if (!getenv("STARPU_SSILENT")) starpu_display_codelet_stats(&cl);
 
 	starpu_shutdown();
 

+ 5 - 4
examples/pi/pi_redux.c

@@ -19,6 +19,7 @@
 #include <sys/time.h>
 #include <starpu_config.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 #define PI	3.14159265358979323846
 
 #if defined(STARPU_USE_CUDA) && !defined(STARPU_HAVE_CURAND)
@@ -303,10 +304,10 @@ int main(int argc, char **argv)
 	starpu_data_release(shot_cnt_handle);
 
 
-	fprintf(stderr, "Pi approximation : %lf (%ld / %ld)\n", pi_approx, shot_cnt, total);
-	fprintf(stderr, "Error %le \n", pi_approx - PI);
-	fprintf(stderr, "Total time : %f ms\n", timing/1000.0);
-	fprintf(stderr, "Speed : %f GShot/s\n", total/(1e3*timing));
+	FPRINTF(stderr, "Pi approximation : %lf (%ld / %ld)\n", pi_approx, shot_cnt, total);
+	FPRINTF(stderr, "Error %le \n", pi_approx - PI);
+	FPRINTF(stderr, "Total time : %f ms\n", timing/1000.0);
+	FPRINTF(stderr, "Speed : %f GShot/s\n", total/(1e3*timing));
 
 	starpu_data_unregister(shot_cnt_handle);
 	starpu_shutdown();

+ 10 - 8
examples/profiling/profiling.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010, 2011  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -20,6 +20,8 @@
 #include <assert.h>
 #include <unistd.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 static unsigned niter = 500;
 
 void sleep_codelet(__attribute__ ((unused)) void *descr[],
@@ -70,7 +72,7 @@ int main(int argc, char **argv)
 		int ret = starpu_task_submit(task);
 		if (STARPU_UNLIKELY(ret == -ENODEV))
 		{
-			fprintf(stderr, "No worker may execute this task\n");
+			FPRINTF(stderr, "No worker may execute this task\n");
 			exit(0);
 		}
 	}
@@ -97,8 +99,8 @@ int main(int argc, char **argv)
 
 	free(tasks);
 
-	fprintf(stderr, "Avg. delay : %2.2lf us\n", (delay_sum)/niter);
-	fprintf(stderr, "Avg. length : %2.2lf us\n", (length_sum)/niter);
+	FPRINTF(stderr, "Avg. delay : %2.2lf us\n", (delay_sum)/niter);
+	FPRINTF(stderr, "Avg. length : %2.2lf us\n", (length_sum)/niter);
 
 	/* Display the occupancy of all workers during the test */
 	int worker;
@@ -117,10 +119,10 @@ int main(int argc, char **argv)
 
 		char workername[128];
 		starpu_worker_get_name(worker, workername, 128);
-		fprintf(stderr, "Worker %s:\n", workername);
-		fprintf(stderr, "\ttotal time : %.2lf ms\n", total_time*1e-3);
-		fprintf(stderr, "\texec time  : %.2lf ms (%.2f %%)\n", executing_time*1e-3, executing_ratio);
-		fprintf(stderr, "\tblocked time  : %.2lf ms (%.2f %%)\n", sleeping_time*1e-3, sleeping_ratio);
+		FPRINTF(stderr, "Worker %s:\n", workername);
+		FPRINTF(stderr, "\ttotal time : %.2lf ms\n", total_time*1e-3);
+		FPRINTF(stderr, "\texec time  : %.2lf ms (%.2f %%)\n", executing_time*1e-3, executing_ratio);
+		FPRINTF(stderr, "\tblocked time  : %.2lf ms (%.2f %%)\n", sleeping_time*1e-3, sleeping_ratio);
 	}
 
 	starpu_shutdown();

+ 4 - 2
examples/reductions/dot_product.c

@@ -22,6 +22,8 @@
 #include <cublas.h>
 #endif
 
+#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 *x_handles;
@@ -122,7 +124,7 @@ void dot_cuda_func(void *descr[], void *cl_arg)
 
 	local_dot = (DOT_TYPE)cublasSdot(n, local_x, 1, local_y, 1);
 
-	//fprintf(stderr, "current_dot %f local dot %f -> %f\n", current_dot, local_dot, current_dot + local_dot);
+	//FPRINTF(stderr, "current_dot %f local dot %f -> %f\n", current_dot, local_dot, current_dot + local_dot);
 	current_dot += local_dot;
 
 	cudaThreadSynchronize();
@@ -213,7 +215,7 @@ int main(int argc, char **argv)
 
 	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_helper_cublas_shutdown();
 

+ 5 - 3
examples/reductions/minmax_reduction.c

@@ -22,6 +22,8 @@
 static unsigned nblocks = 8192;
 static unsigned entries_per_bock = 1024;
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 #define TYPE		double
 #define TYPE_MAX	DBL_MAX
 #define TYPE_MIN	DBL_MIN
@@ -171,15 +173,15 @@ int main(int argc, char **argv)
 		if (ret)
 		{
 			STARPU_ASSERT(ret == -ENODEV);
-			fprintf(stderr, "This test can only run on CPUs, but there are no CPU workers (this is not a bug).\n");
+			FPRINTF(stderr, "This test can only run on CPUs, but there are no CPU workers (this is not a bug).\n");
 			return 0;
 		}
 	}
 
 	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]);
 

+ 4 - 3
examples/scheduler/dummy_sched.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -19,6 +19,7 @@
 #include <starpu.h>
 
 #define NTASKS	32000
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 struct starpu_task_list sched_list;
 
@@ -38,7 +39,7 @@ static void init_dummy_sched(struct starpu_machine_topology_s *topology,
 	for (workerid = 0; workerid < topology->nworkers; workerid++)
 		starpu_worker_set_sched_condition(workerid, &sched_cond, &sched_mutex);
 
-	fprintf(stderr, "Initialising Dummy scheduler\n");
+	FPRINTF(stderr, "Initialising Dummy scheduler\n");
 }
 
 static void deinit_dummy_sched(struct starpu_machine_topology_s *topology,
@@ -49,7 +50,7 @@ static void deinit_dummy_sched(struct starpu_machine_topology_s *topology,
 	pthread_cond_destroy(&sched_cond);
 	pthread_mutex_destroy(&sched_mutex);
 
-	fprintf(stderr, "Destroying Dummy scheduler\n");
+	FPRINTF(stderr, "Destroying Dummy scheduler\n");
 }
 
 static int push_task_dummy(struct starpu_task *task)

+ 7 - 6
examples/spmv/dw_block_spmv.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -18,6 +18,7 @@
 
 #include "dw_block_spmv.h"
 #include "matrix_market/mm_to_bcsr.h"
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 struct timeval start;
 struct timeval end;
@@ -266,7 +267,7 @@ int main(__attribute__ ((unused)) int argc,
 {
 	if (argc < 2)
 	{
-		fprintf(stderr, "usage : %s filename [tile size]\n", argv[0]);
+		FPRINTF(stderr, "usage : %s filename [tile size]\n", argv[0]);
 		exit(-1);
 	}
 
@@ -297,10 +298,10 @@ int main(__attribute__ ((unused)) int argc,
 	double totalflop = 2.0*c*r*totaltasks;
 
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
-	fprintf(stderr, "Computation took (in ms)\n");
-	printf("%2.2f\n", timing/1000);
-	fprintf(stderr, "Flop %e\n", totalflop);
-	fprintf(stderr, "GFlops : %2.2f\n", totalflop/timing/1000);
+	FPRINTF(stderr, "Computation took (in ms)\n");
+	FPRINTF(stdout, "%2.2f\n", timing/1000);
+	FPRINTF(stderr, "Flop %e\n", totalflop);
+	FPRINTF(stderr, "GFlops : %2.2f\n", totalflop/timing/1000);
 
 	return 0;
 }

+ 7 - 6
examples/spmv/dw_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  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -21,6 +21,7 @@
  */
 
 #include "dw_spmv.h"
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 #ifdef STARPU_USE_CUDA
 extern void spmv_kernel_cuda(void *descr[], void *args);
@@ -259,7 +260,7 @@ void call_spmv_codelet_filters(void)
                 int ret = starpu_opencl_load_opencl_from_file("examples/spmv/spmv_opencl.cl", &opencl_codelet);
                 if (ret)
 		{
-			fprintf(stderr, "Failed to compile OpenCL codelet\n");
+			FPRINTF(stderr, "Failed to compile OpenCL codelet\n");
 			exit(ret);
 		}
         }
@@ -301,7 +302,7 @@ void call_spmv_codelet_filters(void)
 		ret = starpu_task_submit(task);
 		if (STARPU_UNLIKELY(ret == -ENODEV))
 		{
-			fprintf(stderr, "No worker may execute this task\n");
+			FPRINTF(stderr, "No worker may execute this task\n");
 			exit(0);
 		}
 	}
@@ -320,7 +321,7 @@ static void print_results(void)
 
 	for (row = 0; row < STARPU_MIN(size, 16); row++)
 	{
-		printf("%2.2f\t%2.2f\n", vector_in_ptr[row], vector_out_ptr[row]);
+                FPRINTF(stdout, "%2.2f\t%2.2f\n", vector_in_ptr[row], vector_out_ptr[row]);
 	}
 }
 
@@ -343,8 +344,8 @@ int main(__attribute__ ((unused)) int argc,
 	print_results();
 
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
-	fprintf(stderr, "Computation took (in ms)\n");
-	printf("%2.2f\n", timing/1000);
+	FPRINTF(stderr, "Computation took (in ms)\n");
+	FPRINTF(stdout, "%2.2f\n", timing/1000);
 
 	return 0;
 }

+ 5 - 4
examples/tag_example/tag_example.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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,6 +27,7 @@
 #include <gordon/null.h>
 #endif
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 #define TAG(i, j, iter)	((starpu_tag_t) ( ((uint64_t)(iter)<<48) |  ((uint64_t)(j)<<24) | (i)) )
 
 starpu_codelet cl;
@@ -84,7 +85,7 @@ static void create_task_grid(unsigned iter)
 {
 	unsigned i, j;
 
-//	fprintf(stderr, "start iter %d...\n", iter);
+//	FPRINTF(stderr, "start iter %d...\n", iter);
 	callback_cnt = (ni*nj);
 
 	/* create non-entry tasks */
@@ -191,7 +192,7 @@ int main(int argc __attribute__((unused)) , char **argv __attribute__((unused)))
 
 	parse_args(argc, argv);
 
-	fprintf(stderr, "ITER: %d\n", nk);
+	FPRINTF(stderr, "ITER: %d\n", nk);
 
 	cl.where = STARPU_CPU|STARPU_CUDA|STARPU_GORDON;
 	cl.cpu_func = cpu_codelet;
@@ -207,7 +208,7 @@ int main(int argc __attribute__((unused)) , char **argv __attribute__((unused)))
 
 	starpu_shutdown();
 
-	fprintf(stderr, "TEST DONE ...\n");
+	FPRINTF(stderr, "TEST DONE ...\n");
 
 	return 0;
 }

+ 5 - 4
examples/tag_example/tag_example2.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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,6 +27,7 @@
 #include <gordon/null.h>
 #endif
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 #define TAG(i, iter)	((starpu_tag_t)  (((uint64_t)iter)<<32 | (i)) )
 
 starpu_codelet cl;
@@ -69,7 +70,7 @@ static void create_task_grid(unsigned it)
 {
 	unsigned i;
 
-//	fprintf(stderr, "start iter %d ni %d...\n", it, ni);
+//	FPRINTF(stderr, "start iter %d ni %d...\n", it, ni);
 
 	for (i = 0; i < ni; i++)
 	{
@@ -116,7 +117,7 @@ int main(int argc __attribute__((unused)) , char **argv __attribute__((unused)))
 	cl.where = STARPU_CPU|STARPU_CUDA|STARPU_GORDON;
 	cl.nbuffers = 0;
 
-	fprintf(stderr, "ITER : %d\n", nk);
+	FPRINTF(stderr, "ITER : %d\n", nk);
 
 	for (i = 0; i < nk; i++)
 	{
@@ -131,7 +132,7 @@ int main(int argc __attribute__((unused)) , char **argv __attribute__((unused)))
 
 	starpu_shutdown();
 
-	fprintf(stderr, "TEST DONE ...\n");
+	FPRINTF(stderr, "TEST DONE ...\n");
 
 	return 0;
 }

+ 5 - 4
examples/tag_example/tag_example3.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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,6 +27,7 @@
 #include <gordon/null.h>
 #endif
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 #define TAG(i, iter)	((starpu_tag_t)  (((uint64_t)iter)<<32 | (i)) )
 
 starpu_codelet cl;
@@ -75,7 +76,7 @@ static void create_task_grid(unsigned iter)
 {
 	int i;
 
-//	fprintf(stderr, "start iter %d ni %d...\n", iter, ni);
+//	FPRINTF(stderr, "start iter %d ni %d...\n", iter, ni);
 
 	callback_cnt = (ni);
 
@@ -123,7 +124,7 @@ int main(int argc __attribute__((unused)) , char **argv __attribute__((unused)))
 	cl.where = STARPU_CPU|STARPU_CUDA|STARPU_GORDON;
 	cl.nbuffers = 0;
 
-	fprintf(stderr, "ITER : %d\n", nk);
+	FPRINTF(stderr, "ITER : %d\n", nk);
 
 	for (i = 0; i < nk; i++)
 	{
@@ -138,7 +139,7 @@ int main(int argc __attribute__((unused)) , char **argv __attribute__((unused)))
 
 	starpu_shutdown();
 
-	fprintf(stderr, "TEST DONE ...\n");
+	FPRINTF(stderr, "TEST DONE ...\n");
 
 	return 0;
 }

+ 6 - 5
examples/tag_example/tag_restartable.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -32,6 +32,7 @@
 #define Nrolls	4
 #define SLEEP 1
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 #define TAG(i, iter)	((starpu_tag_t)  (((uint64_t)((iter)%Nrolls))<<32 | (i)) )
 
 starpu_codelet cl;
@@ -69,7 +70,7 @@ static void create_task_grid(unsigned iter)
 {
 	unsigned i;
 
-	fprintf(stderr, "init iter %d ni %d...\n", iter, ni);
+	FPRINTF(stderr, "init iter %d ni %d...\n", iter, ni);
 
 	callback_cnt = (ni);
 
@@ -97,7 +98,7 @@ static void start_task_grid(unsigned iter)
 {
 	unsigned i;
 
-	//fprintf(stderr, "start grid %d ni %d...\n", iter, ni);
+	//FPRINTF(stderr, "start grid %d ni %d...\n", iter, ni);
 
 	for (i = 0; i < ni; i++)
 		starpu_task_submit(tasks[iter][i]);
@@ -132,7 +133,7 @@ int main(int argc __attribute__((unused)) , char **argv __attribute__((unused)))
 	cl.where = STARPU_CPU|STARPU_CUDA|STARPU_GORDON;
 	cl.nbuffers = 0;
 
-	fprintf(stderr, "ITER : %d\n", nk);
+	FPRINTF(stderr, "ITER : %d\n", nk);
 
 	for (i = 0; i < Nrolls; i++) {
 		tasks[i] = malloc(ni * sizeof(*tasks[i]));
@@ -151,7 +152,7 @@ int main(int argc __attribute__((unused)) , char **argv __attribute__((unused)))
 
 	starpu_shutdown();
 
-	fprintf(stderr, "TEST DONE ...\n");
+	FPRINTF(stderr, "TEST DONE ...\n");
 
 	return 0;
 }