Mercurial > hg > CbC > CbC_gcc
comparison libgomp/testsuite/libgomp.c/depend-4.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
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, z = 3; | |
11 #pragma omp taskgroup | |
12 { | |
13 #pragma omp task shared (x, y, z) depend(inout: x, y) \ | |
14 depend (in: z) if (x > 10) | |
15 { | |
16 if (x != 1 || y != 2 || z != 3) | |
17 abort (); | |
18 x = 4; | |
19 y = 5; | |
20 } | |
21 /* The above task has depend clauses, but no dependencies | |
22 on earlier tasks, and is if (0), so must be scheduled | |
23 immediately. */ | |
24 if (x != 4 || y != 5) | |
25 abort (); | |
26 } | |
27 #pragma omp taskgroup | |
28 { | |
29 #pragma omp task shared (x, y) depend(in: x, y) | |
30 { | |
31 usleep (10000); | |
32 if (x != 4 || y != 5 || z != 3) | |
33 abort (); | |
34 } | |
35 #pragma omp task shared (x, y) depend(in: x, y) | |
36 { | |
37 usleep (10000); | |
38 if (x != 4 || y != 5 || z != 3) | |
39 abort (); | |
40 } | |
41 #pragma omp task shared (x, y, z) depend(inout: x, y) \ | |
42 depend (in: z) if (x > 10) | |
43 { | |
44 if (x != 4 || y != 5 || z != 3) | |
45 abort (); | |
46 x = 6; | |
47 y = 7; | |
48 } | |
49 /* The above task has depend clauses, and may have dependencies | |
50 on earlier tasks, while it is if (0), it can be deferred. */ | |
51 } | |
52 if (x != 6 || y != 7) | |
53 abort (); | |
54 } | |
55 return 0; | |
56 } |