2018-11-30 21:38:57 +01:00
|
|
|
! See also "lib-16.f90".
|
|
|
|
! { dg-do run }
|
|
|
|
! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } }
|
|
|
|
|
|
|
|
program main
|
|
|
|
implicit none
|
|
|
|
include "openacc_lib.h"
|
|
|
|
|
|
|
|
integer, parameter :: N = 256
|
|
|
|
integer, allocatable :: h(:)
|
|
|
|
integer :: i
|
|
|
|
integer :: async = 5
|
|
|
|
|
|
|
|
allocate (h(N))
|
|
|
|
|
|
|
|
do i = 1, N
|
|
|
|
h(i) = i
|
|
|
|
end do
|
|
|
|
|
|
|
|
call acc_copyin (h)
|
|
|
|
|
|
|
|
do i = 1, N
|
|
|
|
h(i) = i + i
|
|
|
|
end do
|
|
|
|
|
|
|
|
call acc_update_device_async (h, sizeof (h), async)
|
|
|
|
|
2019-10-28 08:39:26 +01:00
|
|
|
if (acc_is_present (h) .neqv. .TRUE.) stop 1
|
2018-11-30 21:38:57 +01:00
|
|
|
|
2021-06-08 19:32:22 +02:00
|
|
|
call acc_wait (async)
|
|
|
|
|
2018-11-30 21:38:57 +01:00
|
|
|
h(:) = 0
|
|
|
|
|
|
|
|
call acc_copyout_async (h, sizeof (h), async)
|
|
|
|
|
|
|
|
call acc_wait (async)
|
|
|
|
|
|
|
|
do i = 1, N
|
2019-10-28 08:39:26 +01:00
|
|
|
if (h(i) /= i + i) stop 2
|
2018-11-30 21:38:57 +01:00
|
|
|
end do
|
|
|
|
|
|
|
|
call acc_copyin (h, sizeof (h))
|
|
|
|
|
|
|
|
h(:) = 0
|
|
|
|
|
|
|
|
call acc_update_self_async (h, sizeof (h), async)
|
|
|
|
|
2019-10-28 08:39:26 +01:00
|
|
|
if (acc_is_present (h) .neqv. .TRUE.) stop 3
|
2018-11-30 21:38:57 +01:00
|
|
|
|
2021-06-08 19:32:22 +02:00
|
|
|
call acc_wait (async)
|
|
|
|
|
2018-11-30 21:38:57 +01:00
|
|
|
do i = 1, N
|
2019-10-28 08:39:26 +01:00
|
|
|
if (h(i) /= i + i) stop 4
|
2018-11-30 21:38:57 +01:00
|
|
|
end do
|
|
|
|
|
|
|
|
call acc_delete_async (h, async)
|
|
|
|
|
|
|
|
call acc_wait (async)
|
|
|
|
|
2019-10-28 08:39:26 +01:00
|
|
|
if (acc_is_present (h) .neqv. .FALSE.) stop 5
|
2018-11-30 21:38:57 +01:00
|
|
|
|
|
|
|
end program
|