Debian Codegraph @

libgomp/testsuite/libgomp.c/examples-4/device-2.c

raw
1 /* { dg-do run } */
2 /* { dg-require-effective-target offload_device } */
3
4 #include <omp.h>
5 #include <stdlib.h>
6
7 #define N 10
8
9 int main ()
10 {
11 int i;
12 int offload[N];
13 int num = omp_get_num_devices();
14
15 #pragma omp parallel for
16 for (i = 0; i < N; i++)
17 #pragma omp target device(i) map(from: offload[i:1])
18 offload[i] = omp_is_initial_device ();
19
20 for (i = 0; i < num; i++)
21 if (offload[i])
22 abort ();
23
24 for (i = num; i < N; i++)
25 if (!offload[i])
26 abort ();
27
28 return 0;
29 }