[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
Thu Aug 31 14:39:24 PDT 2023
mstorsjo created this revision.
mstorsjo added reviewers: sandeepkosuri, ABataev, jdoerfert.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added subscribers: jplehr, sstefan1.
Herald added a project: OpenMP.
Previously, the test ran a section with
#pragma omp target thread_limit(4)
and expected it to execute exactly 4 times, even though it would
in practice execute min(cores, 4) times.
Add an explicit call to omp_set_num_threads() before that section,
making sure that this executes the expected number of times,
while still testing the functionality of the thread_limit() clause.
Repository:
rG LLVM Github Monorepo
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
@@ -15,6 +15,8 @@
printf("\nmain: thread_limit = %d", omp_get_thread_limit());
// OMP51: main: thread_limit = {{[0-9]+}}
+ omp_set_num_threads(8);
+
#pragma omp target thread_limit(tl)
{
printf("\ntarget: thread_limit = %d", omp_get_thread_limit());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159311.555168.patch
Type: text/x-patch
Size: 504 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230831/86d7c528/attachment-0001.bin>
More information about the Openmp-commits
mailing list