1 ! RUN: %python %S/../test_errors.py %s %flang -fopenacc
3 ! Check OpenACC clause validity for the following construct and directive:
6 program openacc_kernels_loop_validity
11 real(8), dimension(10) :: arr
15 integer :: i
, j
, b
, gang_size
, vector_size
, worker_size
16 integer, parameter :: N
= 256
17 integer, dimension(N
) :: c
18 logical, dimension(N
) :: d
, e
20 integer :: wait1
, wait2
22 logical :: reduction_l
23 real(8), dimension(N
, N
) :: aa
, bb
, cc
24 real(8), dimension(:), allocatable
:: dd
26 logical :: ifCondition
= .TRUE
.
28 type(atype
), dimension(10) :: ta
30 real(8), dimension(N
) :: a
, f
, g
, h
37 !$acc kernels loop num_gangs(8)
42 !$acc kernels loop num_gangs(gang_size)
47 !$acc kernels loop num_gangs(8)
52 !$acc kernels loop num_workers(worker_size)
57 !$acc kernels loop num_workers(8)
62 !$acc kernels loop vector_length(vector_size)
67 !$acc kernels loop vector_length(128)
72 !$acc kernels loop num_gangs(gang_size)
78 !$acc kernels loop if(.TRUE.)
83 !$acc kernels loop if(ifCondition)
92 !ERROR: Unmatched END SERIAL LOOP directive
95 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the KERNELS LOOP directive
96 !$acc kernels loop device_type(*) if(.TRUE.)
100 !$acc end kernels loop
102 !$acc kernels loop async
107 !$acc kernels loop async(1)
112 !$acc kernels loop async(async1)
117 !$acc kernels loop wait(wait1)
122 !$acc kernels loop wait(wait1, wait2)
127 !$acc kernels loop wait(wait1) wait(wait2)
132 !$acc kernels loop wait(1, 2) async(3)
137 !$acc kernels loop wait(queues: 1, 2) async(3)
142 !$acc kernels loop wait(devnum: 1: 1, 2) async(3)
147 !$acc kernels loop wait(devnum: 1: queues: 1, 2) async(3)
152 !$acc kernels loop num_gangs(8)
157 !$acc kernels loop num_workers(8)
162 !$acc kernels loop vector_length(128)
167 !$acc kernels loop if(.true.)
172 !$acc kernels loop if(ifCondition)
177 !ERROR: At most one IF clause can appear on the KERNELS LOOP directive
178 !$acc kernels loop if(.true.) if(ifCondition)
183 !$acc kernels loop self
188 !$acc kernels loop self(.true.)
193 !$acc kernels loop self(ifCondition)
198 !$acc kernels loop copy(aa) copyin(bb) copyout(cc)
203 !$acc kernels loop copy(aa, bb) copyout(zero: cc)
208 !$acc kernels loop present(aa, bb) create(cc)
213 !$acc kernels loop copyin(readonly: aa, bb) create(zero: cc)
218 !$acc kernels loop deviceptr(aa, bb) no_create(cc)
223 !ERROR: Argument `aa` on the ATTACH clause must be a variable or array with the POINTER or ALLOCATABLE attribute
224 !$acc kernels loop attach(aa, dd, p)
229 !$acc kernels loop private(aa, bb, cc)
234 !$acc kernels loop default(none)
239 !$acc kernels loop default(present)
244 !ERROR: At most one DEFAULT clause can appear on the KERNELS LOOP directive
245 !$acc kernels loop default(none) default(present)
250 !$acc kernels loop device_type(*)
255 !$acc kernels loop device_type(1)
260 !$acc kernels loop device_type(1, 3)
265 !$acc kernels loop device_type(*) async wait num_gangs(8) num_workers(8) vector_length(128)
270 !$acc kernels loop device_type(*) async
275 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the KERNELS LOOP directive
276 !$acc kernels loop device_type(*) if(.TRUE.)
281 end program openacc_kernels_loop_validity