brintos

brintos / llvm-project-archived public Read only

0
0
Text · 732 B · b691204 Raw
41 lines · c
1// RUN: %libomp-compile-and-run2// RUN: env OMP_NUM_THREADS=1 %libomp-run3// RUN: %libomp-compile -DUSE_HIDDEN_HELPERS=14// RUN: %libomp-run5// RUN: env OMP_NUM_THREADS=1 %libomp-run6#include <omp.h>7 8int main(int argc, char *argv[]) {9  int i;10 11  omp_set_max_active_levels(1);12  omp_set_dynamic(0);13 14  for (i = 0; i < 10; ++i) {15#pragma omp parallel16    {17#ifndef USE_HIDDEN_HELPERS18      omp_event_handle_t event;19#endif20      int a = 0;21 22#ifdef USE_HIDDEN_HELPERS23#pragma omp target map(tofrom : a) nowait24#else25#pragma omp task shared(a) detach(event)26#endif27      { a = 1; }28 29#pragma omp parallel30      { a = 2; }31 32#ifndef USE_HIDDEN_HELPERS33      omp_fulfill_event(event);34#endif35 36#pragma omp taskwait37    }38  }39  return 0;40}41