4 struct S
{ unsigned long long int s
, t
; };
7 rbar (struct S
*p
, struct S
*o
)
16 rbaz (struct S
*o
, struct S
*i
)
18 if (o
->t
!= 5 || i
->t
!= 9)
23 #pragma omp declare reduction (+: struct S : omp_out.s += omp_in.s) \
24 initializer (omp_priv = { 0, 3 })
25 #pragma omp declare reduction (*: struct S : rbaz (&omp_out, &omp_in)) \
26 initializer (rbar (&omp_priv, &omp_orig))
28 struct S g
= { 0, 7 };
29 struct S h
= { 1, 5 };
35 #pragma omp taskloop reduction (+:x) in_reduction (+:b[0])
36 for (int i
= 0; i
< 64; i
++)
44 unsigned long long int
45 bar (int *a
, unsigned long long int *b
)
47 unsigned long long int x
= 1;
48 #pragma omp taskloop reduction (*:x) in_reduction (*:b[0])
49 for (int i
= 0; i
< 64; i
++)
51 #pragma omp task in_reduction (*:x)
53 #pragma omp task in_reduction (*:b[0])
60 baz (int i
, int *a
, int *c
)
62 #pragma omp task in_reduction (*:h) in_reduction (+:g)
66 if ((g
.t
!= 7 && g
.t
!= 3) || (h
.t
!= 5 && h
.t
!= 9))
74 int i
, j
, a
[64], b
= 0, c
[64];
75 unsigned long long int d
= 1, e
;
77 struct S m
= { 0, 7 };
78 struct S n
= { 1, 5 };
79 for (i
= 0; i
< 64; i
++)
82 c
[i
] = 1 + ((i
% 3) != 1);
84 #pragma omp parallel reduction (task, +:b) reduction(+:r) \
85 reduction(task,*:d) reduction (task, +: g, m) \
86 reduction (task, *: h, n) shared(t)
91 t
= omp_get_num_threads ();
94 #pragma omp single nowait
97 #pragma omp taskloop in_reduction (+: g, m) in_reduction (*: h, n)
98 for (i
= 0; i
< 64; ++i
)
104 if ((g
.t
!= 7 && g
.t
!= 3) || (h
.t
!= 5 && h
.t
!= 9)
105 || (m
.t
!= 7 && m
.t
!= 3) || (n
.t
!= 5 && n
.t
!= 9))
110 if (n
.s
!= (1ULL << 43) || n
.t
!= 5)
112 if (j
!= 63 * 64 || b
!= 63 * 64 * 2)
114 if (e
!= (1ULL << 43) || d
!= (1ULL << 21))
116 if (g
.s
!= 63 * 64 * 10 || g
.t
!= 7)
118 if (h
.s
!= (1ULL << 42) || h
.t
!= 5)
120 if (m
.s
!= 63 * 64 * 4 || m
.t
!= 7)