1 ! { dg-additional-options "-foffload-options=nvptx-none=-misa=sm_35" { target { offload_target_nvptx } } }
3 ! Copying on-device allocated memory fails with cuMemcpyDtoHAsync error: invalid argument
4 ! Hence, reverse-offload-5.f90 has been copied to *this* file,
5 ! which uses on-host allocated vars - but only on the device side stack variables
8 !$omp requires reverse_offload
10 integer, allocatable
:: A(:), A2(:), s1
, s2
21 !$omp target map(to: shared_mem)
25 !$omp target map(to: A, A2, s1, s2)
28 integer :: ai(4), ai2(4), si1
, si2
40 !$omp target device (ancestor:1) &
41 !$omp& map(to: A, s1, ai, si1) map(always, to: a2, s2) &
42 !$omp& map(tofrom: ai2, si2)
44 if (any (a
/= 2 * [1,2,3,4])) stop 1
45 if (s1
/= 4 * 532) stop 2
47 if (any (a
/= [1,2,3,4])) stop 3
50 if (any (a2
/= 3 * [8,7,6,5])) stop 5
51 if (s2
/= 5 * 55) stop 6
52 if (any (ai
/= [23,35,86,43])) stop 7
53 if (any (ai2
/= [8,4,7,1])) stop 8
55 if (si2
/= 765) stop 10
68 if (any (a
/= 3 * 2 * [1,2,3,4])) stop 11
69 if (any (a2
/= 7 * 3 * [8,7,6,5])) stop 12
70 if (s1
/= 11 * 4 * 532) stop 13
71 if (s2
/= 5 * 5 * 55) stop 14
72 if (any (ai
/= 13 * [23,35,86,43])) stop 15
73 if (si1
/= 27 * 64) stop 16
75 if (any (a
/= 2 * [1,2,3,4])) stop 17
76 if (any (a2
/= 3 * [8,7,6,5])) stop 18
77 if (s1
/= 4 * 532) stop 19
78 if (s2
/= 5 * 55) stop 20
79 if (any (ai
/= [23,35,86,43])) stop 22
80 if (si1
/= 64) stop 23
82 if (any (ai2
/= 21 * [8,4,7,1])) stop 24
83 if (si2
/= 31 * 765) stop 25
86 if (any (a
/= 3 * 2 * [1,2,3,4])) stop 30
87 if (any (a2
/= 7 * 3 * [8,7,6,5])) stop 31
88 if (s1
/= 11 * 4 * 532) stop 32
89 if (s2
/= 5 * 5 * 55) stop 33
91 if (any (a
/= 3 * [1,2,3,4])) stop 34
92 if (any (a2
/= 3 * 7 * [8,7,6,5])) stop 35
93 if (s1
/= 11 * 532) stop 36
94 if (s2
/= 5 * 5 * 55) stop 37
97 deallocate (a
, a2
, s1
, s2
)