1 | // RUN: %libomptarget-compile-run-and-check-generic |
---|---|
2 | // RUN: %libomptarget-compileopt-run-and-check-generic |
3 | |
4 | #include <omp.h> |
5 | #include <stdio.h> |
6 | |
7 | int main() { |
8 | int b = 0; |
9 | |
10 | #pragma omp target map(tofrom : b) |
11 | for (int i = 1; i <= 10; ++i) { |
12 | #pragma omp parallel num_threads(10) reduction(+ : b) |
13 | #pragma omp for |
14 | for (int k = 0; k < 10; ++k) |
15 | ++b; |
16 | } |
17 | |
18 | // CHECK: b: 100 |
19 | printf(format: "b: %i\n", b); |
20 | return 0; |
21 | } |
22 |