1 ! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
4 ! Check OpenACC clause validity for the following construct and directive:
7 program openacc_parallel_validity
11 integer :: i
, j
, b
, gang_size
, vector_size
, worker_size
12 integer, parameter :: N
= 256
13 integer, dimension(N
) :: c
14 logical, dimension(N
) :: d
, e
16 integer :: wait1
, wait2
18 logical :: reduction_l
19 real(8), dimension(N
, N
) :: aa
, bb
, cc
20 real(8), dimension(:), allocatable
:: dd
22 logical :: ifCondition
= .TRUE
.
23 real(8), dimension(N
) :: a
, f
, g
, h
25 !$acc parallel device_type(*) num_gangs(2)
35 !$acc parallel async(1)
38 !$acc parallel async(async1)
44 !$acc parallel wait(1)
47 !$acc parallel wait(wait1)
50 !$acc parallel wait(1,2)
53 !$acc parallel wait(wait1, wait2)
56 !$acc parallel num_gangs(8)
59 !$acc parallel num_workers(8)
62 !$acc parallel vector_length(128)
65 !$acc parallel if(.true.)
68 !$acc parallel if(ifCondition)
74 !$acc parallel self(.true.)
77 !$acc parallel self(ifCondition)
80 !$acc parallel copy(aa) copyin(bb) copyout(cc)
83 !$acc parallel copy(aa, bb) copyout(zero: cc)
86 !$acc parallel present(aa, bb) create(cc)
89 !$acc parallel copyin(readonly: aa, bb) create(zero: cc)
92 !$acc parallel deviceptr(aa, bb) no_create(cc)
95 !ERROR: Argument `cc` on the ATTACH clause must be a variable or array with the POINTER or ALLOCATABLE attribute
96 !$acc parallel attach(dd, p, cc)
99 !$acc parallel private(aa) firstprivate(bb, cc)
102 !$acc parallel default(none)
105 !$acc parallel default(present)
108 !$acc parallel device_type(*)
111 !$acc parallel device_type(1)
114 !$acc parallel device_type(1, 3)
117 !ERROR: Clause PRIVATE is not allowed after clause DEVICE_TYPE on the PARALLEL directive
118 !ERROR: Clause FIRSTPRIVATE is not allowed after clause DEVICE_TYPE on the PARALLEL directive
119 !$acc parallel device_type(*) private(aa) firstprivate(bb)
122 !$acc parallel device_type(*) async
125 !$acc parallel device_type(*) wait
128 !$acc parallel device_type(*) num_gangs(8)
131 !$acc parallel device_type(1) async device_type(2) wait
134 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the PARALLEL directive
135 !$acc parallel device_type(*) if(.TRUE.)
142 end program openacc_parallel_validity