skip subdevice tests on (virtual) single core CPUs
authorAndreas Beckmann <anbe@debian.org>
Sat, 26 Dec 2020 20:26:31 +0000 (20:26 +0000)
committerPeter Michael Green <plugwash@raspbian.org>
Sat, 26 Dec 2020 20:26:31 +0000 (20:26 +0000)
Gbp-Pq: Name skip-subdevice-tests-on-single-core-cpus.patch

examples/EinsteinToolkit/CMakeLists.txt
examples/EinsteinToolkit/EinsteinToolkit.c
tests/runtime/CMakeLists.txt
tests/runtime/test_clCreateSubDevices.c

index 704a02e7f5043434506d95ae877585ccabf0f486..139d1c61c23ad54cd7d7e0a9fe14ca907a30dcab 100644 (file)
@@ -54,5 +54,6 @@ if(NOT MIPS)
     COST 15.0
     LABELS "EinsteinToolkit"
     ENVIRONMENT "POCL_AFFINITY=1"
+    SKIP_RETURN_CODE 77
     DEPENDS "pocl_version_check")
 endif()
index eab4431a4548d0fef6ae1509c4513c9f9af6a55e..b9a5d6275273e09a881044836eb716dcf9c1b82b 100644 (file)
@@ -528,6 +528,16 @@ void setup(const char* program_source1, const char* program_source2)
 
   if (use_subdev)
     {
+      {
+        cl_uint max_cus;
+        int err = clGetDeviceInfo (main_device_id, CL_DEVICE_MAX_COMPUTE_UNITS,
+                                   sizeof(max_cus), &max_cus, NULL);
+        assert (err == CL_SUCCESS);
+        if (max_cus < 2) {
+          fprintf(stderr, "Insufficient compute units for subdevice creation\n");
+          exit(77);
+        }
+      }
       const cl_device_partition_property props[]
           = { CL_DEVICE_PARTITION_EQUALLY, 2, 0 };
       cl_device_id subdevs[128];
index 0a0a7c9affab223cfc5d2f338334355c8d8223c5..eb2fa176fd235549c96c53b3c62efd6c6163d86a 100644 (file)
@@ -84,7 +84,7 @@ add_test_pocl(NAME "runtime/clGetSupportedImageFormats" COMMAND "test_clGetSuppo
 
 add_test_pocl(NAME "runtime/clCreateKernelsInProgram" COMMAND "test_clCreateKernelsInProgram")
 
-add_test_pocl(NAME "runtime/clCreateSubDevices" COMMAND  "test_clCreateSubDevices")
+add_test(NAME "runtime/clCreateSubDevices" COMMAND  "test_clCreateSubDevices")
 
 add_test_pocl(NAME "runtime/test_event_free" COMMAND  "test_event_free")
 
@@ -114,6 +114,10 @@ set_tests_properties("runtime/clGetSupportedImageFormats"
   PROPERTIES
     ENVIRONMENT "POCL_DEVICES=pthread\ pthread")
 
+set_tests_properties("runtime/clCreateSubDevices"
+  PROPERTIES
+    SKIP_RETURN_CODE 77)
+
 if(NOT ENABLE_ANYSAN)
   set_tests_properties("runtime/clCreateKernelsInProgram"
   PROPERTIES
index 91a4d26ca7f7189ce4a1a6ef0b565669efef583d..d896997c792ef332e2fa238a79940de438813d68 100644 (file)
@@ -140,7 +140,7 @@ int main(int argc, char **argv)
     {
       printf("This test requires a cl device with at least 2 compute units"
              " (a dual-core or better CPU)\n");
-      return 1;
+      return 77;
     }
 
   err = clGetDeviceInfo(rootdev, CL_DEVICE_PARTITION_MAX_SUB_DEVICES,