Bladeren bron

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

Nathalie Furmento 14 jaren geleden
bovenliggende
commit
85f203b568

+ 6 - 5
tests/core/empty_task.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
@@ -21,12 +21,13 @@
 #include <unistd.h>
 
 #include <starpu.h>
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 static unsigned ntasks = 65536;
 
 static void usage(char **argv)
 {
-	fprintf(stderr, "%s [-i ntasks] [-h]\n", argv[0]);
+	FPRINTF(stderr, "%s [-i ntasks] [-h]\n", argv[0]);
 	exit(-1);
 }
 
@@ -54,7 +55,7 @@ int main(int argc, char **argv)
 
 	starpu_init(NULL);
 
-	fprintf(stderr, "#tasks : %d\n", ntasks);
+	FPRINTF(stderr, "#tasks : %d\n", ntasks);
 
 	gettimeofday(&start, NULL);
 
@@ -78,8 +79,8 @@ int main(int argc, char **argv)
 
 	timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 
-	fprintf(stderr, "Total: %lf secs\n", timing/1000000);
-	fprintf(stderr, "Per task: %lf usecs\n", timing/ntasks);
+	FPRINTF(stderr, "Total: %lf secs\n", timing/1000000);
+	FPRINTF(stderr, "Per task: %lf usecs\n", timing/ntasks);
 
 	starpu_shutdown();
 

+ 4 - 2
tests/core/get_current_task.c

@@ -20,6 +20,8 @@
 #include <unistd.h>
 #include <starpu.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 static unsigned ntasks = 65536;
 
 static void check_task_func(void *descr[], void *arg)
@@ -52,7 +54,7 @@ int main(int argc, char **argv)
 
 	starpu_init(NULL);
 
-	fprintf(stderr, "#tasks : %d\n", ntasks);
+	FPRINTF(stderr, "#tasks : %d\n", ntasks);
 
 	int i;
 	for (i = 0; i < ntasks; i++)
@@ -73,7 +75,7 @@ int main(int argc, char **argv)
 
 	starpu_task_wait_for_all();
 	
-	fprintf(stderr, "#empty tasks : %d\n", ntasks);
+	FPRINTF(stderr, "#empty tasks : %d\n", ntasks);
 
 	/* We repeat the same experiment with null codelets */
 

+ 5 - 3
tests/core/insert_task.c

