1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
// RUN: %libomptarget-compile-run-and-check-generic
// RUN: %libomptarget-compileopt-run-and-check-generic
#include <omp.h>
#include <stdio.h>
__attribute__((optnone)) void optnone() {}
int main() {
int i = 0;
#pragma omp target teams num_teams(1) map(tofrom : i)
{
optnone();
#pragma omp parallel
if (omp_get_thread_num() == 0)
++i;
#pragma omp parallel
if (omp_get_thread_num() == 0)
++i;
#pragma omp parallel
if (omp_get_thread_num() == 0)
++i;
#pragma omp parallel
if (omp_get_thread_num() == 0)
++i;
}
// CHECK: 4
printf("%i\n", i);
}
|