Quellcode durchsuchen

src: use _STARPU_DISP instead of fprintf. It allows to clearly identify StarPU messages

Nathalie Furmento vor 12 Jahren
Ursprung
Commit
0ed12ad157
5 geänderte Dateien mit 23 neuen und 54 gelöschten Zeilen
  1. 1 2
      src/core/sched_policy.c
  2. 4 4
      src/core/task.c
  3. 7 37
      src/core/topology.c
  4. 9 9
      src/core/workers.c
  5. 2 2
      src/sched_policies/eager_central_policy.c

+ 1 - 2
src/core/sched_policy.c

@@ -340,8 +340,7 @@ struct starpu_task *_starpu_create_conversion_task(starpu_data_handle_t handle,
 		}
 #endif
 		default:
-			fprintf(stderr, "Oops : %u\n", handle->mf_node);
-			STARPU_ABORT();
+			_STARPU_ERROR("Oops : %u\n", handle->mf_node);
 		}
 		break;
 #ifdef STARPU_USE_CUDA

+ 4 - 4
src/core/task.c

@@ -245,7 +245,7 @@ void _starpu_codelet_check_deprecated_fields(struct starpu_codelet *cl)
 	/* CPU */
 	if (cl->cpu_func && cl->cpu_func != STARPU_MULTIPLE_CPU_IMPLEMENTATIONS && cl->cpu_funcs[0])
 	{
-		fprintf(stderr, "[warning] [struct starpu_codelet] both cpu_func and cpu_funcs are set. Ignoring cpu_func.\n");
+		_STARPU_DISP("[warning] [struct starpu_codelet] both cpu_func and cpu_funcs are set. Ignoring cpu_func.\n");
 		cl->cpu_func = STARPU_MULTIPLE_CPU_IMPLEMENTATIONS;
 	}
 	if (cl->cpu_func && cl->cpu_func != STARPU_MULTIPLE_CPU_IMPLEMENTATIONS)
@@ -265,7 +265,7 @@ void _starpu_codelet_check_deprecated_fields(struct starpu_codelet *cl)
 	/* CUDA */
 	if (cl->cuda_func && cl->cuda_func != STARPU_MULTIPLE_CUDA_IMPLEMENTATIONS && cl->cuda_funcs[0])
 	{
-		fprintf(stderr, "[warning] [struct starpu_codelet] both cuda_func and cuda_funcs are set. Ignoring cuda_func.\n");
+		_STARPU_DISP("[warning] [struct starpu_codelet] both cuda_func and cuda_funcs are set. Ignoring cuda_func.\n");
 		cl->cuda_func = STARPU_MULTIPLE_CUDA_IMPLEMENTATIONS;
 	}
 	if (cl->cuda_func && cl->cuda_func != STARPU_MULTIPLE_CUDA_IMPLEMENTATIONS)
@@ -285,7 +285,7 @@ void _starpu_codelet_check_deprecated_fields(struct starpu_codelet *cl)
 	/* OpenCL */
 	if (cl->opencl_func && cl->opencl_func != STARPU_MULTIPLE_OPENCL_IMPLEMENTATIONS && cl->opencl_funcs[0])
 	{
-		fprintf(stderr, "[warning] [struct starpu_codelet] both opencl_func and opencl_funcs are set. Ignoring opencl_func.\n");
+		_STARPU_DISP("[warning] [struct starpu_codelet] both opencl_func and opencl_funcs are set. Ignoring opencl_func.\n");
 		cl->opencl_func = STARPU_MULTIPLE_OPENCL_IMPLEMENTATIONS;
 	}
 	if (cl->opencl_func && cl->opencl_func != STARPU_MULTIPLE_OPENCL_IMPLEMENTATIONS)
@@ -327,7 +327,7 @@ void _starpu_task_check_deprecated_fields(struct starpu_task *task)
 		{
 			if (task->buffers[i].handle && task->handles[i])
 			{
-				fprintf(stderr, "[warning][struct starpu_task] task->buffers[%u] and task->handles[%u] both set. Ignoring task->buffers[%u] ?\n", i, i, i);
+				_STARPU_DISP("[warning][struct starpu_task] task->buffers[%u] and task->handles[%u] both set. Ignoring task->buffers[%u] ?\n", i, i, i);
 				STARPU_ASSERT(task->buffers[i].mode == task->cl->modes[i]);
 				STARPU_ABORT();
 			}

+ 7 - 37
src/core/topology.c

@@ -468,10 +468,7 @@ _starpu_init_machine_config (struct _starpu_machine_config *config)
 			{
 				/* The user requires more CUDA devices than
 				 * there is available */
-				fprintf(stderr,
-					"# Warning: %d CUDA devices "
-					"requested. Only %d available.\n",
-					ncuda, nb_devices);
+				_STARPU_DISP("Warning: %d CUDA devices requested. Only %d available.\n", ncuda, nb_devices);
 				ncuda = nb_devices;
 			}
 		}
