[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 01:33:12 PDT 2023
mstorsjo updated this revision to Diff 555298.
mstorsjo added a comment.
Check the number of runs with a counter and FileCheck pattern, instead of expecting a certain number of printout lines.
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
+ { 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
+ { 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.555298.patch
Type: text/x-patch
Size: 1520 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230901/89f2a3ff/attachment.bin>
More information about the Openmp-commits
mailing list