@@ -16,6 +16,8 @@
 
 #include <starpu.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 void func_cpu(void *descr[], void *_args)
 {
 	int *x0 = (int *)STARPU_VARIABLE_GET_PTR(descr[0]);
@@ -49,7 +51,7 @@ int main(int argc, char **argv)
 	f = 2.0;
 	starpu_variable_data_register(&data_handles[1], 0, (uintptr_t)&f, sizeof(f));
 
-        fprintf(stderr, "VALUES: %d (%d) %f (%f)\n", x, ifactor, f, ffactor);
+        FPRINTF(stderr, "VALUES: %d (%d) %f (%f)\n", x, ifactor, f, ffactor);
 
         starpu_insert_task(&mycodelet,
 			   STARPU_VALUE, &ifactor, sizeof(ifactor),
@@ -61,7 +63,7 @@ int main(int argc, char **argv)
         for(i=0 ; i<2 ; i++) {
                 starpu_data_acquire(data_handles[i], STARPU_R);
         }
-        fprintf(stderr, "VALUES: %d %f\n", x, f);
+        FPRINTF(stderr, "VALUES: %d %f\n", x, f);
 
         for(i=0 ; i<2 ; i++) {
                 starpu_data_release(data_handles[i]);
@@ -86,7 +88,7 @@ int main(int argc, char **argv)
         for(i=0 ; i<2 ; i++) {
                 starpu_data_acquire(data_handles[i], STARPU_R);
         }
-        fprintf(stderr, "VALUES: %d %f\n", x, f);
+        FPRINTF(stderr, "VALUES: %d %f\n", x, f);
 
 	starpu_shutdown();
 

+ 5 - 4
tests/core/multithreaded.c

@@ -23,6 +23,7 @@
 #include <pthread.h>
 
 #include <starpu.h>
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 pthread_t threads[16];
 
@@ -66,7 +67,7 @@ void *thread_func(void *arg __attribute__((unused)))
 
 static void usage(char **argv)
 {
-	fprintf(stderr, "%s [-i ntasks] [-t nthreads] [-h]\n", argv[0]);
+	FPRINTF(stderr, "%s [-i ntasks] [-t nthreads] [-h]\n", argv[0]);
 	exit(-1);
 }
 
@@ -98,7 +99,7 @@ int main(int argc, char **argv)
 
 	starpu_init(NULL);
 
-	fprintf(stderr, "#tasks : %d\n", ntasks);
+	FPRINTF(stderr, "#tasks : %d\n", ntasks);
 
 	gettimeofday(&start, NULL);
 
@@ -119,8 +120,8 @@ int main(int argc, char **argv)
 
 	timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 
-	fprintf(stderr, "Total: %lf secs\n", timing/1000000);
-	fprintf(stderr, "Per task: %lf usecs\n", timing/(nthreads*ntasks));
+	FPRINTF(stderr, "Total: %lf secs\n", timing/1000000);
+	FPRINTF(stderr, "Per task: %lf usecs\n", timing/(nthreads*ntasks));
 
 	starpu_shutdown();
 

+ 4 - 3
tests/core/multithreaded_init.c

@@ -20,6 +20,7 @@
 #include <starpu.h>
 
 #define NUM_THREADS 5
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 void *launch_starpu(void *id)
 { 
@@ -54,9 +55,9 @@ int main(int argc, char **argv)
 
   timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 
-  fprintf(stderr, "Success : %d threads launching simultaneously starpu_init\n", NUM_THREADS);
-  fprintf(stderr, "Total: %lf secs\n", timing/1000000);
-  fprintf(stderr, "Per task: %lf usecs\n", timing/NUM_THREADS);
+  FPRINTF(stderr, "Success : %d threads launching simultaneously starpu_init\n", NUM_THREADS);
+  FPRINTF(stderr, "Total: %lf secs\n", timing/1000000);
+  FPRINTF(stderr, "Per task: %lf usecs\n", timing/NUM_THREADS);
 
   starpu_shutdown();
 

+ 6 - 4
tests/core/regenerate.c

@@ -21,6 +21,8 @@
 #include <pthread.h>
 #include <starpu.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 static unsigned ntasks = 65536;
 static unsigned cnt = 0;
 
@@ -37,7 +39,7 @@ static void callback(void *arg __attribute__ ((unused)))
 	if (cnt == ntasks)
 	{
 		task->regenerate = 0;
-		fprintf(stderr, "Stop !\n");
+		FPRINTF(stderr, "Stop !\n");
 
 		pthread_mutex_lock(&mutex);
 		completed = 1;
@@ -92,7 +94,7 @@ int main(int argc, char **argv)
 
 	task.callback_func = callback;
 
-	fprintf(stderr, "#tasks : %d\n", ntasks);
+	FPRINTF(stderr, "#tasks : %d\n", ntasks);
 
 	gettimeofday(&start, NULL);
 
@@ -108,8 +110,8 @@ int main(int argc, char **argv)
 	timing = (double)((end.tv_sec - start.tv_sec)*1000000
 				+ (end.tv_usec - start.tv_usec));
 
-	fprintf(stderr, "Total: %lf secs\n", timing/1000000);
-	fprintf(stderr, "Per task: %lf usecs\n", timing/ntasks);
+	FPRINTF(stderr, "Total: %lf secs\n", timing/1000000);
+	FPRINTF(stderr, "Per task: %lf usecs\n", timing/ntasks);
 
 	starpu_shutdown();
 

+ 5 - 3
tests/core/restart.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
@@ -22,6 +22,8 @@
 #include <starpu.h>
 #include <stdlib.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 #define N	10
 
 struct timeval start;
@@ -49,8 +51,8 @@ int main(int argc, char **argv)
 		shutdown_timing += (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 	}
 
-	fprintf(stderr, "starpu_init: %2.2f seconds\n", init_timing/(N*1000000));
-	fprintf(stderr, "starpu_shutdown: %2.2f seconds\n", shutdown_timing/(N*1000000));
+	FPRINTF(stderr, "starpu_init: %2.2f seconds\n", init_timing/(N*1000000));
+	FPRINTF(stderr, "starpu_shutdown: %2.2f seconds\n", shutdown_timing/(N*1000000));
 
 	return 0;
 }

+ 7 - 5
tests/core/starpu_task_wait.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
@@ -22,6 +22,8 @@
 
 #include <starpu.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 static unsigned ntasks = 65536;
 
 static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
@@ -40,7 +42,7 @@ static starpu_codelet dummy_codelet =
 
 static void usage(char **argv)
 {
-	fprintf(stderr, "%s [-i ntasks] [-h]\n", argv[0]);
+	FPRINTF(stderr, "%s [-i ntasks] [-h]\n", argv[0]);
 	exit(-1);
 }
 
@@ -68,7 +70,7 @@ int main(int argc, char **argv)
 
 	starpu_init(NULL);
 
-	fprintf(stderr, "#tasks : %d\n", ntasks);
+	FPRINTF(stderr, "#tasks : %d\n", ntasks);
 
 	gettimeofday(&start, NULL);
 
@@ -98,8 +100,8 @@ int main(int argc, char **argv)
 
 	timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 
-	fprintf(stderr, "Total: %lf secs\n", timing/1000000);
-	fprintf(stderr, "Per task: %lf usecs\n", timing/ntasks);
+	FPRINTF(stderr, "Total: %lf secs\n", timing/1000000);
+	FPRINTF(stderr, "Per task: %lf usecs\n", timing/ntasks);
 
 	starpu_shutdown();
 

+ 6 - 4
tests/core/starpu_task_wait_for_all.c

@@ -21,6 +21,8 @@
 #include <stdio.h>
 #include <unistd.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 static unsigned ntasks = 65536;
 
 static void dummy_func(void *descr[], void *arg)
@@ -82,7 +84,7 @@ static struct starpu_conf conf = {
 
 static void usage(char **argv)
 {
-	fprintf(stderr, "%s [-i ntasks] [-p sched_policy] [-h]\n", argv[0]);
+	FPRINTF(stderr, "%s [-i ntasks] [-p sched_policy] [-h]\n", argv[0]);
 	exit(-1);
 }
 
@@ -116,7 +118,7 @@ int main(int argc, char **argv)
 
 	init_gordon_kernel();
 
-	fprintf(stderr, "#tasks : %d\n", ntasks);
+	FPRINTF(stderr, "#tasks : %d\n", ntasks);
 
 	gettimeofday(&start, NULL);
 	for (i = 0; i < ntasks; i++)
@@ -130,8 +132,8 @@ int main(int argc, char **argv)
 
 	timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 
-	fprintf(stderr, "Total: %lf secs\n", timing/1000000);
-	fprintf(stderr, "Per task: %lf usecs\n", timing/ntasks);
+	FPRINTF(stderr, "Total: %lf secs\n", timing/1000000);
+	FPRINTF(stderr, "Per task: %lf usecs\n", timing/ntasks);
 
 	starpu_shutdown();
 

+ 6 - 4
tests/core/static_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
@@ -21,6 +21,8 @@
 
 #include <starpu.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 static unsigned ntasks = 65536;
 
 static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
@@ -68,7 +70,7 @@ int main(int argc, char **argv)
 	task.cl = &dummy_codelet;
 	task.detach = 0;
 
-	fprintf(stderr, "#tasks : %d\n", ntasks);
+	FPRINTF(stderr, "#tasks : %d\n", ntasks);
 
 	gettimeofday(&start, NULL);
 
@@ -83,8 +85,8 @@ int main(int argc, char **argv)
 	timing = (double)((end.tv_sec - start.tv_sec)*1000000
 				+ (end.tv_usec - start.tv_usec));
 
-	fprintf(stderr, "Total: %lf secs\n", timing/1000000);
-	fprintf(stderr, "Per task: %lf usecs\n", timing/ntasks);
+	FPRINTF(stderr, "Total: %lf secs\n", timing/1000000);
+	FPRINTF(stderr, "Per task: %lf usecs\n", timing/ntasks);
 
 	starpu_shutdown();
 

+ 6 - 4
tests/core/static_restartable_tag.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
@@ -21,6 +21,8 @@
 
 #include <starpu.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 static unsigned ntasks = 65536;
 static starpu_tag_t tag = 0x32;
 
@@ -72,7 +74,7 @@ int main(int argc, char **argv)
 	task.use_tag = 1;
 	task.tag_id = tag;
 
-	fprintf(stderr, "#tasks : %d\n", ntasks);
+	FPRINTF(stderr, "#tasks : %d\n", ntasks);
 
 	gettimeofday(&start, NULL);
 
@@ -87,8 +89,8 @@ int main(int argc, char **argv)
 	timing = (double)((end.tv_sec - start.tv_sec)*1000000
 				+ (end.tv_usec - start.tv_usec));
 
-	fprintf(stderr, "Total: %lf secs\n", timing/1000000);
-	fprintf(stderr, "Per task: %lf usecs\n", timing/ntasks);
+	FPRINTF(stderr, "Total: %lf secs\n", timing/1000000);
+	FPRINTF(stderr, "Per task: %lf usecs\n", timing/ntasks);
 
 	starpu_shutdown();
 

+ 6 - 4
tests/core/static_restartable_using_initializer.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
@@ -21,6 +21,8 @@
 
 #include <starpu.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 /* This is equivalent to calling starpu_task_init later on */
 struct starpu_task task = STARPU_TASK_INITIALIZER;
 
@@ -67,7 +69,7 @@ int main(int argc, char **argv)
 	task.cl = &dummy_codelet;
 	task.detach = 0;
 
-	fprintf(stderr, "#tasks : %d\n", ntasks);
+	FPRINTF(stderr, "#tasks : %d\n", ntasks);
 
 	gettimeofday(&start, NULL);
 
@@ -82,8 +84,8 @@ int main(int argc, char **argv)
 	timing = (double)((end.tv_sec - start.tv_sec)*1000000
 				+ (end.tv_usec - start.tv_usec));
 
-	fprintf(stderr, "Total: %lf secs\n", timing/1000000);
-	fprintf(stderr, "Per task: %lf usecs\n", timing/ntasks);
+	FPRINTF(stderr, "Total: %lf secs\n", timing/1000000);
+	FPRINTF(stderr, "Per task: %lf usecs\n", timing/ntasks);
 
 	starpu_shutdown();
 

+ 7 - 5
tests/core/tag_wait_api.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
@@ -21,6 +21,8 @@
 
 #include <starpu.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
@@ -38,7 +40,7 @@ static starpu_codelet dummy_codelet =
 static void callback(void *tag)
 {
 //	fflush(stderr);
-//	fprintf(stderr, "Callback for tag %p\n", tag);
+//	FPRINTF(stderr, "Callback for tag %p\n", tag);
 //	fflush(stderr);
 }
 
@@ -76,7 +78,7 @@ int main(int argc, char **argv)
 {
 	starpu_init(NULL);
 
-	fprintf(stderr, "{ A } -> { B }\n");
+	FPRINTF(stderr, "{ A } -> { B }\n");
 	fflush(stderr);
 
 	struct starpu_task *taskA, *taskB;
@@ -92,7 +94,7 @@ int main(int argc, char **argv)
 
 	starpu_tag_wait(tagB);
 	
-	fprintf(stderr, "{ C, D, E, F } -> { G }\n");
+	FPRINTF(stderr, "{ C, D, E, F } -> { G }\n");
 
 	struct starpu_task *taskC, *taskD, *taskE, *taskF, *taskG;
 
@@ -113,7 +115,7 @@ int main(int argc, char **argv)
 
 	starpu_tag_wait(tagG);
 
-	fprintf(stderr, "{ H, I } -> { J, K, L }\n");
+	FPRINTF(stderr, "{ H, I } -> { J, K, L }\n");
 	
 	struct starpu_task *taskH, *taskI, *taskJ, *taskK, *taskL;
 

+ 6 - 4
tests/core/task_wait_api.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
@@ -21,6 +21,8 @@
 
 #include <starpu.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
@@ -49,7 +51,7 @@ int main(int argc, char **argv)
 {
 	starpu_init(NULL);
 
-	fprintf(stderr, "{ A } -> { B }\n");
+	FPRINTF(stderr, "{ A } -> { B }\n");
 	fflush(stderr);
 
 	struct starpu_task *taskA, *taskB;
@@ -65,7 +67,7 @@ int main(int argc, char **argv)
 
 	starpu_task_wait(taskB);
 
-	fprintf(stderr, "{ C, D, E, F } -> { G }\n");
+	FPRINTF(stderr, "{ C, D, E, F } -> { G }\n");
 
 	struct starpu_task *taskC, *taskD, *taskE, *taskF, *taskG;
 
@@ -86,7 +88,7 @@ int main(int argc, char **argv)
 
 	starpu_task_wait(taskG);
 
-	fprintf(stderr, "{ H, I } -> { J, K, L }\n");
+	FPRINTF(stderr, "{ H, I } -> { J, K, L }\n");
 	
 	struct starpu_task *taskH, *taskI, *taskJ, *taskK, *taskL;
 

+ 6 - 4
tests/core/wait_all_regenerable_tasks.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
@@ -21,6 +21,8 @@
 #include <pthread.h>
 #include <starpu.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 static unsigned ntasks = 1024;
 
 static void callback(void *arg)
@@ -88,7 +90,7 @@ int main(int argc, char **argv)
 		task[i].callback_arg = &cnt[i];
 	}
 
-	fprintf(stderr, "#tasks : %d x %d tasks\n", K, ntasks);
+	FPRINTF(stderr, "#tasks : %d x %d tasks\n", K, ntasks);
 
 	gettimeofday(&start, NULL);
 	
@@ -109,8 +111,8 @@ int main(int argc, char **argv)
 	timing = (double)((end.tv_sec - start.tv_sec)*1000000
 				+ (end.tv_usec - start.tv_usec));
 
-	fprintf(stderr, "Total: %lf secs\n", timing/1000000);
-	fprintf(stderr, "Per task: %lf usecs\n", timing/(K*ntasks));
+	FPRINTF(stderr, "Total: %lf secs\n", timing/1000000);
+	FPRINTF(stderr, "Per task: %lf usecs\n", timing/(K*ntasks));
 
 	starpu_shutdown();
 

+ 5 - 3
tests/datawizard/acquire_release.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
@@ -17,6 +17,8 @@
 
 #include <starpu.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 static unsigned ntasks = 10000;
 
 #ifdef STARPU_USE_CUDA
@@ -63,7 +65,7 @@ int main(int argc, char **argv)
         starpu_init(NULL);
 	starpu_variable_data_register(&token_handle, 0, (uintptr_t)&token, sizeof(unsigned));
 
-        fprintf(stderr, "Token: %d\n", token);
+        FPRINTF(stderr, "Token: %d\n", token);
 
 	for(i=0; i<ntasks; i++)
 	{
@@ -79,7 +81,7 @@ int main(int argc, char **argv)
 
 	starpu_data_unregister(token_handle);
 
-        fprintf(stderr, "Token: %d\n", token);
+        FPRINTF(stderr, "Token: %d\n", token);
         STARPU_ASSERT(token==ntasks*2);
 
 	starpu_shutdown();

+ 4 - 2
tests/datawizard/acquire_release2.c

@@ -16,6 +16,8 @@
 
 #include <starpu.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 static unsigned ntasks = 40000;
 
 #ifdef STARPU_USE_CUDA
@@ -64,7 +66,7 @@ int main(int argc, char **argv)
         starpu_init(NULL);
 	starpu_variable_data_register(&token_handle, 0, (uintptr_t)&token, sizeof(unsigned));
 
-        fprintf(stderr, "Token: %d\n", token);
+        FPRINTF(stderr, "Token: %d\n", token);
 
 	for(i=0; i<ntasks; i++)
 	{
@@ -74,7 +76,7 @@ int main(int argc, char **argv)
 	}
 
 	starpu_data_unregister(token_handle);
-        fprintf(stderr, "Token: %d\n", token);
+        FPRINTF(stderr, "Token: %d\n", token);
         assert(token==ntasks);
 
 	starpu_shutdown();

+ 3 - 2
tests/datawizard/data_implicit_deps.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
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 
 #define VECTORSIZE	1024
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 static unsigned *A, *B, *C, *D;
 starpu_data_handle A_handle, B_handle, C_handle, D_handle;
@@ -55,7 +56,7 @@ static starpu_codelet cl_g = {
 
 static void h(void *descr[], __attribute__ ((unused)) void *_args)
 {
-	fprintf(stderr, "VAR %d (should be 42)\n", var);
+	FPRINTF(stderr, "VAR %d (should be 42)\n", var);
 	STARPU_ASSERT(var == 42);
 }
 

+ 2 - 1
tests/datawizard/data_invalidation.c

@@ -23,6 +23,7 @@
 
 #define NLOOPS		1000
 #define VECTORSIZE	1024
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 static starpu_data_handle v_handle;
 
@@ -72,7 +73,7 @@ static void cpu_check_content_codelet(void *descr[], __attribute__ ((unused)) vo
 	{
 		if (buf[i] != 42)
 		{
-			fprintf(stderr, "buf[%d] is %c while it should be %c\n", i, buf[i], 42);
+			FPRINTF(stderr, "buf[%d] is %c while it should be %c\n", i, buf[i], 42);
 			exit(-1);
 		}
 	}

+ 2 - 1
tests/datawizard/manual_reduction.c

@@ -24,6 +24,7 @@
 
 #define INIT_VALUE	42
 #define NTASKS		10000
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 static unsigned variable;
 static starpu_data_handle variable_handle;
@@ -81,7 +82,7 @@ static void cpu_redux_func(void *descr[], void *cl_arg __attribute__((unused)))
 	unsigned *a = (unsigned *)STARPU_VARIABLE_GET_PTR(descr[0]);
 	unsigned *b = (unsigned *)STARPU_VARIABLE_GET_PTR(descr[1]);
 
-	fprintf(stderr, "%d = %d + %d\n", *a + *b, *a, *b);
+	FPRINTF(stderr, "%d = %d + %d\n", *a + *b, *a, *b);
 
 	*a = *a + *b;
 }

+ 4 - 3
tests/datawizard/mpi_like.c

@@ -21,6 +21,7 @@
 
 #define NTHREADS	4
 #define NITER		128
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 //static pthread_cond_t cond;
 //static pthread_mutex_t mutex;
@@ -100,7 +101,7 @@ static void recv_handle(struct thread_data *thread_data)
 	thread_data->recv_flag = 0;
 	pthread_cond_signal(&thread_data->recv_cond);
 
-//	fprintf(stderr, "Thread %d received value %d from thread %d\n", thread_data->index, thread_data->val, (thread_data->index - 1)%NTHREADS);
+//	FPRINTF(stderr, "Thread %d received value %d from thread %d\n", thread_data->index, thread_data->val, (thread_data->index - 1)%NTHREADS);
 
 	pthread_mutex_unlock(&thread_data->recv_mutex);
 	starpu_data_release(thread_data->handle);
@@ -112,7 +113,7 @@ static void send_handle(struct thread_data *thread_data)
 
 	starpu_data_acquire(thread_data->handle, STARPU_R);
 
-//	fprintf(stderr, "Thread %d sends value %d to thread %d\n", thread_data->index, thread_data->val, neighbour_data->index);
+//	FPRINTF(stderr, "Thread %d sends value %d to thread %d\n", thread_data->index, thread_data->val, neighbour_data->index);
 	/* send the message */
 	pthread_mutex_lock(&neighbour_data->recv_mutex);
 	neighbour_data->recv_buf = thread_data->val;
@@ -190,7 +191,7 @@ int main(int argc, char **argv)
 	starpu_data_acquire(last_handle, STARPU_R);
 	if (problem_data[NTHREADS - 1].val != (NTHREADS * NITER))
 	{
-		fprintf(stderr, "Final value : %d should be %d\n", problem_data[NTHREADS - 1].val, (NTHREADS * NITER));
+		FPRINTF(stderr, "Final value : %d should be %d\n", problem_data[NTHREADS - 1].val, (NTHREADS * NITER));
 		STARPU_ABORT();
 	}
 	starpu_data_release(last_handle);

+ 7 - 6
tests/datawizard/mpi_like_async.c

@@ -20,6 +20,7 @@
 
 #define NTHREADS	16
 #define NITER		128
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 //#define DEBUG_MESSAGES	1
 
@@ -64,7 +65,7 @@ static void increment_handle_cpu_kernel(void *descr[], void *cl_arg __attribute_
 	unsigned *val = (unsigned *)STARPU_VARIABLE_GET_PTR(descr[0]);
 	*val += 1;
 
-//	fprintf(stderr, "VAL %d (&val = %p)\n", *val, val);
+//	FPRINTF(stderr, "VAL %d (&val = %p)\n", *val, val);
 }
 
 static starpu_codelet increment_handle_cl = {
@@ -93,7 +94,7 @@ static void increment_handle_async(struct thread_data *thread_data)
 
 static int test_recv_handle_async(void *arg)
 {
-//	fprintf(stderr, "test_recv_handle_async\n");
+//	FPRINTF(stderr, "test_recv_handle_async\n");
 
 	int ret;
 	struct thread_data *thread_data = arg;
@@ -113,7 +114,7 @@ static int test_recv_handle_async(void *arg)
 	if (ret)
 	{
 #ifdef DEBUG_MESSAGES
-		fprintf(stderr, "Thread %d received value %d from thread %d\n",
+		FPRINTF(stderr, "Thread %d received value %d from thread %d\n",
 			thread_data->index, thread_data->val, (thread_data->index - 1)%NTHREADS);
 #endif
 		starpu_data_release(thread_data->handle);
@@ -151,7 +152,7 @@ static int test_send_handle_async(void *arg)
 	if (ret)
 	{
 #ifdef DEBUG_MESSAGES
-		fprintf(stderr, "Thread %d sends value %d to thread %d\n", thread_data->index, thread_data->val, neighbour_data->index);
+		FPRINTF(stderr, "Thread %d sends value %d to thread %d\n", thread_data->index, thread_data->val, neighbour_data->index);
 #endif
 		starpu_data_release(thread_data->handle);
 	}
@@ -164,7 +165,7 @@ static void send_handle_async(void *_thread_data)
 	struct thread_data *thread_data = _thread_data;
 	struct thread_data *neighbour_data = thread_data->neighbour;
 
-//	fprintf(stderr, "send_handle_async\n");
+//	FPRINTF(stderr, "send_handle_async\n");
 
 	/* send the message */
 	pthread_mutex_lock(&neighbour_data->recv_mutex);
@@ -334,7 +335,7 @@ int main(int argc, char **argv)
 	starpu_data_acquire(last_handle, STARPU_R);
 	if (problem_data[NTHREADS - 1].val != (NTHREADS * NITER))
 	{
-		fprintf(stderr, "Final value : %d should be %d\n", problem_data[NTHREADS - 1].val, (NTHREADS * NITER));
+		FPRINTF(stderr, "Final value : %d should be %d\n", problem_data[NTHREADS - 1].val, (NTHREADS * NITER));
 		STARPU_ABORT();
 	}
 	starpu_data_release(last_handle);

+ 2 - 1
tests/datawizard/reclaim.c

@@ -26,6 +26,7 @@
 #endif
 
 #define BLOCK_SIZE	(64*1024*1024)
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 static unsigned ntasks = 1000;
 
@@ -74,7 +75,7 @@ int main(int argc, char **argv)
 	if (2*mb > ntasks)
 		ntasks = 2*mb;
 
-	fprintf(stderr, "Allocate %d buffers and create %d tasks\n", mb, ntasks);
+	FPRINTF(stderr, "Allocate %d buffers and create %d tasks\n", mb, ntasks);
 
         starpu_init(NULL);
 

+ 4 - 3
tests/datawizard/sync_and_notify_data.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
@@ -26,6 +26,7 @@
 
 #define N	100
 #define K	256
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 /*
  * In this test, we maintain a vector v = (a,b,c).
@@ -85,7 +86,7 @@ int main(int argc, char **argv)
 	unsigned kernel_incC_id = gordon_register_kernel(elf_id, "incC");
 	gordon_load_kernel_on_all_spu(kernel_incC_id);
 
-	fprintf(stderr, "kernel incA %d incC %d elf %d\n", kernel_incA_id, kernel_incC_id, elf_id);
+	FPRINTF(stderr, "kernel incA %d incC %d elf %d\n", kernel_incA_id, kernel_incC_id, elf_id);
 #endif
 
 #ifdef STARPU_USE_OPENCL
@@ -173,7 +174,7 @@ int main(int argc, char **argv)
 
 	starpu_data_acquire(v_handle, STARPU_RW);
 
-	fprintf(stderr, "V = { %d, %d, %d }\n", v[0], v[1], v[2]);
+	FPRINTF(stderr, "V = { %d, %d, %d }\n", v[0], v[1], v[2]);
 
 	starpu_data_release(v_handle);
 

+ 4 - 3
tests/datawizard/sync_and_notify_data_implicit.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
@@ -28,6 +28,7 @@
 #define K	256
 //#define N	1
 //#define K	1
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 /*
  * In this test, we maintain a vector v = (a,b,c).
@@ -119,7 +120,7 @@ int main(int argc, char **argv)
 	unsigned kernel_incC_id = gordon_register_kernel(elf_id, "incC");
 	gordon_load_kernel_on_all_spu(kernel_incC_id);
 
-	fprintf(stderr, "kernel incA %d incC %d elf %d\n", kernel_incA_id, kernel_incC_id, elf_id);
+	FPRINTF(stderr, "kernel incA %d incC %d elf %d\n", kernel_incA_id, kernel_incC_id, elf_id);
 #endif
 
 #ifdef STARPU_USE_OPENCL
@@ -171,7 +172,7 @@ int main(int argc, char **argv)
 
 	starpu_data_acquire(v_handle, STARPU_RW);
 
-	fprintf(stderr, "V = { %d, %d, %d }\n", v[0], v[1], v[2]);
+	FPRINTF(stderr, "V = { %d, %d, %d }\n", v[0], v[1], v[2]);
 
 	starpu_data_release(v_handle);
 

+ 8 - 6
tests/helper/cublas_init.c

@@ -22,6 +22,8 @@
 #include <starpu.h>
 #include <stdlib.h>
 
+#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+
 struct timeval start;
 struct timeval end;
 
@@ -46,16 +48,16 @@ int main(int argc, char **argv)
 	gettimeofday(&end, NULL);
 	shutdown_timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 
-	fprintf(stderr, "Total:\n");
-	fprintf(stderr, "\tinit: %2.2f us\n", init_timing/(1000));
-	fprintf(stderr, "\tshutdown: %2.2f us\n", shutdown_timing/(1000));
+	FPRINTF(stderr, "Total:\n");
+	FPRINTF(stderr, "\tinit: %2.2f us\n", init_timing/(1000));
+	FPRINTF(stderr, "\tshutdown: %2.2f us\n", shutdown_timing/(1000));
 
 	if (ngpus != 0)
 	{
-		fprintf(stderr, "per-GPU (#gpu = %d):\n", ngpus);
+		FPRINTF(stderr, "per-GPU (#gpu = %d):\n", ngpus);
 
-		fprintf(stderr, "\tinit: %2.2f us\n", init_timing/(1000*ngpus));
-		fprintf(stderr, "\tshutdown: %2.2f us\n", shutdown_timing/(1000*ngpus));
+		FPRINTF(stderr, "\tinit: %2.2f us\n", init_timing/(1000*ngpus));
+		FPRINTF(stderr, "\tshutdown: %2.2f us\n", shutdown_timing/(1000*ngpus));
 	}
 
 	starpu_shutdown();