@@ -523,14 +520,7 @@ _starpu_init_machine_config (struct _starpu_machine_config *config)
 			nopencl = nb_devices;
 			if (nopencl > STARPU_MAXOPENCLDEVS)
 			{
-				fprintf(stderr,
-					"# Warning: %d OpenCL devices "
-					"available. Only %d enabled. "
-					"Use configure option "
-					"--enable-maxopencldadev=xxx to "
-					"update the maximum value of "
-					"supported OpenCL devices.\n",
-					nb_devices, STARPU_MAXOPENCLDEVS);
+				_STARPU_DISP("Warning: %d OpenCL devices available. Only %d enabled. Use configure option --enable-maxopencldadev=xxx to update the maximum value of supported OpenCL devices.\n", nb_devices, STARPU_MAXOPENCLDEVS);
 				nopencl = STARPU_MAXOPENCLDEVS;
 			}
 		}
@@ -541,23 +531,13 @@ _starpu_init_machine_config (struct _starpu_machine_config *config)
 			{
 				/* The user requires more OpenCL devices than
 				 * there is available */
-				fprintf(stderr,
-					"# Warning: %d OpenCL devices "
-					"requested. Only %d available.\n",
-					nopencl, nb_devices);
+				_STARPU_DISP("Warning: %d OpenCL devices requested. Only %d available.\n", nopencl, nb_devices);
 				nopencl = nb_devices;
 			}
 			/* Let's make sure this value is OK. */
 			if (nopencl > STARPU_MAXOPENCLDEVS)
 			{
-				fprintf(stderr,
-					"# Warning: %d OpenCL devices "
-					"requested. Only %d enabled. Use "
-					"configure option "
-					"--enable-maxopencldev=xxx to update "
-					"the maximum value of supported "
-					"OpenCL devices.\n",
-					nopencl, STARPU_MAXOPENCLDEVS);
+				_STARPU_DISP("Warning: %d OpenCL devices requested. Only %d enabled. Use configure option --enable-maxopencldev=xxx to update the maximum value of supported OpenCL devices.\n", nopencl, STARPU_MAXOPENCLDEVS);
 				nopencl = STARPU_MAXOPENCLDEVS;
 			}
 		}
@@ -605,10 +585,7 @@ _starpu_init_machine_config (struct _starpu_machine_config *config)
 			STARPU_ASSERT(ngordon <= NMAXGORDONSPUS);
 			if (ngordon > STARPU_MAXGORDONSPUS);
 			{
-				fprintf(stderr,
-					"# Warning: %d Gordon CPUs devices "
-					"requested. Only %d supported\n",
-					ngordon, NMAXGORDONSPUS);
+				_STARPU_DISP("Warning: %d Gordon CPUs devices requested. Only %d supported\n", ngordon, NMAXGORDONSPUS);
 				ngordon = NMAXGORDONSPUS;
 			}
 		}
@@ -652,13 +629,7 @@ _starpu_init_machine_config (struct _starpu_machine_config *config)
 		{
 			if (ncpu > STARPU_MAXCPUS)
 			{
-				fprintf(stderr,
-					"# Warning: %d CPU devices requested."
-					" Only %d enabled. Use configure "
-					"option --enable-maxcpus=xxx to "
-					"update the maximum value of "
-					"supported CPU devices.\n",
-					ncpu, STARPU_MAXCPUS);
+				_STARPU_DISP("Warning: %d CPU devices requested. Only %d enabled. Use configure option --enable-maxcpus=xxx to update the maximum value of supported CPU devices.\n", ncpu, STARPU_MAXCPUS);
 				ncpu = STARPU_MAXCPUS;
 			}
 		}
