| 1 |
! { dg-do run } |
| 2 |
! { dg-additional-options "-cpp" } |
| 3 |
|
| 4 |
function is_mapped (n) result (rc) |
| 5 |
use openacc |
| 6 |
|
| 7 |
integer, intent (in) :: n |
| 8 |
logical rc |
| 9 |
|
| 10 |
#if ACC_MEM_SHARED |
| 11 |
integer i |
| 12 |
|
| 13 |
rc = .TRUE. |
| 14 |
i = n |
| 15 |
#else |
| 16 |
rc = acc_is_present (n, sizeof (n)) |
| 17 |
#endif |
| 18 |
|
| 19 |
end function is_mapped |
| 20 |
|
| 21 |
program main |
| 22 |
integer i, j |
| 23 |
logical is_mapped |
| 24 |
|
| 25 |
i = -1 |
| 26 |
j = -2 |
| 27 |
|
| 28 |
!$acc data copyin (i, j) |
| 29 |
if (is_mapped (i) .eqv. .FALSE.) stop 1 |
| 30 |
if (is_mapped (j) .eqv. .FALSE.) stop 2 |
| 31 |
|
| 32 |
if (i .ne. -1 .or. j .ne. -2) stop 3 |
| 33 |
|
| 34 |
i = 2 |
| 35 |
j = 1 |
| 36 |
|
| 37 |
if (i .ne. 2 .or. j .ne. 1) stop 4 |
| 38 |
!$acc end data |
| 39 |
|
| 40 |
if (i .ne. 2 .or. j .ne. 1) stop 5 |
| 41 |
|
| 42 |
i = -1 |
| 43 |
j = -2 |
| 44 |
|
| 45 |
!$acc data copyout (i, j) |
| 46 |
if (is_mapped (i) .eqv. .FALSE.) stop 6 |
| 47 |
if (is_mapped (j) .eqv. .FALSE.) stop 7 |
| 48 |
|
| 49 |
if (i .ne. -1 .or. j .ne. -2) stop 8 |
| 50 |
|
| 51 |
i = 2 |
| 52 |
j = 1 |
| 53 |
|
| 54 |
if (i .ne. 2 .or. j .ne. 1) stop 9 |
| 55 |
|
| 56 |
!$acc parallel present (i, j) |
| 57 |
i = 4 |
| 58 |
j = 2 |
| 59 |
!$acc end parallel |
| 60 |
!$acc end data |
| 61 |
|
| 62 |
if (i .ne. 4 .or. j .ne. 2) stop 10 |
| 63 |
|
| 64 |
i = -1 |
| 65 |
j = -2 |
| 66 |
|
| 67 |
!$acc data create (i, j) |
| 68 |
if (is_mapped (i) .eqv. .FALSE.) stop 11 |
| 69 |
if (is_mapped (j) .eqv. .FALSE.) stop 12 |
| 70 |
|
| 71 |
if (i .ne. -1 .or. j .ne. -2) stop 13 |
| 72 |
|
| 73 |
i = 2 |
| 74 |
j = 1 |
| 75 |
|
| 76 |
if (i .ne. 2 .or. j .ne. 1) stop 14 |
| 77 |
!$acc end data |
| 78 |
|
| 79 |
if (i .ne. 2 .or. j .ne. 1) stop 15 |
| 80 |
|
| 81 |
i = -1 |
| 82 |
j = -2 |
| 83 |
|
| 84 |
!$acc data present_or_copyin (i, j) |
| 85 |
if (is_mapped (i) .eqv. .FALSE.) stop 16 |
| 86 |
if (is_mapped (j) .eqv. .FALSE.) stop 17 |
| 87 |
|
| 88 |
if (i .ne. -1 .or. j .ne. -2) stop 18 |
| 89 |
|
| 90 |
i = 2 |
| 91 |
j = 1 |
| 92 |
|
| 93 |
if (i .ne. 2 .or. j .ne. 1) stop 19 |
| 94 |
!$acc end data |
| 95 |
|
| 96 |
if (i .ne. 2 .or. j .ne. 1) stop 20 |
| 97 |
|
| 98 |
i = -1 |
| 99 |
j = -2 |
| 100 |
|
| 101 |
!$acc data present_or_copyout (i, j) |
| 102 |
if (is_mapped (i) .eqv. .FALSE.) stop 21 |
| 103 |
if (is_mapped (j) .eqv. .FALSE.) stop 22 |
| 104 |
|
| 105 |
if (i .ne. -1 .or. j .ne. -2) stop 23 |
| 106 |
|
| 107 |
i = 2 |
| 108 |
j = 1 |
| 109 |
|
| 110 |
if (i .ne. 2 .or. j .ne. 1) stop 24 |
| 111 |
|
| 112 |
!$acc parallel present (i, j) |
| 113 |
i = 4 |
| 114 |
j = 2 |
| 115 |
!$acc end parallel |
| 116 |
!$acc end data |
| 117 |
|
| 118 |
if (i .ne. 4 .or. j .ne. 2) stop 25 |
| 119 |
|
| 120 |
i = -1 |
| 121 |
j = -2 |
| 122 |
|
| 123 |
!$acc data present_or_copy (i, j) |
| 124 |
if (is_mapped (i) .eqv. .FALSE.) stop 26 |
| 125 |
if (is_mapped (j) .eqv. .FALSE.) stop 27 |
| 126 |
|
| 127 |
if (i .ne. -1 .or. j .ne. -2) stop 28 |
| 128 |
|
| 129 |
i = 2 |
| 130 |
j = 1 |
| 131 |
|
| 132 |
if (i .ne. 2 .or. j .ne. 1) stop 29 |
| 133 |
!$acc end data |
| 134 |
|
| 135 |
#if ACC_MEM_SHARED |
| 136 |
if (i .ne. 2 .or. j .ne. 1) stop 30 |
| 137 |
#else |
| 138 |
if (i .ne. -1 .or. j .ne. -2) stop 31 |
| 139 |
#endif |
| 140 |
|
| 141 |
i = -1 |
| 142 |
j = -2 |
| 143 |
|
| 144 |
!$acc data present_or_create (i, j) |
| 145 |
if (is_mapped (i) .eqv. .FALSE.) stop 32 |
| 146 |
if (is_mapped (j) .eqv. .FALSE.) stop 33 |
| 147 |
|
| 148 |
i = 2 |
| 149 |
j = 1 |
| 150 |
|
| 151 |
if (i .ne. 2 .or. j .ne. 1) stop 34 |
| 152 |
!$acc end data |
| 153 |
|
| 154 |
if (i .ne. 2 .or. j .ne. 1) stop 35 |
| 155 |
|
| 156 |
i = -1 |
| 157 |
j = -2 |
| 158 |
|
| 159 |
!$acc data copyin (i, j) |
| 160 |
!$acc data present (i, j) |
| 161 |
if (is_mapped (i) .eqv. .FALSE.) stop 36 |
| 162 |
if (is_mapped (j) .eqv. .FALSE.) stop 37 |
| 163 |
|
| 164 |
if (i .ne. -1 .or. j .ne. -2) stop 38 |
| 165 |
|
| 166 |
i = 2 |
| 167 |
j = 1 |
| 168 |
|
| 169 |
if (i .ne. 2 .or. j .ne. 1) stop 39 |
| 170 |
!$acc end data |
| 171 |
!$acc end data |
| 172 |
|
| 173 |
if (i .ne. 2 .or. j .ne. 1) stop 40 |
| 174 |
|
| 175 |
i = -1 |
| 176 |
j = -2 |
| 177 |
|
| 178 |
!$acc data copyin (i, j) |
| 179 |
!$acc data present (i, j) |
| 180 |
if (is_mapped (i) .eqv. .FALSE.) stop 41 |
| 181 |
if (is_mapped (j) .eqv. .FALSE.) stop 42 |
| 182 |
|
| 183 |
if (i .ne. -1 .or. j .ne. -2) stop 43 |
| 184 |
|
| 185 |
i = 2 |
| 186 |
j = 1 |
| 187 |
|
| 188 |
if (i .ne. 2 .or. j .ne. 1) stop 44 |
| 189 |
!$acc end data |
| 190 |
!$acc end data |
| 191 |
|
| 192 |
if (i .ne. 2 .or. j .ne. 1) stop 45 |
| 193 |
|
| 194 |
i = -1 |
| 195 |
j = -2 |
| 196 |
|
| 197 |
!$acc data |
| 198 |
#if !ACC_MEM_SHARED |
| 199 |
if (is_mapped (i) .eqv. .TRUE.) stop 46 |
| 200 |
if (is_mapped (j) .eqv. .TRUE.) stop 47 |
| 201 |
#endif |
| 202 |
if (i .ne. -1 .or. j .ne. -2) stop 48 |
| 203 |
|
| 204 |
i = 2 |
| 205 |
j = 1 |
| 206 |
|
| 207 |
if (i .ne. 2 .or. j .ne. 1) stop 49 |
| 208 |
!$acc end data |
| 209 |
|
| 210 |
if (i .ne. 2 .or. j .ne. 1) stop 50 |
| 211 |
|
| 212 |
end program main |