Browse Source

OpenCL driver: new environment variable STARPU_OPENCL_ONLY_ON_CPUS to only enable OpenCL CPU devices

Nathalie Furmento 12 years ago
parent
commit
0477bb8510
3 changed files with 12 additions and 0 deletions
  1. 3 0
      ChangeLog
  2. 7 0
      doc/chapters/configuration.texi
  3. 2 0
      src/drivers/opencl/driver_opencl.c

+ 3 - 0
ChangeLog

@@ -61,6 +61,9 @@ New features:
   * Add support for OpenCL simulators (which provide simulated execution time)
   * Add support for OpenCL simulators (which provide simulated execution time)
   * Add support for Temanejo, a task graph debugger
   * Add support for Temanejo, a task graph debugger
   * Theoretical bound lp output now includes data transfer time.
   * Theoretical bound lp output now includes data transfer time.
+  * Update OpenCL driver to only enable CPU devices (the environment
+        variable STARPU_OPENCL_ONLY_ON_CPUS must be set to a positive
+	value when executing an application)
 
 
 Changes:
 Changes:
   * Fix the block filter functions.
   * Fix the block filter functions.

+ 7 - 0
doc/chapters/configuration.texi

@@ -348,6 +348,13 @@ devices. By setting the environment variable
 CPU devices.
 CPU devices.
 @end defvr
 @end defvr
 
 
+@defvr {Environment variable} STARPU_OPENCL_ONLY_ON_CPUS
+By default, the OpenCL driver enables GPU and accelerator
+devices. By setting the environment variable
+@code{STARPU_OPENCL_ONLY_ON_CPUS} to 1, the OpenCL driver will ONLY enable
+CPU devices.
+@end defvr
+
 @defvr {Environment variable} STARPU_WORKERS_NOBIND
 @defvr {Environment variable} STARPU_WORKERS_NOBIND
 Setting it to non-zero will prevent StarPU from binding its threads to
 Setting it to non-zero will prevent StarPU from binding its threads to
 CPUs. This is for instance useful when running the testsuite in parallel.
 CPUs. This is for instance useful when running the testsuite in parallel.

+ 2 - 0
src/drivers/opencl/driver_opencl.c

@@ -345,6 +345,8 @@ void _starpu_opencl_init(void)
                 // Get Platforms
                 // Get Platforms
 		if (starpu_get_env_number("STARPU_OPENCL_ON_CPUS") > 0)
 		if (starpu_get_env_number("STARPU_OPENCL_ON_CPUS") > 0)
 		     device_type |= CL_DEVICE_TYPE_CPU;
 		     device_type |= CL_DEVICE_TYPE_CPU;
+		if (starpu_get_env_number("STARPU_OPENCL_ONLY_ON_CPUS") > 0)
+		     device_type = CL_DEVICE_TYPE_CPU;
                 err = clGetPlatformIDs(_STARPU_OPENCL_PLATFORM_MAX, platform_id, &nb_platforms);
                 err = clGetPlatformIDs(_STARPU_OPENCL_PLATFORM_MAX, platform_id, &nb_platforms);
                 if (STARPU_UNLIKELY(err != CL_SUCCESS)) nb_platforms=0;
                 if (STARPU_UNLIKELY(err != CL_SUCCESS)) nb_platforms=0;
                 _STARPU_DEBUG("Platforms detected: %u\n", nb_platforms);
                 _STARPU_DEBUG("Platforms detected: %u\n", nb_platforms);