@@ -194,7 +194,7 @@ static void PrintDeviceType(
194194
195195static cl_int PrintDeviceInfoSummary (
196196 cl_device_id* devices,
197- size_t numDevices )
197+ cl_uint numDevices )
198198{
199199 cl_int errorCode = CL_SUCCESS ;
200200
@@ -204,8 +204,7 @@ static cl_int PrintDeviceInfoSummary(
204204 char * deviceVersion = NULL ;
205205 char * driverVersion = NULL ;
206206
207- size_t i = 0 ;
208- for ( i = 0 ; i < numDevices; i++ )
207+ for ( cl_uint i = 0 ; i < numDevices; i++ )
209208 {
210209 errorCode |= clGetDeviceInfo (
211210 devices[i],
@@ -232,7 +231,7 @@ static cl_int PrintDeviceInfoSummary(
232231
233232 if ( errorCode == CL_SUCCESS )
234233 {
235- printf (" Device[%d ]:\n " , ( int ) i );
234+ printf (" Device[%u ]:\n " , i );
236235
237236 PrintDeviceType (" \t Type: " , deviceType);
238237
@@ -243,7 +242,7 @@ static cl_int PrintDeviceInfoSummary(
243242 }
244243 else
245244 {
246- fprintf (stderr, " Error getting device info for device %d .\n " , ( int ) i );
245+ fprintf (stderr, " Error getting device info for device %u .\n " , i );
247246 }
248247
249248 delete [] deviceName;
@@ -291,17 +290,17 @@ int main(
291290 platforms.resize ( numPlatforms );
292291 clGetPlatformIDs ( numPlatforms, platforms.data (), NULL );
293292
294- for ( auto & platform : platforms )
293+ for ( cl_uint i = 0 ; i < numPlatforms; i++ )
295294 {
296- printf ( " Platform:\n " );
297- PrintPlatformInfoSummary ( platform );
295+ printf ( " Platform[%u] :\n " , i );
296+ PrintPlatformInfoSummary ( platforms[i] );
298297
299298 cl_uint numDevices = 0 ;
300- clGetDeviceIDs ( platform , CL_DEVICE_TYPE_ALL , 0 , NULL , &numDevices );
299+ clGetDeviceIDs ( platforms[i] , CL_DEVICE_TYPE_ALL , 0 , NULL , &numDevices );
301300
302301 std::vector<cl_device_id> devices;
303302 devices.resize ( numDevices );
304- clGetDeviceIDs ( platform , CL_DEVICE_TYPE_ALL , numDevices, devices.data (), NULL );
303+ clGetDeviceIDs ( platforms[i] , CL_DEVICE_TYPE_ALL , numDevices, devices.data (), NULL );
305304
306305 PrintDeviceInfoSummary ( devices.data (), numDevices );
307306 printf ( " \n " );
0 commit comments