| 1 |
! Exercise the data movement runtime library functions on non-shared memory |
| 2 |
! targets. |
| 3 |
|
| 4 |
! { dg-do run } |
| 5 |
! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } |
| 6 |
|
| 7 |
program main |
| 8 |
use openacc |
| 9 |
implicit none |
| 10 |
|
| 11 |
integer, parameter :: N = 256 |
| 12 |
integer, allocatable :: h(:) |
| 13 |
integer :: i |
| 14 |
|
| 15 |
allocate (h(N)) |
| 16 |
|
| 17 |
do i = 1, N |
| 18 |
h(i) = i |
| 19 |
end do |
| 20 |
|
| 21 |
call acc_present_or_copyin (h) |
| 22 |
|
| 23 |
if (acc_is_present (h) .neqv. .TRUE.) stop 1 |
| 24 |
|
| 25 |
call acc_copyout (h) |
| 26 |
|
| 27 |
if (acc_is_present (h) .neqv. .FALSE.) stop 1 |
| 28 |
|
| 29 |
do i = 1, N |
| 30 |
if (h(i) /= i) stop 1 |
| 31 |
end do |
| 32 |
|
| 33 |
do i = 1, N |
| 34 |
h(i) = i + i |
| 35 |
end do |
| 36 |
|
| 37 |
call acc_pcopyin (h, sizeof (h)) |
| 38 |
|
| 39 |
if (acc_is_present (h) .neqv. .TRUE.) stop 1 |
| 40 |
|
| 41 |
call acc_copyout (h) |
| 42 |
|
| 43 |
if (acc_is_present (h) .neqv. .FALSE.) stop 1 |
| 44 |
|
| 45 |
do i = 1, N |
| 46 |
if (h(i) /= i + i) stop 1 |
| 47 |
end do |
| 48 |
|
| 49 |
call acc_create (h) |
| 50 |
|
| 51 |
if (acc_is_present (h) .neqv. .TRUE.) stop 1 |
| 52 |
|
| 53 |
!$acc parallel loop |
| 54 |
do i = 1, N |
| 55 |
h(i) = i |
| 56 |
end do |
| 57 |
!$end acc parallel |
| 58 |
|
| 59 |
call acc_copyout (h) |
| 60 |
|
| 61 |
if (acc_is_present (h) .neqv. .FALSE.) stop 1 |
| 62 |
|
| 63 |
do i = 1, N |
| 64 |
if (h(i) /= i) stop 1 |
| 65 |
end do |
| 66 |
|
| 67 |
call acc_present_or_create (h, sizeof (h)) |
| 68 |
|
| 69 |
if (acc_is_present (h) .neqv. .TRUE.) stop 1 |
| 70 |
|
| 71 |
call acc_delete (h) |
| 72 |
|
| 73 |
if (acc_is_present (h) .neqv. .FALSE.) stop 1 |
| 74 |
|
| 75 |
call acc_pcreate (h) |
| 76 |
|
| 77 |
if (acc_is_present (h) .neqv. .TRUE.) stop 1 |
| 78 |
|
| 79 |
call acc_delete (h) |
| 80 |
|
| 81 |
if (acc_is_present (h) .neqv. .FALSE.) stop 1 |
| 82 |
|
| 83 |
end program |