Commit 9175e4f25c9d37f91cbfce333bc66e05b95a3a40

Con Kolivas 2012-04-23T17:56:31

Display all OpenCL devices when -n is called as well to allow debugging of differential mapping of OpenCL to ADL.

diff --git a/ocl.c b/ocl.c
index c1c6aaf..39c8844 100644
--- a/ocl.c
+++ b/ocl.c
@@ -123,6 +123,18 @@ int clDevicesNum(void) {
 		applog(LOG_INFO, "Platform %d devices: %d", i, numDevices);
 		if (numDevices > most_devices)
 			most_devices = numDevices;
+		if (numDevices) {
+			unsigned int j;
+			char pbuff[256];
+			cl_device_id *devices = (cl_device_id *)malloc(numDevices*sizeof(cl_device_id));
+
+			clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numDevices, devices, NULL);
+			for (j = 0; j < numDevices; j++) {
+				clGetDeviceInfo(devices[j], CL_DEVICE_NAME, sizeof(pbuff), pbuff, NULL);
+				applog(LOG_INFO, "\t%i\t%s", j, pbuff);
+			}
+			free(devices);
+		}
 	}
 
 	return most_devices;