[Openmp-commits] [PATCH] D159311: [OpenMP] [test] Fix target_thread_limit.cpp to not assume 4 or more cores

Martin Storsjö via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Sep 1 11:17:41 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc2019c416c8d: [OpenMP] [test] Fix target_thread_limit.cpp to not assume 4 or more cores (authored by mstorsjo).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159311/new/

https://reviews.llvm.org/D159311

Files:
  openmp/runtime/test/target/target_thread_limit.cpp


Index: openmp/runtime/test/target/target_thread_limit.cpp
===================================================================
--- openmp/runtime/test/target/target_thread_limit.cpp
+++ openmp/runtime/test/target/target_thread_limit.cpp
@@ -18,15 +18,13 @@
 #pragma omp target thread_limit(tl)
   {
     printf("\ntarget: thread_limit = %d", omp_get_thread_limit());
+    int count = 0;
 // OMP51: target: thread_limit = 4
 // check whether thread_limit is honoured
-#pragma omp parallel
-    { printf("\ntarget: parallel"); }
-// OMP51: target: parallel
-// OMP51: target: parallel
-// OMP51: target: parallel
-// OMP51: target: parallel
-// OMP51-NOT: target: parallel
+#pragma omp parallel reduction(+:count)
+    { count++; }
+    printf("\ntarget: parallel: count = %d", count);
+// OMP51: target: parallel: count = {{(1|2|3|4)$}}
 
 // check whether num_threads is honoured
 #pragma omp parallel num_threads(2)
@@ -70,13 +68,12 @@
 #pragma omp target thread_limit(3)
   {
     printf("\nsecond target: thread_limit = %d", omp_get_thread_limit());
+    int count = 0;
 // OMP51: second target: thread_limit = 3
-#pragma omp parallel
-    { printf("\nsecond target: parallel"); }
-    // OMP51: second target: parallel
-    // OMP51: second target: parallel
-    // OMP51: second target: parallel
-    // OMP51-NOT: second target: parallel
+#pragma omp parallel reduction(+:count)
+    { count++; }
+    printf("\nsecond target: parallel: count = %d", count);
+    // OMP51: second target: parallel: count = {{(1|2|3)$}}
   }
 
   // confirm that thread_limit's effects are limited to target region


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159311.555446.patch
Type: text/x-patch
Size: 1602 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230901/c3a3943c/attachment.bin>


More information about the Openmp-commits mailing list