diff --git a/src/wrapper/wrap_cl.hpp b/src/wrapper/wrap_cl.hpp index 0ec76c306cf587e1a811e6cb25db376c59483225..02ba206db8d755afbded253380681bc48a7ee306 100644 --- a/src/wrapper/wrap_cl.hpp +++ b/src/wrapper/wrap_cl.hpp @@ -848,8 +848,16 @@ namespace pyopencl inline py::list platform::get_devices(cl_device_type devtype) { cl_uint num_devices = 0; - PYOPENCL_CALL_GUARDED(clGetDeviceIDs, - (m_platform, devtype, 0, 0, &num_devices)); + PYOPENCL_PRINT_CALL_TRACE("clGetDeviceIDs"); + { + cl_int status_code; + status_code = clGetDeviceIDs(m_platform, devtype, 0, 0, &num_devices); + if (status_code != CL_DEVICE_NOT_FOUND) + num_devices = 0; + else if (status_code != CL_SUCCESS) \ + throw pyopencl::error("clGetDeviceIDs", status_code); + } + if (num_devices == 0) return py::list();