Pārlūkot izejas kodu

OpenCL: do not compile kernel on invalid devices

Nathalie Furmento 14 gadi atpakaļ
vecāks
revīzija
c3bfa8def3

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

@@ -133,6 +133,8 @@ cl_int _starpu_opencl_deinit_context(int devid)
         err = clReleaseCommandQueue(queues[devid]);
         if (err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err);
 
+        contexts[devid] = NULL;
+
 	PTHREAD_MUTEX_UNLOCK(&big_lock);
 
         return CL_SUCCESS;

+ 5 - 0
src/drivers/opencl/driver_opencl_utils.c

@@ -134,6 +134,11 @@ int starpu_opencl_load_opencl_from_string(char *opencl_program_source, struct st
 
                 starpu_opencl_get_device(dev, &device);
                 starpu_opencl_get_context(dev, &context);
+                if (context == NULL) {
+                        _STARPU_DEBUG("[%d] is not a valid OpenCL context\n", dev);
+                        continue;
+                }
+
                 opencl_programs->programs[dev] = NULL;
 
                 if (context == NULL) continue;