1 ! RUN: %python %S/../test_errors.py %s %flang -fopenacc
3 ! Check OpenACC clause validity for the following construct and directive:
6 program openacc_parallel_loop_validity
11 integer, parameter :: N
= 256
12 integer, dimension(N
) :: c
13 logical, dimension(N
) :: d
, e
15 logical :: reduction_l
16 logical :: ifCondition
= .TRUE
.
17 real(8), dimension(N
) :: a
, f
, g
, h
18 real(8), dimension(N
, N
) :: aa
, bb
, cc
20 !$acc parallel loop tile(2)
25 !$acc parallel loop self
30 !ERROR: SELF clause on the PARALLEL LOOP directive only accepts optional scalar logical expression
31 !$acc parallel loop self(bb, cc(:))
36 !$acc parallel loop self(.true.)
41 !$acc parallel loop self(ifCondition)
46 !$acc parallel loop tile(2, 2)
53 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the PARALLEL LOOP directive
54 !$acc parallel loop device_type(*) if(.TRUE.)
58 !$acc end parallel loop
64 !ERROR: Unmatched END PARALLEL LOOP directive
65 !$acc end parallel loop
67 !$acc parallel loop reduction(+: reduction_r)
69 reduction_r
= a(i
) + i
72 !$acc parallel loop reduction(*: reduction_r)
74 reduction_r
= reduction_r
* (a(i
) + i
)
77 !$acc parallel loop reduction(min: reduction_r)
79 reduction_r
= min(reduction_r
, a(i
) * i
)
82 !$acc parallel loop reduction(max: reduction_r)
84 reduction_r
= max(reduction_r
, a(i
) * i
)
87 !$acc parallel loop reduction(iand: b)
92 !$acc parallel loop reduction(ior: b)
97 !$acc parallel loop reduction(ieor: b)
102 !$acc parallel loop reduction(.and.: reduction_l)
104 reduction_l
= d(i
) .and
. e(i
)
107 !$acc parallel loop reduction(.or.: reduction_l)
109 reduction_l
= d(i
) .or
. e(i
)
112 !$acc parallel loop reduction(.eqv.: reduction_l)
114 reduction_l
= d(i
) .eqv
. e(i
)
117 !$acc parallel loop reduction(.neqv.: reduction_l)
119 reduction_l
= d(i
) .neqv
. e(i
)
122 end program openacc_parallel_loop_validity