8 integer, parameter :: n
= 10, vl
= 2
10 real, parameter :: e
= .001
11 real :: vresult
, result
12 logical :: lresult
, lvresult
13 real, dimension (n
) :: array
24 !$acc parallel vector_length(vl) num_gangs(1)
25 !$acc loop reduction(+:result)
27 result
= result
+ array(i
)
33 vresult
= vresult
+ array(i
)
36 if (abs (result
- vresult
) .ge
. e
) call abort
43 !$acc parallel vector_length(vl) num_gangs(1)
44 !$acc loop reduction(*:result)
46 result
= result
* array(i
)
52 vresult
= vresult
* array(i
)
55 if (result
.ne
.vresult
) call abort
62 !$acc parallel vector_length(vl) num_gangs(1)
63 !$acc loop reduction(max:result)
65 result
= max (result
, array(i
))
71 vresult
= max (vresult
, array(i
))
74 if (result
.ne
.vresult
) call abort
81 !$acc parallel vector_length(vl) num_gangs(1)
82 !$acc loop reduction(min:result)
84 result
= min (result
, array(i
))
90 vresult
= min (vresult
, array(i
))
93 if (result
.ne
.vresult
) call abort
100 !$acc parallel vector_length(vl) num_gangs(1)
101 !$acc loop reduction(.and.:lresult)
103 lresult
= lresult
.and
. (array(i
) .ge
. 5)
109 lvresult
= lvresult
.and
. (array(i
) .ge
. 5)
112 if (result
.ne
.vresult
) call abort
119 !$acc parallel vector_length(vl) num_gangs(1)
120 !$acc loop reduction(.or.:lresult)
122 lresult
= lresult
.or
. (array(i
) .ge
. 5)
128 lvresult
= lvresult
.or
. (array(i
) .ge
. 5)
131 if (result
.ne
.vresult
) call abort
138 !$acc parallel vector_length(vl) num_gangs(1)
139 !$acc loop reduction(.eqv.:lresult)
141 lresult
= lresult
.eqv
. (array(i
) .ge
. 5)
147 lvresult
= lvresult
.eqv
. (array(i
) .ge
. 5)
150 if (result
.ne
.vresult
) call abort
155 ! '.neqv.' reductions
157 !$acc parallel vector_length(vl) num_gangs(1)
158 !$acc loop reduction(.neqv.:lresult)
160 lresult
= lresult
.neqv
. (array(i
) .ge
. 5)
166 lvresult
= lvresult
.neqv
. (array(i
) .ge
. 5)
169 if (result
.ne
.vresult
) call abort
170 end program reduction_2