Преглед на файлове

Cope with implementation returning CL_DEVICE_NOT_FOUND error instead of just reporting 0 devices

Samuel Thibault преди 8 години
родител
ревизия
21bb60116a
променени са 1 файла, в които са добавени 4 реда и са изтрити 1 реда
  1. 4 1
      socl/examples/clinfo/clinfo.c

+ 4 - 1
socl/examples/clinfo/clinfo.c

@@ -101,7 +101,10 @@ main(void) {
          cl_device_id devices[num_devices];
 
          err = clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_ALL, num_devices, devices, NULL);
-         checkErr(err, "clGetDeviceIDs(CL_DEVICE_TYPE_ALL)");
+         if (err == CL_DEVICE_NOT_FOUND)
+            num_devices = 0;
+         else
+            checkErr(err, "clGetDeviceIDs(CL_DEVICE_TYPE_ALL)");
 
          printf("  Number of devices:\t\t\t\t %d\n", num_devices);
          {