| 1 |
! See also "lib-16-2.f90". |
| 2 |
! { dg-do run } |
| 3 |
! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } |
| 4 |
|
| 5 |
program main |
| 6 |
use openacc |
| 7 |
implicit none |
| 8 |
|
| 9 |
integer, parameter :: N = 256 |
| 10 |
integer, allocatable :: h(:) |
| 11 |
integer :: i |
| 12 |
integer :: async = 5 |
| 13 |
|
| 14 |
allocate (h(N)) |
| 15 |
|
| 16 |
do i = 1, N |
| 17 |
h(i) = i |
| 18 |
end do |
| 19 |
|
| 20 |
call acc_copyin (h) |
| 21 |
|
| 22 |
do i = 1, N |
| 23 |
h(i) = i + i |
| 24 |
end do |
| 25 |
|
| 26 |
call acc_update_device_async (h, sizeof (h), async) |
| 27 |
|
| 28 |
if (acc_is_present (h) .neqv. .TRUE.) stop 1 |
| 29 |
|
| 30 |
call acc_wait (async) |
| 31 |
|
| 32 |
h(:) = 0 |
| 33 |
|
| 34 |
call acc_copyout_async (h, sizeof (h), async) |
| 35 |
|
| 36 |
call acc_wait (async) |
| 37 |
|
| 38 |
do i = 1, N |
| 39 |
if (h(i) /= i + i) stop 2 |
| 40 |
end do |
| 41 |
|
| 42 |
call acc_copyin (h, sizeof (h)) |
| 43 |
|
| 44 |
h(:) = 0 |
| 45 |
|
| 46 |
call acc_update_self_async (h, sizeof (h), async) |
| 47 |
|
| 48 |
if (acc_is_present (h) .neqv. .TRUE.) stop 3 |
| 49 |
|
| 50 |
call acc_wait (async) |
| 51 |
|
| 52 |
do i = 1, N |
| 53 |
if (h(i) /= i + i) stop 4 |
| 54 |
end do |
| 55 |
|
| 56 |
call acc_delete_async (h, async) |
| 57 |
|
| 58 |
call acc_wait (async) |
| 59 |
|
| 60 |
if (acc_is_present (h) .neqv. .FALSE.) stop 5 |
| 61 |
|
| 62 |
end program |