[libomptarget-nvptx] Fix number of threads in parallel
authorJonas Hahnfeld <hahnjo@hahnjo.de>
Sat, 29 Sep 2018 16:02:17 +0000 (16:02 +0000)
committerJonas Hahnfeld <hahnjo@hahnjo.de>
Sat, 29 Sep 2018 16:02:17 +0000 (16:02 +0000)
commita743c04412090f0612218e95f1982c9d75061a1c
tree17101cf277ef5b9ca0f18fc87715777bc1c9d333
parent54d31ef87e6e50fcad6efe0be4f652e32b21f496
[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

llvm-svn: 343380
openmp/libomptarget/deviceRTLs/nvptx/src/libcall.cu
openmp/libomptarget/deviceRTLs/nvptx/src/parallel.cu
openmp/libomptarget/deviceRTLs/nvptx/test/parallel/num_threads.c [new file with mode: 0644]