@@ -750,8 +721,7 @@ _starpu_bind_thread_on_cpu (
 	DWORD mask = 1 << cpuid;
 	if (!SetThreadAffinityMask(GetCurrentThread(), mask))
 	{
-		fprintf(stderr,"SetThreadMaskAffinity(%lx) failed\n", mask);
-		STARPU_ABORT();
+		_STARPU_ERROR("SetThreadMaskAffinity(%lx) failed\n", mask);
 	}
 #else
 #warning no CPU binding support

+ 9 - 9
src/core/workers.c

@@ -642,31 +642,31 @@ int starpu_init(struct starpu_conf *user_conf)
 
 #ifdef __GNUC__
 #ifndef __OPTIMIZE__
-	if (!getenv("STARPU_SILENT")) fprintf(stderr,"Warning: StarPU was configured with --enable-debug (-O0), and is thus not optimized\n");
+	_STARPU_DISP("Warning: StarPU was configured with --enable-debug (-O0), and is thus not optimized\n");
 #endif
 #endif
 #if 0
 #ifndef STARPU_NO_ASSERT
-	if (!getenv("STARPU_SILENT")) fprintf(stderr,"Warning: StarPU was configured without --enable-fast\n");
+	_STARPU_DISP("Warning: StarPU was configured without --enable-fast\n");
 #endif
 #endif
 #ifdef STARPU_MEMORY_STATUS
-	if (!getenv("STARPU_SILENT")) fprintf(stderr,"Warning: StarPU was configured with --enable-memory-status, which slows down a bit\n");
+	_STARPU_DISP("Warning: StarPU was configured with --enable-memory-status, which slows down a bit\n");
 #endif
 #ifdef STARPU_VERBOSE
-	if (!getenv("STARPU_SILENT")) fprintf(stderr,"Warning: StarPU was configured with --enable-verbose, which slows down a bit\n");
+	_STARPU_DISP("Warning: StarPU was configured with --enable-verbose, which slows down a bit\n");
 #endif
 #ifdef STARPU_USE_FXT
-	if (!getenv("STARPU_SILENT")) fprintf(stderr,"Warning: StarPU was configured with --with-fxt, which slows down a bit\n");
+	_STARPU_DISP("Warning: StarPU was configured with --with-fxt, which slows down a bit\n");
 #endif
 #ifdef STARPU_PERF_DEBUG
-	if (!getenv("STARPU_SILENT")) fprintf(stderr,"Warning: StarPU was configured with --enable-perf-debug, which slows down a bit\n");
+	_STARPU_DISP("Warning: StarPU was configured with --enable-perf-debug, which slows down a bit\n");
 #endif
 #ifdef STARPU_MODEL_DEBUG
-	if (!getenv("STARPU_SILENT")) fprintf(stderr,"Warning: StarPU was configured with --enable-model-debug, which slows down a bit\n");
+	_STARPU_DISP("Warning: StarPU was configured with --enable-model-debug, which slows down a bit\n");
 #endif
 #ifdef STARPU_DATA_STATS
-	if (!getenv("STARPU_SILENT")) fprintf(stderr,"Warning: StarPU was configured with --enable-stats, which slows down a bit\n");
+	_STARPU_DISP("Warning: StarPU was configured with --enable-stats, which slows down a bit\n");
 #endif
 
 	_STARPU_PTHREAD_MUTEX_LOCK(&init_mutex);
@@ -703,7 +703,7 @@ int starpu_init(struct starpu_conf *user_conf)
 	else
 	{
 	     if (user_conf->magic != 42) {
-		fprintf(stderr, "starpu_conf structure needs to be initialized with starpu_conf_init\n");
+		_STARPU_DISP("starpu_conf structure needs to be initialized with starpu_conf_init\n");
 		return -EINVAL;
 	     }
 	     config.conf = user_conf;

+ 2 - 2
src/sched_policies/eager_central_policy.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2012  Université de Bordeaux 1
- * Copyright (C) 2010-2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010-2012  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -32,7 +32,7 @@ static pthread_mutex_t sched_mutex;
 static void initialize_eager_center_policy(struct starpu_machine_topology *topology,
 		   __attribute__ ((unused)) struct starpu_sched_policy *_policy)
 {
-	if (!getenv("STARPU_SILENT")) fprintf(stderr,"Warning: you are running the default eager scheduler, which is not very smart. Make sure to read the StarPU documentation about adding performance models in order to be able to use the heft or dmda schedulers instead.\n");
+	_STARPU_DISP("Warning: you are running the default eager scheduler, which is not very smart. Make sure to read the StarPU documentation about adding performance models in order to be able to use the heft or dmda schedulers instead.\n");
 
 	/* there is only a single queue in that trivial design */
 	fifo = _starpu_create_fifo();