浏览代码

New STARPU_DISABLE_KERNELS environment variable to disable actual kernel execution.

Samuel Thibault 11 年之前
父节点
当前提交
d448281fc3

+ 2 - 0
ChangeLog

@@ -65,6 +65,8 @@ Small features:
     to execute the task.
   * New STARPU_DISABLE_PINNING environment variable to disable host memory
     pinning.
+  * New STARPU_DISABLE_KERNELS environment variable to disable actual kernel
+    execution.
 
 Changes:
   * Fix of the livelock issue discovered while executing applications

+ 5 - 0
doc/doxygen/chapters/11debugging_tools.doxy

@@ -23,6 +23,11 @@ Valgrind can be used on StarPU: valgrind.h just needs to be found at ./configure
 time, to tell valgrind about some known false positives and disable host memory
 pinning.
 
+The STARPU_DISABLE_KERNELS environment variable can also be set to 1 to make
+StarPU do everything (schedule tasks, transfer memory, etc.) except actually
+calling the application-provided kernel functions, i.e. the computation will not
+happen. This permits to quickly check that the task scheme is working properly.
+
 The Temanejo task debugger can also be used, see \ref UsingTheTemanejoTaskDebugger.
 
 \section UsingTheTemanejoTaskDebugger Using The Temanejo Task Debugger

+ 9 - 0
doc/doxygen/chapters/40environment_variables.doxy

@@ -577,6 +577,15 @@ dog is reached, thus allowing to catch the situation in gdb, etc
 (see \ref DetectionStuckConditions)
 </dd>
 
+<dt>STARPU_DISABLE_KERNELS</dt>
+<dd>
+\anchor STARPU_DISABLE_KERNELS
+\addindex __env__STARPU_DISABLE_KERNELS
+When set to a value other than 1, it disables actually calling the kernel
+functions, thus allowing to quickly check that the task scheme is working
+properly, without performing the actual application-provided computation.
+</dd>
+
 </dl>
 
 \section ConfiguringTheHypervisor Configuring The Hypervisor

+ 5 - 2
src/drivers/cpu/driver_cpu.c

