From 2b75e497aa36076797fc4ac73025a901011b7cac Mon Sep 17 00:00:00 2001 From: Gary Frost <frost.gary@gmail.com> Date: Tue, 15 Nov 2011 18:44:20 +0000 Subject: [PATCH] Hack/Workaround for issue #18. Certainly not a fix. Forces only one device in multi-device config to be used. Bizarely this is also more performant. --- com.amd.aparapi.jni/src/cpp/aparapi.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/com.amd.aparapi.jni/src/cpp/aparapi.cpp b/com.amd.aparapi.jni/src/cpp/aparapi.cpp index d5863292..29fa4c27 100644 --- a/com.amd.aparapi.jni/src/cpp/aparapi.cpp +++ b/com.amd.aparapi.jni/src/cpp/aparapi.cpp @@ -447,6 +447,15 @@ class JNIContext{ status = clGetDeviceIDs(platforms[i], deviceType, 0, NULL, &deviceIdc); // now check if this platform supports the requested device type (GPU or CPU) if (status == CL_SUCCESS && deviceIdc >0 ){ + if (deviceIdc >1){ + if (isVerbose()){ + fprintf(stderr, "Warning attempt to use %d devices\n", deviceIdc); + } + deviceIdc = 1; // Hack to work around issue #18 (multiple device error) + if (isVerbose()){ + fprintf(stderr, "Locking deviceIdc to %d to work around issue #18\n", deviceIdc); + } + } platform = platforms[i]; if (isVerbose()){ fprintf(stderr, "platform %s supports requested device type\n", platformVendorName); -- GitLab