summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/mbien/opencl/CLPlatform.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/com/mbien/opencl/CLPlatform.java b/src/com/mbien/opencl/CLPlatform.java
index 2f3cbf54..c3b1a1f2 100644
--- a/src/com/mbien/opencl/CLPlatform.java
+++ b/src/com/mbien/opencl/CLPlatform.java
@@ -98,6 +98,12 @@ public final class CLPlatform {
//find all devices
int ret = cl.clGetDeviceIDs(ID, type.TYPE, 0, null, ib);
+
+ // return an empty array rather than throwing an exception
+ if(ret == CL.CL_DEVICE_NOT_FOUND) {
+ return new CLDevice[0];
+ }
+
checkForError(ret, "error while enumerating devices");
PointerBuffer deviceIDs = PointerBuffer.allocateDirect(ib.get(0));