skip subdevice tests on (virtual) single core CPUs
authorAndreas Beckmann <anbe@debian.org>
Fri, 15 Oct 2021 16:22:36 +0000 (17:22 +0100)
committerAndreas Beckmann <anbe@debian.org>
Fri, 15 Oct 2021 16:22:36 +0000 (17:22 +0100)
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 1c8a2ba1aa3eba94c7498134da699188e7cfdb74..1547f2016a5eb4b99178f0525b7b456053d0a034 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 d2b418c27d80aee54fcc30fe645283bccb6eb8fe..232f340268222ccf2e0187b4ff24eaab020579b8 100644 (file)
@@ -96,7 +96,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")
 
@@ -133,6 +133,10 @@ set_tests_properties( "runtime/clGetDeviceInfo" "runtime/clEnqueueNativeKernel"
     DEPENDS "pocl_version_check"
     LABELS "internal;runtime")
 
+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,