| 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) |
| 6 |
integer :: i, error |
| 7 |
logical :: shared_mem |
| 8 |
|
| 9 |
error = 0 |
| 10 |
shared_mem = .false. |
| 11 |
A = [(i, i=1,50)] |
| 12 |
A2 = [(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)) map(from: error) |
| 19 |
block |
| 20 |
integer :: B(10), C(10) |
| 21 |
B = 99 |
| 22 |
C = 88 |
| 23 |
A(20:40) = -A(20:40) |
| 24 |
A2(20:40) = -A2(20:40) |
| 25 |
|
| 26 |
!$omp target device (ancestor:1) & |
| 27 |
!$omp& map(to: A(25:35)) map(always, to: A2(25:35)) & |
| 28 |
!$omp& map(from:B(4:8)) map(tofrom:C(4:8)) |
| 29 |
if (shared_mem) then |
| 30 |
if (any (A(25:35) /= [(-i,i=25,35)])) stop 20 |
| 31 |
else |
| 32 |
if (any (A(25:35) /= [( i,i=25,35)])) stop 21 |
| 33 |
end if |
| 34 |
if (any (A2(25:35) /= [(-i,i=25,35)])) stop 22 |
| 35 |
if (any (C(4:8) /= 88)) stop 23 |
| 36 |
|
| 37 |
A(25:35) = -A(25:35)*10 |
| 38 |
A2(25:35) = -A2(25:35)*10 |
| 39 |
B(4:8) = [4,5,6,7,8] |
| 40 |
C(4:8) = [-4,-5,-6,-7,-8] |
| 41 |
!$omp end target |
| 42 |
|
| 43 |
if (any (B(1:3) /= 99) .or. any (B(9:10) /= 99)) then |
| 44 |
error = 30 |
| 45 |
elseif (any (B(4:8) /= [4,5,6,7,8])) then |
| 46 |
error = 31 |
| 47 |
elseif (any (C(1:3) /= 88) .or. any (C(9:10) /= 88)) then |
| 48 |
error = 32 |
| 49 |
elseif (any (C(4:8) /= [-4,-5,-6,-7,-8])) then |
| 50 |
error = 33 |
| 51 |
else |
| 52 |
error = 0 |
| 53 |
endif |
| 54 |
end block |
| 55 |
|
| 56 |
if (error /= 0) stop error |
| 57 |
|
| 58 |
if (shared_mem) then |
| 59 |
if (any (A(1:19) /= [( i, i=1,19)])) stop 1 |
| 60 |
if (any (A(20:24) /= [(-i, i=20,24)])) stop 2 |
| 61 |
if (any (A(36:40) /= [(-i, i=36,40)])) stop 3 |
| 62 |
if (any (A(41:50) /= [( i, i=41,50)])) stop 4 |
| 63 |
|
| 64 |
if (any (A(25:35) /= [( 10*i, i=25,35)])) stop 5 |
| 65 |
else |
| 66 |
if (any (A(1:24) /= [( i, i=1,24)])) stop 6 |
| 67 |
if (any (A(36:50) /= [( i, i=36,50)])) stop 7 |
| 68 |
|
| 69 |
if (any (A(25:35) /= [(-10*i, i=25,35)])) stop 8 |
| 70 |
end if |
| 71 |
if (any (A2(25:35) /= [( 10*i, i=25,35)])) stop 9 |
| 72 |
end |