1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
|
! RUN: %S/test_errors.sh %s %t %f18 -fopenacc
! Check OpenACC clause validity for the following construct and directive:
! 2.6.5 Data
! 2.5.1 Parallel
! 2.5.2 Kernels
! 2.5.3 Serial
! 2.15.1 Routine
! 2.11 Parallel Loop
! 2.11 Kernels Loop
! 2.11 Serial Loop
program openacc_clause_validity
implicit none
integer :: i, j
integer :: N = 256
!ERROR: At least one clause is required on the DECLARE directive
!$acc declare
real(8) :: a(256)
!ERROR: At least one of ATTACH, COPYIN, CREATE clause must appear on the ENTER DATA directive
!$acc enter data
!ERROR: Only the READONLY modifier is allowed for the COPYIN clause on the ENTER DATA directive
!$acc enter data copyin(zero: i)
!ERROR: Only the ZERO modifier is allowed for the CREATE clause on the ENTER DATA directive
!$acc enter data create(readonly: i)
!ERROR: Only the ZERO modifier is allowed for the COPYOUT clause on the DATA directive
!$acc data copyout(readonly: i)
!$acc end data
!ERROR: COPYOUT clause is not allowed on the ENTER DATA directive
!$acc enter data copyin(i) copyout(i)
!ERROR: At most one IF clause can appear on the DATA directive
!$acc data copy(i) if(.true.) if(.true.)
!$acc end data
!ERROR: At least one of COPYOUT, DELETE, DETACH clause must appear on the EXIT DATA directive
!$acc exit data
!ERROR: At least one of USE_DEVICE clause must appear on the HOST_DATA directive
!$acc host_data
!$acc end host_data
!ERROR: At least one of DEFAULT_ASYNC, DEVICE_NUM, DEVICE_TYPE clause must appear on the SET directive
!$acc set
!ERROR: At least one of ATTACH, COPY, COPYIN, COPYOUT, CREATE, DEFAULT, DEVICEPTR, NO_CREATE, PRESENT clause must appear on the DATA directive
!$acc data
!$acc end data
!$acc data copyin(i)
!$acc end data
!$acc data copyin(i)
!ERROR: Unmatched PARALLEL directive
!$acc end parallel
!$acc update device(i) device_type(*) async
!ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the UPDATE directive
!$acc update device(i) device_type(*) if(.TRUE.)
!$acc parallel
!ERROR: INDEPENDENT and SEQ clauses are mutually exclusive and may not appear on the same LOOP directive
!$acc loop seq independent
do i = 1, N
a(i) = 3.14
end do
!$acc end parallel
!$acc parallel device_type(*) num_gangs(2)
!$acc loop
do i = 1, N
a(i) = 3.14
end do
!$acc end parallel
!$acc parallel
!ERROR: The parameter of the COLLAPSE clause on the LOOP directive must be a constant positive integer expression
!$acc loop collapse(-1)
do i = 1, N
do j = 1, N
a(i) = 3.14 + j
end do
end do
!$acc end parallel
!$acc parallel
!ERROR: Clause PRIVATE is not allowed after clause DEVICE_TYPE on the LOOP directive
!$acc loop device_type(*) private(i)
do i = 1, N
a(i) = 3.14
end do
!$acc end parallel
!$acc parallel
!ERROR: Clause GANG is not allowed if clause SEQ appears on the LOOP directive
!$acc loop gang seq
do i = 1, N
a(i) = 3.14
end do
!$acc end parallel
!ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the PARALLEL directive
!$acc parallel device_type(*) if(.TRUE.)
!$acc loop
do i = 1, N
a(i) = 3.14
end do
!$acc end parallel
!ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the PARALLEL LOOP directive
!$acc parallel loop device_type(*) if(.TRUE.)
do i = 1, N
a(i) = 3.14
end do
!$acc end parallel loop
!$acc kernels device_type(*) async
do i = 1, N
a(i) = 3.14
end do
!$acc end kernels
!ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the KERNELS directive
!$acc kernels device_type(*) if(.TRUE.)
do i = 1, N
a(i) = 3.14
end do
!$acc end kernels
!ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the KERNELS LOOP directive
!$acc kernels loop device_type(*) if(.TRUE.)
do i = 1, N
a(i) = 3.14
end do
!$acc end kernels loop
!$acc serial device_type(*) async
do i = 1, N
a(i) = 3.14
end do
!$acc end serial
!ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the SERIAL directive
!$acc serial device_type(*) if(.TRUE.)
do i = 1, N
a(i) = 3.14
end do
!$acc end serial
!ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the SERIAL LOOP directive
!$acc serial loop device_type(*) if(.TRUE.)
do i = 1, N
a(i) = 3.14
end do
!$acc end serial loop
contains
subroutine sub1(a)
real :: a(:)
!ERROR: At least one of GANG, SEQ, VECTOR, WORKER clause must appear on the ROUTINE directive
!$acc routine
end subroutine sub1
subroutine sub2(a)
real :: a(:)
!ERROR: Clause NOHOST is not allowed after clause DEVICE_TYPE on the ROUTINE directive
!$acc routine seq device_type(*) nohost
end subroutine sub2
end program openacc_clause_validity
|