brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.1 KiB · 45c0faf Raw
225 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang -fopenacc2 3! Check OpenACC clause validity for the following construct and directive:4!   2.5.1 Parallel5 6program openacc_parallel_validity7 8  implicit none9 10  integer :: i, j, b, gang_size, vector_size, worker_size11  integer, parameter :: N = 25612  integer, dimension(N) :: c13  logical, dimension(N) :: d, e14  integer :: async115  integer :: wait1, wait216  real :: reduction_r17  logical :: reduction_l18  real(8), dimension(N, N) :: aa, bb, cc19  real(8), dimension(:), allocatable :: dd20  real(8), pointer :: p21  logical :: ifCondition = .TRUE.22  real(8), dimension(N) :: a, f, g, h23 24  !$acc parallel device_type(*) num_gangs(2)25  !$acc loop26  do i = 1, N27    a(i) = 3.14d028  end do29  !$acc end parallel30 31  !$acc parallel async32  !$acc end parallel33 34  !$acc parallel async(1)35  !$acc end parallel36 37  !ERROR: At most one ASYNC clause can appear on the PARALLEL directive or in group separated by the DEVICE_TYPE clause38  !$acc parallel async(1) async(2)39  !$acc end parallel40 41  !$acc parallel async(1) device_type(nvidia) async(3)42  !$acc end parallel43 44  !ERROR: At most one ASYNC clause can appear on the PARALLEL directive or in group separated by the DEVICE_TYPE clause45  !$acc parallel async(1) device_type(nvidia) async(2) async(3)46  !$acc end parallel47 48  !$acc parallel async(async1)49  !$acc end parallel50 51  !$acc parallel wait52  !$acc end parallel53 54  !$acc parallel wait(1)55  !$acc end parallel56 57  !$acc parallel wait(wait1)58  !$acc end parallel59 60  !$acc parallel wait(1,2)61  !$acc end parallel62 63  !$acc parallel wait(wait1, wait2)64  !$acc end parallel65 66  !$acc parallel num_gangs(8)67  !$acc end parallel68 69  !ERROR: NUM_GANGS clause accepts a maximum of 3 arguments70  !$acc parallel num_gangs(1, 1, 1, 1)71  !$acc end parallel72 73  !$acc parallel num_workers(8)74  !$acc end parallel75 76  !$acc parallel vector_length(128)77  !$acc end parallel78 79  !$acc parallel if(.true.)80  !$acc end parallel81 82  !$acc parallel if(ifCondition)83  !$acc end parallel84 85  !$acc parallel self86  !$acc end parallel87 88  !$acc parallel self(.true.)89  !$acc end parallel90 91  !$acc parallel self(ifCondition)92  !$acc end parallel93 94  !$acc parallel copy(aa) copyin(bb) copyout(cc)95  !$acc end parallel96 97  !$acc parallel copy(aa, bb) copyout(zero: cc)98  !$acc end parallel99 100  !$acc parallel present(aa, bb) create(cc)101  !$acc end parallel102 103  !$acc parallel copyin(readonly: aa, bb) create(zero: cc)104  !$acc end parallel105 106  !$acc parallel deviceptr(aa, bb) no_create(cc)107  !$acc end parallel108 109  !ERROR: Argument `cc` on the ATTACH clause must be a variable or array with the POINTER or ALLOCATABLE attribute110  !$acc parallel attach(dd, p, cc)111  !$acc end parallel112 113  !$acc parallel private(aa) firstprivate(bb, cc)114  !$acc end parallel115 116  !$acc parallel default(none)117  !$acc end parallel118 119  !$acc parallel default(present)120  !$acc end parallel121 122  !$acc parallel device_type(*)123  !$acc end parallel124 125  !$acc parallel device_type(default)126  !$acc end parallel127 128  !$acc parallel device_type(default, host)129  !$acc end parallel130 131  !ERROR: Clause PRIVATE is not allowed after clause DEVICE_TYPE on the PARALLEL directive132  !ERROR: Clause FIRSTPRIVATE is not allowed after clause DEVICE_TYPE on the PARALLEL directive133  !$acc parallel device_type(*) private(aa) firstprivate(bb)134  !$acc end parallel135 136  !$acc parallel device_type(*) async137  !$acc end parallel138 139  !$acc parallel device_type(*) wait140  !$acc end parallel141 142  !$acc parallel device_type(*) num_gangs(8)143  !$acc end parallel144 145  !$acc parallel device_type(*) async device_type(host) wait146  !$acc end parallel147 148  !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the PARALLEL directive149  !$acc parallel device_type(*) if(.TRUE.)150  !$acc loop151  do i = 1, N152    a(i) = 3.14d0153  end do154  !$acc end parallel155 156  do i = 1, 100157    !$acc parallel158    !ERROR: CYCLE to construct outside of PARALLEL construct is not allowed159    if (i == 10) cycle160    !$acc end parallel161  end do162 163  !$acc parallel164  do i = 1, 100165    if (i == 10) cycle166  end do167  !$acc end parallel168 169  !ERROR: At most one NUM_GANGS clause can appear on the PARALLEL directive or in group separated by the DEVICE_TYPE clause170  !$acc parallel num_gangs(400) num_gangs(400)171  !$acc end parallel172 173  !ERROR: At most one NUM_GANGS clause can appear on the PARALLEL directive or in group separated by the DEVICE_TYPE clause174  !$acc parallel device_type(nvidia) num_gangs(400) num_gangs(200)175  !$acc end parallel176 177  !$acc parallel device_type(nvidia) num_gangs(400) device_type(radeon) num_gangs(200)178  !$acc end parallel179 180  !ERROR: At most one NUM_WORKERS clause can appear on the PARALLEL directive or in group separated by the DEVICE_TYPE clause181  !$acc parallel num_workers(8) num_workers(4)182  !$acc end parallel183 184  !ERROR: At most one NUM_WORKERS clause can appear on the PARALLEL directive or in group separated by the DEVICE_TYPE clause185  !$acc parallel device_type(nvidia) num_workers(8) num_workers(4)186  !$acc end parallel187 188  !$acc parallel device_type(nvidia) num_workers(8) device_type(radeon) num_workers(4)189  !$acc end parallel190 191  !ERROR: At most one VECTOR_LENGTH clause can appear on the PARALLEL directive or in group separated by the DEVICE_TYPE clause192  !$acc parallel vector_length(128) vector_length(124)193  !$acc end parallel194 195  !ERROR: At most one VECTOR_LENGTH clause can appear on the PARALLEL directive or in group separated by the DEVICE_TYPE clause196  !$acc parallel device_type(nvidia) vector_length(256) vector_length(128)197  !$acc end parallel198 199  !$acc parallel device_type(nvidia) vector_length(256) device_type(radeon) vector_length(128)200  !$acc end parallel201 202end program openacc_parallel_validity203 204subroutine acc_parallel_default_none205  integer :: i, l206  real :: a(10,10)207  l = 10  208  !$acc parallel default(none)209  !$acc loop210  !ERROR: The DEFAULT(NONE) clause requires that 'l' must be listed in a data-mapping clause211  do i = 1, l212    !ERROR: The DEFAULT(NONE) clause requires that 'a' must be listed in a data-mapping clause213    a(1,i) = 1214  end do215  !$acc end parallel216 217  !$acc data copy(a)218  !$acc parallel loop firstprivate(l) default(none)219  do i = 1, l220    a(1,i) = 1221  end do222  !$acc end parallel223  !$acc end data224end subroutine acc_parallel_default_none225