[clinfo] 43/148: Better solution to handle no-dev platforms

Andreas Beckmann anbe at moszumanska.debian.org
Mon Nov 17 14:09:43 UTC 2014


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

anbe pushed a commit to branch clinfo
in repository clinfo.

commit 8173cce33d817df635098de7025708834943b590
Author: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
Date:   Mon Apr 21 21:30:07 2014 +0200

    Better solution to handle no-dev platforms
    
    This should also work fine when no platforms has devices available.
---
 src/clinfo.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/clinfo.c b/src/clinfo.c
index 887c12b..e3052d3 100644
--- a/src/clinfo.c
+++ b/src/clinfo.c
@@ -685,15 +685,18 @@ int main(void)
 		puts("");
 	}
 
-
-	ALLOC(all_devices, num_devs_all, "device IDs");
+	if (num_devs_all > 0)
+		ALLOC(all_devices, num_devs_all, "device IDs");
 
 	for (p = 0, device = all_devices;
 	     p < num_platforms;
 	     device += num_devs[p++]) {
-		error = clGetDeviceIDs(platform[p], CL_DEVICE_TYPE_ALL, num_devs[p], device, NULL);
 		printf(I1_STR "%s\n", "Platform Name", platform_name[p]);
 		printf(I0_STR "%u\n", "Number of devices", num_devs[p]);
+		if (num_devs[p] == 0)
+			continue;
+
+		error = clGetDeviceIDs(platform[p], CL_DEVICE_TYPE_ALL, num_devs[p], device, NULL);
 		for (d = 0; d < num_devs[p]; ++d) {
 			printDeviceInfo(d);
 			if (d < num_devs[p] - 1)

-- 
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