39 lines · c
1// RUN: %libomptarget-compile-run-and-check-generic2// RUN: %libomptarget-compileopt-run-and-check-generic3 4#include <omp.h>5#include <stdio.h>6 7int main() {8 // TODO: Test all ICVs on all levels9 int o_lvl = 111, i_lvl = 222, o_tid = 333, i_tid = 333, o_nt = 444,10 i_nt = 555;11#pragma omp target teams map(tofrom : o_lvl, i_lvl, o_tid, i_tid, o_nt, i_nt) \12 num_teams(2) thread_limit(64)13 {14 if (omp_get_team_num() == 0) {15#pragma omp parallel num_threads(64)16 if (omp_get_thread_num() == omp_get_num_threads() - 1) {17 o_lvl = omp_get_level();18 o_tid = omp_get_thread_num();19 o_nt = omp_get_num_threads();20#pragma omp parallel num_threads(64)21 if (omp_get_thread_num() == omp_get_num_threads() - 1) {22 i_lvl = omp_get_level();23 i_tid = omp_get_thread_num();24 i_nt = omp_get_num_threads();25 }26 }27 }28 }29 if (o_lvl == 1 && o_tid == o_nt - 1 && o_nt >= 1 && i_lvl == 2 &&30 i_tid == 0 && i_nt == 1) {31 // CHECK: Success32 printf("Success\n");33 return 0;34 }35 printf("outer: lvl: %i, tid: %i, nt: %i\n", o_lvl, o_tid, o_nt);36 printf("inner: lvl: %i, tid: %i, nt: %i\n", i_lvl, i_tid, i_nt);37 return 1;38}39