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 !$acc parallel num_workers(8)
61 !$acc parallel vector_length(128)
64 !$acc parallel if(.true.)
67 !$acc parallel if(ifCondition)
73 !$acc parallel self(.true.)
76 !$acc parallel self(ifCondition)
79 !$acc parallel copy(aa) copyin(bb) copyout(cc)
82 !$acc parallel copy(aa, bb) copyout(zero: cc)
85 !$acc parallel present(aa, bb) create(cc)
88 !$acc parallel copyin(readonly: aa, bb) create(zero: cc)
91 !$acc parallel deviceptr(aa, bb) no_create(cc)
94 !ERROR: Argument `cc` on the ATTACH clause must be a variable or array with the POINTER or ALLOCATABLE attribute
95 !$acc parallel attach(dd, p, cc)
98 !$acc parallel private(aa) firstprivate(bb, cc)
101 !$acc parallel default(none)
104 !$acc parallel default(present)
107 !$acc parallel device_type(*)
110 !$acc parallel device_type(1)
113 !$acc parallel device_type(1, 3)
116 !ERROR: Clause PRIVATE is not allowed after clause DEVICE_TYPE on the PARALLEL directive
117 !ERROR: Clause FIRSTPRIVATE is not allowed after clause DEVICE_TYPE on the PARALLEL directive
118 !$acc parallel device_type(*) private(aa) firstprivate(bb)
121 !$acc parallel device_type(*) async
124 !$acc parallel device_type(*) wait
127 !$acc parallel device_type(*) num_gangs(8)
130 !$acc parallel device_type(1) async device_type(2) wait
133 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the PARALLEL directive
134 !$acc parallel device_type(*) if(.TRUE.)
141 end program openacc_parallel_validity