1 ! RUN: %python %S/../test_errors.py %s %flang -fopenacc
3 ! Check OpenACC clause validity for the following construct and directive:
6 program openacc_parallel_validity
10 integer :: i
, j
, b
, gang_size
, vector_size
, worker_size
11 integer, parameter :: N
= 256
12 integer, dimension(N
) :: c
13 logical, dimension(N
) :: d
, e
15 integer :: wait1
, wait2
17 logical :: reduction_l
18 real(8), dimension(N
, N
) :: aa
, bb
, cc
19 real(8), dimension(:), allocatable
:: dd
21 logical :: ifCondition
= .TRUE
.
22 real(8), dimension(N
) :: a
, f
, g
, h
24 !$acc parallel device_type(*) num_gangs(2)
34 !$acc parallel async(1)
37 !$acc parallel async(async1)
43 !$acc parallel wait(1)
46 !$acc parallel wait(wait1)
49 !$acc parallel wait(1,2)
52 !$acc parallel wait(wait1, wait2)
55 !$acc parallel num_gangs(8)
58 !ERROR: NUM_GANGS clause accepts a maximum of 3 arguments
59 !$acc parallel num_gangs(1, 1, 1, 1)
62 !$acc parallel num_workers(8)
65 !$acc parallel vector_length(128)
68 !$acc parallel if(.true.)
71 !$acc parallel if(ifCondition)
77 !$acc parallel self(.true.)
80 !$acc parallel self(ifCondition)
83 !$acc parallel copy(aa) copyin(bb) copyout(cc)
86 !$acc parallel copy(aa, bb) copyout(zero: cc)
89 !$acc parallel present(aa, bb) create(cc)
92 !$acc parallel copyin(readonly: aa, bb) create(zero: cc)
95 !$acc parallel deviceptr(aa, bb) no_create(cc)
98 !ERROR: Argument `cc` on the ATTACH clause must be a variable or array with the POINTER or ALLOCATABLE attribute
99 !$acc parallel attach(dd, p, cc)
102 !$acc parallel private(aa) firstprivate(bb, cc)
105 !$acc parallel default(none)
108 !$acc parallel default(present)
111 !$acc parallel device_type(*)
114 !$acc parallel device_type(default)
117 !$acc parallel device_type(default, host)
120 !ERROR: Clause PRIVATE is not allowed after clause DEVICE_TYPE on the PARALLEL directive
121 !ERROR: Clause FIRSTPRIVATE is not allowed after clause DEVICE_TYPE on the PARALLEL directive
122 !$acc parallel device_type(*) private(aa) firstprivate(bb)
125 !$acc parallel device_type(*) async
128 !$acc parallel device_type(*) wait
131 !$acc parallel device_type(*) num_gangs(8)
134 !$acc parallel device_type(*) async device_type(host) wait
137 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the PARALLEL directive
138 !$acc parallel device_type(*) if(.TRUE.)
147 !ERROR: CYCLE to construct outside of PARALLEL construct is not allowed
158 !ERROR: At most one NUM_GANGS clause can appear on the PARALLEL directive or in group separated by the DEVICE_TYPE clause
159 !$acc parallel num_gangs(400) num_gangs(400)
162 !ERROR: At most one NUM_GANGS clause can appear on the PARALLEL directive or in group separated by the DEVICE_TYPE clause
163 !$acc parallel device_type(nvidia) num_gangs(400) num_gangs(200)
166 !$acc parallel device_type(nvidia) num_gangs(400) device_type(radeon) num_gangs(200)
169 !ERROR: At most one NUM_WORKERS clause can appear on the PARALLEL directive or in group separated by the DEVICE_TYPE clause
170 !$acc parallel num_workers(8) num_workers(4)
173 !ERROR: At most one NUM_WORKERS clause can appear on the PARALLEL directive or in group separated by the DEVICE_TYPE clause
174 !$acc parallel device_type(nvidia) num_workers(8) num_workers(4)
177 !$acc parallel device_type(nvidia) num_workers(8) device_type(radeon) num_workers(4)
180 !ERROR: At most one VECTOR_LENGTH clause can appear on the PARALLEL directive or in group separated by the DEVICE_TYPE clause
181 !$acc parallel vector_length(128) vector_length(124)
184 !ERROR: At most one VECTOR_LENGTH clause can appear on the PARALLEL directive or in group separated by the DEVICE_TYPE clause
185 !$acc parallel device_type(nvidia) vector_length(256) vector_length(128)
188 !$acc parallel device_type(nvidia) vector_length(256) device_type(radeon) vector_length(128)
191 end program openacc_parallel_validity