1 ! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
4 ! Check OpenACC clause validity for the following construct and directive:
7 program openacc_kernels_loop_validity
12 real(8), dimension(10) :: arr
16 integer :: i
, j
, b
, gang_size
, vector_size
, worker_size
17 integer, parameter :: N
= 256
18 integer, dimension(N
) :: c
19 logical, dimension(N
) :: d
, e
21 integer :: wait1
, wait2
23 logical :: reduction_l
24 real(8), dimension(N
, N
) :: aa
, bb
, cc
25 real(8), dimension(:), allocatable
:: dd
27 logical :: ifCondition
= .TRUE
.
29 type(atype
), dimension(10) :: ta
31 real(8), dimension(N
) :: a
, f
, g
, h
38 !$acc kernels loop num_gangs(8)
43 !$acc kernels loop num_gangs(gang_size)
48 !$acc kernels loop num_gangs(8)
53 !$acc kernels loop num_workers(worker_size)
58 !$acc kernels loop num_workers(8)
63 !$acc kernels loop vector_length(vector_size)
68 !$acc kernels loop vector_length(128)
73 !$acc kernels loop num_gangs(gang_size)
79 !$acc kernels loop if(.TRUE.)
84 !$acc kernels loop if(ifCondition)
93 !ERROR: Unmatched END SERIAL LOOP directive
96 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the KERNELS LOOP directive
97 !$acc kernels loop device_type(*) if(.TRUE.)
101 !$acc end kernels loop
103 !$acc kernels loop async
108 !$acc kernels loop async(1)
113 !$acc kernels loop async(async1)
118 !$acc kernels loop wait(wait1)
123 !$acc kernels loop wait(wait1, wait2)
128 !$acc kernels loop wait(wait1) wait(wait2)
133 !$acc kernels loop wait(1, 2) async(3)
138 !$acc kernels loop wait(queues: 1, 2) async(3)
143 !$acc kernels loop wait(devnum: 1: 1, 2) async(3)
148 !$acc kernels loop wait(devnum: 1: queues: 1, 2) async(3)
153 !$acc kernels loop num_gangs(8)
158 !$acc kernels loop num_workers(8)
163 !$acc kernels loop vector_length(128)
168 !$acc kernels loop if(.true.)
173 !$acc kernels loop if(ifCondition)
178 !ERROR: At most one IF clause can appear on the KERNELS LOOP directive
179 !$acc kernels loop if(.true.) if(ifCondition)
184 !$acc kernels loop self
189 !$acc kernels loop self(.true.)
194 !$acc kernels loop self(ifCondition)
199 !$acc kernels loop copy(aa) copyin(bb) copyout(cc)
204 !$acc kernels loop copy(aa, bb) copyout(zero: cc)
209 !$acc kernels loop present(aa, bb) create(cc)
214 !$acc kernels loop copyin(readonly: aa, bb) create(zero: cc)
219 !$acc kernels loop deviceptr(aa, bb) no_create(cc)
224 !ERROR: Argument `aa` on the ATTACH clause must be a variable or array with the POINTER or ALLOCATABLE attribute
225 !$acc kernels loop attach(aa, dd, p)
230 !$acc kernels loop private(aa, bb, cc)
235 !$acc kernels loop default(none)
240 !$acc kernels loop default(present)
245 !ERROR: At most one DEFAULT clause can appear on the KERNELS LOOP directive
246 !$acc kernels loop default(none) default(present)
251 !$acc kernels loop device_type(*)
256 !$acc kernels loop device_type(1)
261 !$acc kernels loop device_type(1, 3)
266 !$acc kernels loop device_type(*) async wait num_gangs(8) num_workers(8) vector_length(128)
271 !$acc kernels loop device_type(*) async
276 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the KERNELS LOOP directive
277 !$acc kernels loop device_type(*) if(.TRUE.)
282 end program openacc_kernels_loop_validity