Display information about the opencl platform with verbose enabled.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
diff --git a/ocl.c b/ocl.c
index 525cf98..16d1a1e 100644
--- a/ocl.c
+++ b/ocl.c
@@ -70,6 +70,7 @@ char *file_contents(const char *filename, int *length)
int clDevicesNum() {
cl_int status;
+ char pbuff[256];
cl_uint numDevices;
cl_uint numPlatforms;
cl_platform_id platform = NULL;
@@ -92,8 +93,6 @@ int clDevicesNum() {
}
for (i = 0; i < numPlatforms; ++i) {
- char pbuff[256];
-
status = clGetPlatformInfo( platforms[i], CL_PLATFORM_VENDOR, sizeof(pbuff), pbuff, NULL);
if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Getting Platform Info. (clGetPlatformInfo)");
@@ -113,6 +112,14 @@ int clDevicesNum() {
return -1;
}
+ applog(LOG_INFO, "CL Platform vendor: %s", pbuff);
+ status = clGetPlatformInfo(platform, CL_PLATFORM_NAME, sizeof(pbuff), pbuff, NULL);
+ if (status == CL_SUCCESS)
+ applog(LOG_INFO, "CL Platform name: %s", pbuff);
+ status = clGetPlatformInfo(platform, CL_PLATFORM_VERSION, sizeof(pbuff), pbuff, NULL);
+ if (status == CL_SUCCESS)
+ applog(LOG_INFO, "CL Platform version: %s", pbuff);
+
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &numDevices);
if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Getting Device IDs (num)");
@@ -190,6 +197,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
cl_device_id *devices;
cl_uint numPlatforms;
cl_uint numDevices;
+ char pbuff[256];
unsigned int i;
cl_int status;
@@ -209,8 +217,6 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
}
for(i = 0; i < numPlatforms; ++i) {
- char pbuff[100];
-
status = clGetPlatformInfo( platforms[i], CL_PLATFORM_VENDOR, sizeof(pbuff), pbuff, NULL);
if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Getting Platform Info. (clGetPlatformInfo)");
@@ -230,6 +236,14 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
return NULL;
}
+ applog(LOG_INFO, "CL Platform vendor: %s", pbuff);
+ status = clGetPlatformInfo(platform, CL_PLATFORM_NAME, sizeof(pbuff), pbuff, NULL);
+ if (status == CL_SUCCESS)
+ applog(LOG_INFO, "CL Platform name: %s", pbuff);
+ status = clGetPlatformInfo(platform, CL_PLATFORM_VERSION, sizeof(pbuff), pbuff, NULL);
+ if (status == CL_SUCCESS)
+ applog(LOG_INFO, "CL Platform version: %s", pbuff);
+
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &numDevices);
if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Getting Device IDs (num)");
@@ -251,7 +265,6 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
unsigned int i;
for (i = 0; i < numDevices; i++) {
- char pbuff[100];
status = clGetDeviceInfo(devices[i], CL_DEVICE_NAME, sizeof(pbuff), pbuff, NULL);
if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Getting Device Info");
@@ -262,7 +275,6 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
}
if (gpu < numDevices) {
- char pbuff[100];
status = clGetDeviceInfo(devices[gpu], CL_DEVICE_NAME, sizeof(pbuff), pbuff, NULL);
if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Getting Device Info");