@@ -156,11 +156,14 @@ static int execute_job_on_cpu(struct _starpu_job *j, struct starpu_task *worker_
 			/* bind to parallel worker */
 			_starpu_bind_thread_on_cpus(cpu_args->config, _starpu_get_combined_worker_struct(j->combined_workerid));
 		STARPU_ASSERT_MSG(func, "when STARPU_CPU is defined in 'where', cpu_func or cpu_funcs has to be defined");
+		if (starpu_get_env_number("STARPU_DISABLE_KERNELS") <= 0)
+		{
 #ifdef STARPU_SIMGRID
-		_starpu_simgrid_execute_job(j, perf_arch, NAN);
+			_starpu_simgrid_execute_job(j, perf_arch, NAN);
 #else
-		func(_STARPU_TASK_GET_INTERFACES(task), task->cl_arg);
+			func(_STARPU_TASK_GET_INTERFACES(task), task->cl_arg);
 #endif
+		}
 		if (is_parallel_task && cl->type == STARPU_FORKJOIN)
 			/* rebind to single CPU */
 			_starpu_bind_thread_on_cpu(cpu_args->config, cpu_args->bindid);

+ 5 - 2
src/drivers/cuda/driver_cuda.c

@@ -352,11 +352,14 @@ static int execute_job_on_cuda(struct _starpu_job *j, struct _starpu_worker *arg
 	starpu_cuda_func_t func = _starpu_task_get_cuda_nth_implementation(cl, j->nimpl);
 	STARPU_ASSERT_MSG(func, "when STARPU_CUDA is defined in 'where', cuda_func or cuda_funcs has to be defined");
 
+	if (starpu_get_env_number("STARPU_DISABLE_KERNELS") <= 0)
+	{
 #ifdef STARPU_SIMGRID
-	_starpu_simgrid_execute_job(j, &args->perf_arch, NAN);
+		_starpu_simgrid_execute_job(j, &args->perf_arch, NAN);
 #else
-	func(_STARPU_TASK_GET_INTERFACES(task), task->cl_arg);
+		func(_STARPU_TASK_GET_INTERFACES(task), task->cl_arg);
 #endif
+	}
 
 	_starpu_driver_end_job(args, j, &args->perf_arch, &codelet_end, 0, profiling);
 

+ 5 - 2
src/drivers/mp_common/sink_common.c

@@ -478,8 +478,11 @@ static void _starpu_sink_common_execute_kernel(struct _starpu_mp_node *node, int
 	}
 	if(task->type != STARPU_FORKJOIN || worker->current_rank == 0)
 	{
-		/* execute the task */
-		task->kernel(task->interfaces,task->cl_arg);
+		if (starpu_get_env_number("STARPU_DISABLE_KERNELS") <= 0)
+		{
+			/* execute the task */
+			task->kernel(task->interfaces,task->cl_arg);
+		}
 	}
 
 	/* If it's a parallel task */

+ 2 - 2
src/drivers/mp_common/source_common.c

@@ -321,7 +321,7 @@ int _starpu_src_common_execute_kernel(struct _starpu_mp_node *node,
 	buffer_size = sizeof(kernel) + sizeof(coreid) + sizeof(type)
 		+ sizeof(nb_interfaces) + nb_interfaces * sizeof(union _starpu_interface) + sizeof(is_parallel_task);
 	
-	/*if the task is paralle*/
+	/*if the task is parallel*/
 	if(is_parallel_task)
 	{
 		buffer_size += sizeof(cb_workerid); 
@@ -716,7 +716,7 @@ void _starpu_src_common_worker(struct _starpu_worker_set * worker_set,
 							/* The task task has been launched with no error */
 							break;
 						case -EAGAIN:
-							_STARPU_DISP("ouch, Xeon Phi could not actually run task %p, putting it back...\n", tasks[i]);
+							_STARPU_DISP("ouch, this MP worker could not actually run task %p, putting it back...\n", tasks[i]);
 							_starpu_push_task_to_workers(tasks[i]);
 							STARPU_ABORT();
 							continue;

+ 19 - 16
src/drivers/opencl/driver_opencl.c

@@ -833,25 +833,28 @@ static int _starpu_opencl_execute_job(struct _starpu_job *j, struct _starpu_work
 	starpu_opencl_func_t func = _starpu_task_get_opencl_nth_implementation(cl, j->nimpl);
 	STARPU_ASSERT_MSG(func, "when STARPU_OPENCL is defined in 'where', opencl_func or opencl_funcs has to be defined");
 
+	if (starpu_get_env_number("STARPU_DISABLE_KERNELS") <= 0)
+	{
 #ifdef STARPU_SIMGRID
-	double length = NAN;
-  #ifdef STARPU_OPENCL_SIMULATOR
-	func(_STARPU_TASK_GET_INTERFACES(task), task->cl_arg);
-    #ifndef CL_PROFILING_CLOCK_CYCLE_COUNT
-      #ifdef CL_PROFILING_COMMAND_SHAVE_CYCLE_COUNT
-        #define CL_PROFILING_CLOCK_CYCLE_COUNT CL_PROFILING_COMMAND_SHAVE_CYCLE_COUNT
-      #else
-        #error The OpenCL simulator must provide CL_PROFILING_CLOCK_CYCLE_COUNT
-      #endif
-    #endif
-	struct starpu_profiling_task_info *profiling_info = task->profiling_info;
-	STARPU_ASSERT_MSG(profiling_info->used_cycles, "Application kernel must call starpu_opencl_collect_stats to collect simulated time");
-	length = ((double) profiling_info->used_cycles)/MSG_get_host_speed(MSG_host_self());
-  #endif
-	_starpu_simgrid_execute_job(j, &args->perf_arch, length);
+		double length = NAN;
+	  #ifdef STARPU_OPENCL_SIMULATOR
+		func(_STARPU_TASK_GET_INTERFACES(task), task->cl_arg);
+	    #ifndef CL_PROFILING_CLOCK_CYCLE_COUNT
+	      #ifdef CL_PROFILING_COMMAND_SHAVE_CYCLE_COUNT
+		#define CL_PROFILING_CLOCK_CYCLE_COUNT CL_PROFILING_COMMAND_SHAVE_CYCLE_COUNT
+	      #else
+		#error The OpenCL simulator must provide CL_PROFILING_CLOCK_CYCLE_COUNT
+	      #endif
+	    #endif
+		struct starpu_profiling_task_info *profiling_info = task->profiling_info;
+		STARPU_ASSERT_MSG(profiling_info->used_cycles, "Application kernel must call starpu_opencl_collect_stats to collect simulated time");
+		length = ((double) profiling_info->used_cycles)/MSG_get_host_speed(MSG_host_self());
+	  #endif
+		_starpu_simgrid_execute_job(j, &args->perf_arch, length);
 #else
-	func(_STARPU_TASK_GET_INTERFACES(task), task->cl_arg);
+		func(_STARPU_TASK_GET_INTERFACES(task), task->cl_arg);
 #endif
+	}
 
 	_starpu_driver_end_job(args, j, &args->perf_arch, &codelet_end, 0, profiling);