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_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
29 real(8), dimension(N
) :: a
, f
, g
, h
34 !$acc kernels async(1)
37 !$acc kernels async(async1)
40 !$acc kernels wait(wait1)
43 !$acc kernels wait(wait1, wait2)
46 !$acc kernels wait(1, 2) async(3)
49 !$acc kernels wait(queues: 1, 2) async(3)
52 !$acc kernels wait(1) wait(2) async(3)
55 !$acc kernels wait(devnum: 1: 1, 2) async(3)
58 !$acc kernels wait(devnum: 1: queues: 1, 2) async(3)
61 !$acc kernels num_gangs(8)
64 !$acc kernels num_workers(8)
67 !$acc kernels vector_length(128)
70 !$acc kernels if(.true.)
73 !$acc kernels if(ifCondition)
76 !ERROR: At most one IF clause can appear on the KERNELS directive
77 !$acc kernels if(.true.) if(ifCondition)
83 !$acc kernels self(.true.)
86 !$acc kernels self(ifCondition)
89 !$acc kernels copy(aa) copyin(bb) copyout(cc)
92 !$acc kernels copy(aa, bb) copyout(zero: cc)
95 !$acc kernels present(aa, bb) create(cc)
98 !$acc kernels copyin(readonly: aa, bb) create(zero: cc)
101 !$acc kernels deviceptr(aa, bb) no_create(cc)
104 !ERROR: Argument `aa` on the ATTACH clause must be a variable or array with the POINTER or ALLOCATABLE attribute
105 !$acc kernels attach(dd, p, aa)
108 !ERROR: PRIVATE clause is not allowed on the KERNELS directive
109 !$acc kernels private(aa, bb, cc)
112 !$acc kernels default(none)
115 !$acc kernels default(present)
118 !ERROR: At most one DEFAULT clause can appear on the KERNELS directive
119 !$acc kernels default(none) default(present)
122 !$acc kernels device_type(*)
125 !$acc kernels device_type(1)
128 !$acc kernels device_type(1, 3)
131 !$acc kernels device_type(*) async wait num_gangs(8) num_workers(8) vector_length(128)
134 !$acc kernels device_type(*) async
140 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the KERNELS directive
141 !$acc kernels device_type(*) if(.TRUE.)
147 end program openacc_kernels_validity