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
41 !$acc end kernels loop
47 !$acc end kernels loop
49 !$acc kernels loop num_gangs(8)
54 !$acc kernels loop num_gangs(gang_size)
59 !$acc kernels loop num_gangs(8)
64 !$acc kernels loop num_workers(worker_size)
69 !$acc kernels loop num_workers(8)
74 !$acc kernels loop vector_length(vector_size)
79 !$acc kernels loop vector_length(128)
84 !$acc kernels loop num_gangs(gang_size)
90 !$acc kernels loop if(.TRUE.)
95 !$acc kernels loop if(ifCondition)
104 !ERROR: Unmatched END SERIAL LOOP directive
105 !$acc end serial loop
107 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the KERNELS LOOP directive
108 !$acc kernels loop device_type(*) if(.TRUE.)
112 !$acc end kernels loop
114 !$acc kernels loop async
119 !$acc kernels loop async(1)
124 !$acc kernels loop async(async1)
129 !$acc kernels loop wait(wait1)
134 !$acc kernels loop wait(wait1, wait2)
139 !$acc kernels loop wait(wait1) wait(wait2)
144 !$acc kernels loop wait(1, 2) async(3)
149 !$acc kernels loop wait(queues: 1, 2) async(3)
154 !$acc kernels loop wait(devnum: 1: 1, 2) async(3)
159 !$acc kernels loop wait(devnum: 1: queues: 1, 2) async(3)
164 !$acc kernels loop num_gangs(8)
169 !$acc kernels loop num_workers(8)
174 !$acc kernels loop vector_length(128)
179 !$acc kernels loop if(.true.)
184 !$acc kernels loop if(ifCondition)
189 !ERROR: At most one IF clause can appear on the KERNELS LOOP directive
190 !$acc kernels loop if(.true.) if(ifCondition)
195 !$acc kernels loop self
200 !$acc kernels loop self(.true.)
205 !$acc kernels loop self(ifCondition)
210 !$acc kernels loop copy(aa) copyin(bb) copyout(cc)
215 !$acc kernels loop copy(aa, bb) copyout(zero: cc)
220 !$acc kernels loop present(aa, bb) create(cc)
225 !$acc kernels loop copyin(readonly: aa, bb) create(zero: cc)
230 !$acc kernels loop deviceptr(aa, bb) no_create(cc)
235 !ERROR: Argument `aa` on the ATTACH clause must be a variable or array with the POINTER or ALLOCATABLE attribute
236 !$acc kernels loop attach(aa, dd, p)
241 !$acc kernels loop private(aa, bb, cc)
246 !$acc kernels loop default(none)
251 !$acc kernels loop default(present)
256 !ERROR: At most one DEFAULT clause can appear on the KERNELS LOOP directive
257 !$acc kernels loop default(none) default(present)
262 !$acc kernels loop device_type(*)
267 !$acc kernels loop device_type(multicore)
272 !$acc kernels loop device_type(host, multicore)
277 !$acc kernels loop device_type(*) async wait num_gangs(8) num_workers(8) vector_length(128)
282 !$acc kernels loop device_type(*) async
287 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the KERNELS LOOP directive
288 !$acc kernels loop device_type(*) if(.TRUE.)
298 end program openacc_kernels_loop_validity