| 1 |
! { dg-additional-options "-foffload-options=nvptx-none=-misa=sm_35" { target { offload_target_nvptx } } } |
| 2 |
|
| 3 |
implicit none |
| 4 |
!$omp requires reverse_offload |
| 5 |
integer :: A(50), A2(50), A3(50) |
| 6 |
integer :: i |
| 7 |
logical :: shared_mem |
| 8 |
|
| 9 |
shared_mem = .false. |
| 10 |
A = [(3*i, i=1,50)] |
| 11 |
A2 = [(7*i, i=1,50)] |
| 12 |
A3 = [(11*i, i=1,50)] |
| 13 |
|
| 14 |
!$omp target map(to: shared_mem) |
| 15 |
shared_mem = .true. |
| 16 |
!$omp end target |
| 17 |
|
| 18 |
!$omp target map(to: A(20:40), A2(20:40), A3(20:40)) |
| 19 |
block |
| 20 |
integer :: C(10) |
| 21 |
C = 88 |
| 22 |
A(20:40) = -2*A(20:40) |
| 23 |
A2(20:40) = -9*A2(20:40) |
| 24 |
A3(20:40) = -13*A3(20:40) |
| 25 |
|
| 26 |
!$omp target device (ancestor:1) & |
| 27 |
!$omp& map(from: A(25:35)) map(always, from: A2(25:35)) & |
| 28 |
!$omp& map(alloc: A3(25:35)) map(alloc:C(4:8)) |
| 29 |
if (shared_mem) then |
| 30 |
if (any (A(25:35) /= [(-2*3*i, i=25,35)])) stop 1 |
| 31 |
if (any (A2(25:35) /= [(-9*7*i, i=25,35)])) stop 2 |
| 32 |
if (any (A3(25:35) /= [(-13*11*i, i=25,35)])) stop 3 |
| 33 |
else |
| 34 |
if (any (A(25:35) /= [(3*i, i=25,35)])) stop 4 |
| 35 |
if (any (A2(25:35) /= [(7*i, i=25,35)])) stop 5 |
| 36 |
if (any (A3(25:35) /= [(11*i, i=25,35)])) stop 6 |
| 37 |
end if |
| 38 |
|
| 39 |
A(25:35) = A(25:35)*5 |
| 40 |
A2(25:35) = A2(25:35)*8 |
| 41 |
A3(25:35) = A3(25:35)*18 |
| 42 |
C(4:8) = [4,5,6,7,8] |
| 43 |
!$omp end target |
| 44 |
|
| 45 |
if (shared_mem) then |
| 46 |
if (any (A(25:35) /= [(-2*3*5*i, i=25,35)])) stop 7 |
| 47 |
if (any (A2(25:35) /= [(-9*7*8*i, i=25,35)])) stop 8 |
| 48 |
if (any (A3(25:35) /= [(-13*11*18*i, i=25,35)])) stop 9 |
| 49 |
if (any (C(4:8) /= [4,5,6,7,8])) stop 10 |
| 50 |
else |
| 51 |
if (any (A(25:35) /= [(-2*3*i, i=25,35)])) stop 11 |
| 52 |
if (any (A2(25:35) /= [(7*8*i, i=25,35)])) stop 12 |
| 53 |
if (any (A3(25:35) /= [(-13*11*i, i=25,35)])) stop 13 |
| 54 |
if (any (C(4:8) /= 88)) stop 14 |
| 55 |
end if |
| 56 |
end block |
| 57 |
|
| 58 |
if (shared_mem) then |
| 59 |
if (any (A(25:35) /= [(-2*3*5*i, i=25,35)])) stop |
| 60 |
if (any (A2(25:35) /= [(-9*7**8*i, i=25,35)])) stop |
| 61 |
if (any (A3(25:35) /= [(-13*11*18*i, i=25,35)])) stop |
| 62 |
else |
| 63 |
if (any (A(25:35) /= [(3*5*i, i=25,35)])) stop |
| 64 |
if (any (A2(25:35) /= [(7*8*i, i=25,35)])) stop |
| 65 |
if (any (A3(25:35) /= [(11*18*i, i=25,35)])) stop |
| 66 |
end if |
| 67 |
|
| 68 |
end |