Debian Codegraph @

libgomp/testsuite/libgomp.c/depend-3.c

raw
1 #include <stdlib.h>
2 #include <unistd.h>
3
4 int
5 main ()
6 {
7 #pragma omp parallel
8 #pragma omp single
9 {
10 int x = 1, y = 2;
11 #pragma omp taskgroup
12 {
13 #pragma omp task shared (x) depend(in: x)
14 {
15 usleep (10000);
16 if (x != 1)
17 abort ();
18 }
19 #pragma omp taskgroup
20 {
21 #pragma omp task shared (x) depend(in: x)
22 {
23 usleep (15000);
24 if (x != 1)
25 abort ();
26 }
27 #pragma omp task shared (y) depend(inout: y)
28 {
29 if (y != 2)
30 abort ();
31 y = 3;
32 }
33 #pragma omp taskgroup
34 {
35 #pragma omp task shared (x) depend(in: x)
36 {
37 usleep (13000);
38 if (x != 1)
39 abort ();
40 }
41 #pragma omp taskgroup
42 {
43 #pragma omp task shared (x) depend(out: x)
44 x = 2;
45 }
46 }
47 }
48 }
49 }
50 return 0;
51 }