1 | // RUN: %libomptarget-compile-generic && \ |
2 | // RUN: %libomptarget-run-generic |
3 | |
4 | #include <omp.h> |
5 | #include <stdio.h> |
6 | #include <stdlib.h> |
7 | |
8 | int main(int argc, char *argv[]) { |
9 | |
10 | int num_devices = omp_get_num_devices(); |
11 | |
12 | // No target devices, just return |
13 | if (num_devices == 0) { |
14 | printf(format: "PASS\n" ); |
15 | return 0; |
16 | } |
17 | |
18 | double sum = 999; |
19 | double A = 311; |
20 | |
21 | #pragma omp taskgroup task_reduction(+ : sum) |
22 | { |
23 | #pragma omp target map(to : A) in_reduction(+ : sum) device(0) nowait |
24 | { sum += A; } |
25 | } |
26 | |
27 | printf(format: "PASS\n" ); |
28 | return EXIT_SUCCESS; |
29 | } |
30 | |
31 | // CHECK: PASS |
32 | |