4 elemental
subroutine sub1 (x
, y
)
5 integer, intent(in
) :: y
6 integer, intent(out
) :: x
8 elemental
function fn2 (x
)
9 integer, intent(in
) :: x
13 !$omp declare reduction (foo : integer : omp_out = omp_out + omp_in) initializer (omp_priv = 0)
14 !$omp declare reduction (bar : integer : omp_out = fn1 (omp_out, omp_in)) &
15 !$omp & initializer (sub1 (omp_priv, omp_orig))
16 !$omp declare reduction (baz : integer : sub2 (omp_out, omp_in)) &
17 !$omp initializer (omp_priv = fn2 (omp_orig))
19 elemental
function fn1 (x
, y
)
20 integer, intent(in
) :: x
, y
23 elemental
subroutine sub2 (x
, y
)
24 integer, intent(in
) :: y
25 integer, intent(inout
) :: x
28 integer :: a(10), b
, r
32 !$omp parallel reduction (foo : a, b) reduction (+: r)
37 if (any (a
/= 2 * r
) .or
. b
/= 3 * r
) STOP 1
41 !$omp parallel reduction (bar : a, b) reduction (+: r)
46 if (any (a
/= 4 * r
) .or
. b
/= 6 * r
) STOP 2
50 !$omp parallel reduction (baz : a, b) reduction (+: r)
55 if (any (a
/= 2 * r
) .or
. b
/= 3 * r
) STOP 3
57 elemental
function fn1 (x
, y
)
58 integer, intent(in
) :: x
, y
62 elemental
subroutine sub1 (x
, y
)
63 integer, intent(in
) :: y
64 integer, intent(out
) :: x
67 elemental
function fn2 (x
)
68 integer, intent(in
) :: x
72 elemental
subroutine sub2 (x
, y
)
73 integer, intent(inout
) :: x
74 integer, intent(in
) :: y