1 ! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
4 ! Check OpenACC clause validity for the following construct and directive:
7 program openacc_serial_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
31 real(8), dimension(N
) :: a
, f
, g
, h
34 !ERROR: Directive SET may not be called within a compute region
35 !$acc set default_async(i)
41 !ERROR: Directive SET may not be called within a compute region
42 !$acc set default_async(i)
56 !ERROR: At most one ASYNC clause can appear on the SERIAL directive
57 !$acc serial async(1) async(2)
60 !$acc serial async(async1)
69 !$acc serial wait(wait1)
72 !$acc serial wait(1,2)
75 !$acc serial wait(wait1, wait2)
78 !$acc serial wait(wait1) wait(wait2)
81 !ERROR: NUM_GANGS clause is not allowed on the SERIAL directive
82 !$acc serial num_gangs(8)
85 !ERROR: NUM_WORKERS clause is not allowed on the SERIAL directive
86 !$acc serial num_workers(8)
89 !ERROR: VECTOR_LENGTH clause is not allowed on the SERIAL directive
90 !$acc serial vector_length(128)
93 !$acc serial if(.true.)
96 !ERROR: At most one IF clause can appear on the SERIAL directive
97 !$acc serial if(.true.) if(ifCondition)
100 !$acc serial if(ifCondition)
106 !$acc serial self(.true.)
109 !$acc serial self(ifCondition)
112 !$acc serial reduction(.neqv.: reduction_l)
113 !$acc loop reduction(.neqv.: reduction_l)
115 reduction_l
= d(i
) .neqv
. e(i
)
119 !$acc serial copy(aa) copyin(bb) copyout(cc)
122 !$acc serial copy(aa, bb) copyout(zero: cc)
125 !$acc serial present(aa, bb) create(cc)
128 !$acc serial copyin(readonly: aa, bb) create(zero: cc)
131 !$acc serial deviceptr(aa, bb) no_create(cc)
134 !ERROR: Argument `aa` on the ATTACH clause must be a variable or array with the POINTER or ALLOCATABLE attribute
135 !$acc serial attach(aa, dd, p)
138 !$acc serial firstprivate(bb, cc)
141 !$acc serial private(aa)
144 !$acc serial default(none)
147 !$acc serial default(present)
150 !ERROR: At most one DEFAULT clause can appear on the SERIAL directive
151 !$acc serial default(present) default(none)
154 !$acc serial device_type(*) async wait
157 !$acc serial device_type(*) async
163 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the SERIAL directive
164 !$acc serial device_type(*) if(.TRUE.)
170 end program openacc_serial_validity