190 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang -fopenacc -pedantic2 3! Check OpenACC clause validity for the following construct and directive:4! 2.5.2 Serial5 6program openacc_serial_validity7 8 implicit none9 10 type atype11 real(8), dimension(10) :: arr12 real(8) :: s13 end type atype14 15 integer :: i, j, b, gang_size, vector_size, worker_size16 integer, parameter :: N = 25617 integer, dimension(N) :: c18 logical, dimension(N) :: d, e19 integer :: async120 integer :: wait1, wait221 real :: reduction_r22 logical :: reduction_l23 real(8), dimension(N, N) :: aa, bb, cc24 real(8), dimension(:), allocatable :: dd25 real(8), pointer :: p26 logical :: ifCondition = .TRUE.27 type(atype) :: t28 type(atype), dimension(10) :: ta29 30 real(8), dimension(N) :: a, f, g, h31 32 !$acc serial33 !ERROR: Directive SET may not be called within a compute region34 !$acc set default_async(i)35 !$acc end serial36 37 !$acc serial38 !$acc loop39 do i = 1, N40 !ERROR: Directive SET may not be called within a compute region41 !$acc set default_async(i)42 a(i) = 3.14d043 end do44 !$acc end serial45 46 !$acc serial47 !$acc end serial48 49 !$acc serial async50 !$acc end serial51 52 !$acc serial async(1)53 !$acc end serial54 55 !ERROR: At most one ASYNC clause can appear on the SERIAL directive or in group separated by the DEVICE_TYPE clause56 !$acc serial async(1) async(2)57 !$acc end serial58 59 !ERROR: At most one ASYNC clause can appear on the SERIAL directive or in group separated by the DEVICE_TYPE clause60 !$acc serial async(1) device_type(nvidia) async(2) async(4)61 !$acc end serial62 63 !$acc serial async(1) device_type(nvidia) async(2)64 !$acc end serial65 66 !$acc serial async(async1)67 !$acc end serial68 69 !$acc serial wait70 !$acc end serial71 72 !$acc serial wait(1)73 !$acc end serial74 75 !$acc serial wait(wait1)76 !$acc end serial77 78 !$acc serial wait(1,2)79 !$acc end serial80 81 !$acc serial wait(wait1, wait2)82 !$acc end serial83 84 !$acc serial wait(wait1) wait(wait2)85 !$acc end serial86 87 !PORTABILITY: NUM_GANGS clause is not allowed on the SERIAL directive and will be ignored [-Wportability]88 !$acc serial num_gangs(8)89 !$acc end serial90 91 !PORTABILITY: NUM_WORKERS clause is not allowed on the SERIAL directive and will be ignored [-Wportability]92 !$acc serial num_workers(8)93 !$acc end serial94 95 !PORTABILITY: VECTOR_LENGTH clause is not allowed on the SERIAL directive and will be ignored [-Wportability]96 !$acc serial vector_length(128)97 !$acc end serial98 99 !$acc serial if(.true.)100 !$acc end serial101 102 !ERROR: At most one IF clause can appear on the SERIAL directive103 !$acc serial if(.true.) if(ifCondition)104 !$acc end serial105 106 !$acc serial if(ifCondition)107 !$acc end serial108 109 !$acc serial self110 !$acc end serial111 112 !$acc serial self(.true.)113 !$acc end serial114 115 !$acc serial self(ifCondition)116 !$acc end serial117 118 !$acc serial reduction(.neqv.: reduction_l)119 !$acc loop reduction(.neqv.: reduction_l)120 do i = 1, N121 reduction_l = d(i) .neqv. e(i)122 end do123 !$acc end serial124 125 !$acc serial copy(aa) copyin(bb) copyout(cc)126 !$acc end serial127 128 !$acc serial copy(aa, bb) copyout(zero: cc)129 !$acc end serial130 131 !$acc serial present(aa, bb) create(cc)132 !$acc end serial133 134 !$acc serial copyin(readonly: aa, bb) create(zero: cc)135 !$acc end serial136 137 !$acc serial deviceptr(aa, bb) no_create(cc)138 !$acc end serial139 140 !ERROR: Argument `aa` on the ATTACH clause must be a variable or array with the POINTER or ALLOCATABLE attribute141 !$acc serial attach(aa, dd, p)142 !$acc end serial143 144 !$acc serial firstprivate(bb, cc)145 !$acc end serial146 147 !$acc serial private(aa)148 !$acc end serial149 150 !$acc serial default(none)151 !$acc end serial152 153 !$acc serial default(present)154 !$acc end serial155 156 !ERROR: At most one DEFAULT clause can appear on the SERIAL directive157 !$acc serial default(present) default(none)158 !$acc end serial159 160 !$acc serial device_type(*) async wait161 !$acc end serial162 163 !$acc serial device_type(*) async164 do i = 1, N165 a(i) = 3.14d0166 end do167 !$acc end serial168 169 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the SERIAL directive170 !$acc serial device_type(*) if(.TRUE.)171 do i = 1, N172 a(i) = 3.14d0173 end do174 !$acc end serial175 176 do i = 1, 100177 !$acc serial178 !ERROR: CYCLE to construct outside of SERIAL construct is not allowed179 if (i == 10) cycle180 !$acc end serial181 end do182 183 !$acc serial184 do i = 1, 100185 if (i == 10) cycle186 end do187 !$acc end serial188 189end program openacc_serial_validity190