@@ -63,25 +63,31 @@ void PrintVersionInfo() {
63
63
lept_free (versionStrP);
64
64
65
65
#ifdef USE_OPENCL
66
- cl_platform_id platform;
66
+ cl_platform_id platform[ 4 ] ;
67
67
cl_uint num_platforms;
68
- cl_device_id devices[2 ];
69
- cl_uint num_devices;
70
- char info[256 ];
71
- int i;
72
68
73
69
printf (" OpenCL info:\n " );
74
- clGetPlatformIDs (1 , &platform, &num_platforms);
75
- printf (" Found %d platforms.\n " , num_platforms);
76
- clGetPlatformInfo (platform, CL_PLATFORM_NAME, 256 , info, 0 );
77
- printf (" Platform name: %s.\n " , info);
78
- clGetPlatformInfo (platform, CL_PLATFORM_VERSION, 256 , info, 0 );
79
- printf (" Version: %s.\n " , info);
80
- clGetDeviceIDs (platform, CL_DEVICE_TYPE_ALL, 2 , devices, &num_devices);
81
- printf (" Found %d devices.\n " , num_devices);
82
- for (i = 0 ; i < num_devices; ++i) {
83
- clGetDeviceInfo (devices[i], CL_DEVICE_NAME, 256 , info, 0 );
84
- printf (" Device %d name: %s.\n " , i + 1 , info);
70
+ if (clGetPlatformIDs (4 , platform, &num_platforms) == CL_SUCCESS) {
71
+ printf (" Found %u platform(s).\n " , num_platforms);
72
+ for (unsigned n = 0 ; n < num_platforms; n++) {
73
+ char info[256 ];
74
+ if (clGetPlatformInfo (platform[n], CL_PLATFORM_NAME, 256 , info, 0 ) == CL_SUCCESS) {
75
+ printf (" Platform %u name: %s.\n " , n + 1 , info);
76
+ }
77
+ if (clGetPlatformInfo (platform[n], CL_PLATFORM_VERSION, 256 , info, 0 ) == CL_SUCCESS) {
78
+ printf (" Version: %s.\n " , info);
79
+ }
80
+ cl_device_id devices[2 ];
81
+ cl_uint num_devices;
82
+ if (clGetDeviceIDs (platform[n], CL_DEVICE_TYPE_ALL, 2 , devices, &num_devices) == CL_SUCCESS) {
83
+ printf (" Found %u device(s).\n " , num_devices);
84
+ for (unsigned i = 0 ; i < num_devices; ++i) {
85
+ if (clGetDeviceInfo (devices[i], CL_DEVICE_NAME, 256 , info, 0 ) == CL_SUCCESS) {
86
+ printf (" Device %u name: %s.\n " , i + 1 , info);
87
+ }
88
+ }
89
+ }
90
+ }
85
91
}
86
92
#endif
87
93
}
0 commit comments