aboutsummaryrefslogtreecommitdiff
path: root/libomptarget/deviceRTLs/nvptx/src/libcall.cu
diff options
context:
space:
mode:
authorJonas Hahnfeld <hahnjo@hahnjo.de>2018-09-29 16:02:17 +0000
committerJonas Hahnfeld <hahnjo@hahnjo.de>2018-09-29 16:02:17 +0000
commite85324c7707ffe7ebe69529950f5025aaba97c37 (patch)
treefbb1cab49e091cb0e375c3593bba13ed008e2fd6 /libomptarget/deviceRTLs/nvptx/src/libcall.cu
parent119df3803baeaa12881ad5de9110a497f3d7e633 (diff)
[libomptarget-nvptx] Fix number of threads in parallel
If there is no num_threads() clause we must consider the nthreads-var ICV. Its value is set by omp_set_num_threads() and can be queried using omp_get_max_num_threads(). The rewritten code now closely resembles the algorithm given in the OpenMP standard. Differential Revision: https://reviews.llvm.org/D51783 git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@343380 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'libomptarget/deviceRTLs/nvptx/src/libcall.cu')
-rw-r--r--libomptarget/deviceRTLs/nvptx/src/libcall.cu4
1 files changed, 2 insertions, 2 deletions
diff --git a/libomptarget/deviceRTLs/nvptx/src/libcall.cu b/libomptarget/deviceRTLs/nvptx/src/libcall.cu
index f2599a4..929f9db 100644
--- a/libomptarget/deviceRTLs/nvptx/src/libcall.cu
+++ b/libomptarget/deviceRTLs/nvptx/src/libcall.cu
@@ -61,8 +61,8 @@ EXTERN int omp_get_max_threads(void) {
omptarget_nvptx_TaskDescr *currTaskDescr = getMyTopTaskDescriptor();
int rc = 1; // default is 1 thread avail
if (!currTaskDescr->InParallelRegion()) {
- // not currently in a parallel region... all are available
- rc = GetNumberOfProcsInTeam();
+ // Not currently in a parallel region, return what was set.
+ rc = currTaskDescr->NThreads();
ASSERT0(LT_FUSSY, rc >= 0, "bad number of threads");
}
PRINT(LD_IO, "call omp_get_max_threads() return %d\n", rc);