| 1 | // clang-format off |
| 2 | // RUN: %libomptarget-compileopt-generic |
| 3 | // RUN: env LIBOMPTARGET_INFO=16 \ |
| 4 | // RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefixes=CHECK,SPMD |
| 5 | // RUN: %libomptarget-compileopt-generic -mllvm --openmp-opt-disable-spmdization |
| 6 | // RUN: env LIBOMPTARGET_INFO=16 \ |
| 7 | // RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefixes=CHECK,GENERIC |
| 8 | // clang-format on |
| 9 | |
| 10 | // REQUIRES: gpu |
| 11 | |
| 12 | #include <omp.h> |
| 13 | #include <stdio.h> |
| 14 | |
| 15 | __attribute__((weak)) void noop() {} |
| 16 | |
| 17 | int main(void) { |
| 18 | int nthreads = 0, ip = 0, lvl = 0, alvl = 0, nested = 0, tid = 0, maxt = 0; |
| 19 | |
| 20 | #pragma omp target map(from : nthreads, ip, lvl, alvl, nested, tid, maxt) |
| 21 | { |
| 22 | nthreads = omp_get_num_threads(); |
| 23 | ip = omp_in_parallel(); |
| 24 | lvl = omp_get_level(); |
| 25 | alvl = omp_get_active_level(); |
| 26 | nested = omp_get_nested(); |
| 27 | tid = omp_get_thread_num(); |
| 28 | maxt = omp_get_max_threads(); |
| 29 | #pragma omp parallel |
| 30 | noop(); |
| 31 | } |
| 32 | printf(format: "NumThreads: %i, InParallel: %i, Level: %i, ActiveLevel: %i, Nested: %i, " |
| 33 | "ThreadNum: %i, MaxThreads: %i\n" , |
| 34 | nthreads, ip, lvl, alvl, nested, tid, maxt); |
| 35 | // GENERIC: Generic mode |
| 36 | // SPMD: Generic-SPMD mode |
| 37 | // CHECK: NumThreads: 1 |
| 38 | // CHECK: InParallel: 0 |
| 39 | // CHECK: Level: 0 |
| 40 | // CHECK: ActiveLevel: 0 |
| 41 | // CHECK: Nested: 0 |
| 42 | // CHECK: ThreadNum: 0 |
| 43 | // CHECK: MaxThreads: |
| 44 | return 0; |
| 45 | } |
| 46 | |