Browse Source

socl/src/cl_getdeviceids.c: on StarPU failure, get soclGetDeviceIDs to return 0 devices

Nathalie Furmento 13 years ago
parent
commit
487872598d
1 changed files with 10 additions and 4 deletions
  1. 10 4
      socl/src/cl_getdeviceids.c

+ 10 - 4
socl/src/cl_getdeviceids.c

@@ -26,13 +26,19 @@
  */
 CL_API_ENTRY cl_int CL_API_CALL
 soclGetDeviceIDs(cl_platform_id   platform,
-               cl_device_type   device_type, 
-               cl_uint          num_entries, 
-               cl_device_id *   devices, 
+               cl_device_type   device_type,
+               cl_uint          num_entries,
+               cl_device_id *   devices,
                cl_uint *        num_devices) CL_API_SUFFIX__VERSION_1_0
 {
    if( ! _starpu_init )
-      socl_init_starpu(); 
+      socl_init_starpu();
+
+   if (_starpu_init_failed) {
+	*num_devices = 0;
+	return CL_SUCCESS;
+   }
+
    if (platform != NULL && platform != &socl_platform)
       return CL_INVALID_PLATFORM;