[clinfo] 05/30: Handle lack of platforms more gracefully

Andreas Beckmann anbe at moszumanska.debian.org
Tue Apr 28 12:53:51 UTC 2015


This is an automated email from the git hooks/post-receive script.

anbe pushed a commit to branch master
in repository clinfo.

commit 4725689a48cf921ebcf475e06e1a3416610239ba
Author: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
Date:   Tue Nov 18 21:11:31 2014 +0100

    Handle lack of platforms more gracefully
---
 src/clinfo.c | 3 ++-
 src/ext.h    | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/clinfo.c b/src/clinfo.c
index bfb28af..00c30bd 100644
--- a/src/clinfo.c
+++ b/src/clinfo.c
@@ -2360,7 +2360,8 @@ int main(int argc, char *argv[])
 	bufsz = 1024;
 
 	error = clGetPlatformIDs(0, NULL, &num_platforms);
-	CHECK_ERROR("number of platforms");
+	if (error != CL_PLATFORM_NOT_FOUND_KHR)
+		CHECK_ERROR("number of platforms");
 
 	printf(I0_STR "%u\n",
 		(output_mode == CLINFO_HUMAN ?
diff --git a/src/ext.h b/src/ext.h
index cf5e245..e68a036 100644
--- a/src/ext.h
+++ b/src/ext.h
@@ -52,6 +52,8 @@ typedef cl_bitfield         cl_device_svm_capabilities;
 
 /* cl_khr_icd */
 #define CL_PLATFORM_ICD_SUFFIX_KHR			0x0920
+#define CL_PLATFORM_NOT_FOUND_KHR			-1001
+
 
 /* cl_khr_fp64 */
 #define CL_DEVICE_DOUBLE_FP_CONFIG			0x1032

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/clinfo.git



More information about the Pkg-opencl-commits mailing list