10 #pragma omp depobj (d1) depend(inout: omp_all_memory)
11 #pragma omp depobj (d2) depend(out: omp_all_memory)
12 for (i
= 0; i
< 8; i
++)
20 #pragma omp task shared(a) depend(in: a[0])
25 #pragma omp task shared(a) depend(out: a[1])
30 #pragma omp task shared(a) depend(inout: a[2])
35 #pragma omp task shared(a) depend(mutexinoutset: a[3])
40 #pragma omp task shared(a)
45 #pragma omp task shared(b) depend(in: b[0])
50 #pragma omp task shared(b) depend(in: b[4])
55 #pragma omp task shared(b) depend(inoutset: b[5])
60 /* None of the above tasks depend on each other.
61 The following task depends on all but the a[4] = 46; one. */
62 #pragma omp task shared(a, b) depend(depobj: d1) private(i) if(ifval)
64 if (a
[0] != 42 || a
[1] != 43 || a
[2] != 44 || a
[3] != 45
65 || a
[5] != 5 || a
[6] != 6 || a
[7] != 7
66 || b
[0] != 47 || b
[1] != 2 || b
[2] != 4 || b
[3] != 6
67 || b
[4] != 48 || b
[5] != 49 || b
[6] != 12 || b
[7] != 14)
69 for (i
= 0; i
< 8; ++i
)
72 for (i
= 0; i
< 8; ++i
)
75 /* The following task depends on both b[0] = 47; and
76 above omp_all_memory tasks, but as the latter depends on
77 the former, effectively it is dependent just on the omp_all_memory
79 #pragma omp task shared(b) depend(inout: b[0])
84 /* The following task depends on all the above except a[4] = 46; one,
85 but it can be reduced to dependency on the above omp_all_memory
86 one and b[0] = 49; one. */
87 #pragma omp task shared(a, b) depend(inout: b[6]) depend(depobj: d2) \
88 depend(out: b[7]) private(i) if(ifval)
90 for (i
= 0; i
< 8; ++i
)
93 if (a
[i
] != 3 * i
+ 7)
100 for (i
= 1; i
< 8; ++i
)
102 if (b
[i
] != 4 * i
- 7)
111 #pragma omp depobj (d2) destroy
112 #pragma omp depobj (d1) destroy