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_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
30 real(8), dimension(N
) :: a
, f
, g
, h
35 !$acc kernels async(1)
38 !$acc kernels async(async1)
41 !$acc kernels wait(wait1)
44 !$acc kernels wait(wait1, wait2)
47 !$acc kernels wait(1, 2) async(3)
50 !$acc kernels wait(queues: 1, 2) async(3)
53 !$acc kernels wait(1) wait(2) async(3)
56 !$acc kernels wait(devnum: 1: 1, 2) async(3)
59 !$acc kernels wait(devnum: 1: queues: 1, 2) async(3)
62 !$acc kernels num_gangs(8)
65 !$acc kernels num_workers(8)
68 !$acc kernels vector_length(128)
71 !$acc kernels if(.true.)
74 !$acc kernels if(ifCondition)
77 !ERROR: At most one IF clause can appear on the KERNELS directive
78 !$acc kernels if(.true.) if(ifCondition)
84 !$acc kernels self(.true.)
87 !$acc kernels self(ifCondition)
90 !$acc kernels copy(aa) copyin(bb) copyout(cc)
93 !$acc kernels copy(aa, bb) copyout(zero: cc)
96 !$acc kernels present(aa, bb) create(cc)
99 !$acc kernels copyin(readonly: aa, bb) create(zero: cc)
102 !$acc kernels deviceptr(aa, bb) no_create(cc)
105 !ERROR: Argument `aa` on the ATTACH clause must be a variable or array with the POINTER or ALLOCATABLE attribute
106 !$acc kernels attach(dd, p, aa)
109 !ERROR: PRIVATE clause is not allowed on the KERNELS directive
110 !$acc kernels private(aa, bb, cc)
113 !$acc kernels default(none)
116 !$acc kernels default(present)
119 !ERROR: At most one DEFAULT clause can appear on the KERNELS directive
120 !$acc kernels default(none) default(present)
123 !$acc kernels device_type(*)
126 !$acc kernels device_type(1)
129 !$acc kernels device_type(1, 3)
132 !$acc kernels device_type(*) async wait num_gangs(8) num_workers(8) vector_length(128)
135 !$acc kernels device_type(*) async
141 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the KERNELS directive
142 !$acc kernels device_type(*) if(.TRUE.)
148 end program openacc_kernels_validity