mirror of
https://github.com/intel/llvm.git
synced 2026-01-23 16:06:39 +08:00
[OPENMP][NVPTX] Fix the test, NFC.
Fix the test to run it really in SPMD mode without runtime. Previously it was run in SPMD + full runtime mode and does not allow to cehck the functionality correctly. llvm-svn: 358902
This commit is contained in:
@@ -5,15 +5,25 @@
|
||||
|
||||
int main(void) {
|
||||
int isHost = -1;
|
||||
int ParallelLevel1, ParallelLevel2 = -1;
|
||||
int ParallelLevel1 = -1, ParallelLevel2 = -1;
|
||||
|
||||
#pragma omp target parallel map(from: isHost, ParallelLevel1, ParallelLevel2)
|
||||
{
|
||||
isHost = omp_is_initial_device();
|
||||
ParallelLevel1 = omp_get_level();
|
||||
#pragma omp parallel for schedule(dynamic) lastprivate(ParallelLevel2)
|
||||
#pragma omp target parallel for map(tofrom \
|
||||
: isHost, ParallelLevel1, ParallelLevel2)
|
||||
for (int J = 0; J < 10; ++J) {
|
||||
#pragma omp critical
|
||||
{
|
||||
isHost = (isHost < 0 || isHost == omp_is_initial_device())
|
||||
? omp_is_initial_device()
|
||||
: 1;
|
||||
ParallelLevel1 =
|
||||
(ParallelLevel1 < 0 || ParallelLevel1 == 1) ? omp_get_level() : 2;
|
||||
}
|
||||
int L2;
|
||||
#pragma omp parallel for schedule(dynamic) lastprivate(L2)
|
||||
for (int I = 0; I < 10; ++I)
|
||||
ParallelLevel2 = omp_get_level();
|
||||
L2 = omp_get_level();
|
||||
#pragma omp critical
|
||||
ParallelLevel2 = (ParallelLevel2 < 0 || ParallelLevel2 == 2) ? L2 : 1;
|
||||
}
|
||||
|
||||
if (isHost < 0) {
|
||||
|
||||
Reference in New Issue
Block a user