brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 48627cd Raw
47 lines · c
1// clang-format off2// RUN: %libomptarget-compileopt-generic3// RUN: env LIBOMPTARGET_INFO=16 \4// RUN:   %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefixes=CHECK,SPMD5// RUN: %libomptarget-compileopt-generic -mllvm --openmp-opt-disable-spmdization \6// RUN:   -Xoffload-linker -mllvm=--openmp-opt-disable-spmdization7// RUN: env LIBOMPTARGET_INFO=16 \8// RUN:   %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefixes=CHECK,GENERIC9// clang-format on10 11// REQUIRES: gpu12 13#include <omp.h>14#include <stdio.h>15 16__attribute__((weak)) void noop() {}17 18int main(void) {19  int nthreads = 0, ip = 0, lvl = 0, alvl = 0, nested = 0, tid = 0, maxt = 0;20 21#pragma omp target map(from : nthreads, ip, lvl, alvl, nested, tid, maxt)22  {23    nthreads = omp_get_num_threads();24    ip = omp_in_parallel();25    lvl = omp_get_level();26    alvl = omp_get_active_level();27    nested = omp_get_nested();28    tid = omp_get_thread_num();29    maxt = omp_get_max_threads();30    #pragma omp parallel31    noop();32  }33  printf("NumThreads: %i, InParallel: %i, Level: %i, ActiveLevel: %i, Nested: %i, "34         "ThreadNum: %i, MaxThreads: %i\n",35         nthreads, ip, lvl, alvl, nested, tid, maxt);36  // GENERIC: Generic mode37  // SPMD: Generic-SPMD mode38  // CHECK: NumThreads: 139  // CHECK: InParallel: 040  // CHECK: Level: 041  // CHECK: ActiveLevel: 042  // CHECK: Nested: 043  // CHECK: ThreadNum: 044  // CHECK: MaxThreads:45  return 0;46}47