gcc/libgomp/testsuite/libgomp.oacc-fortran/lib-16-2.f90
Thomas Schwinge 599e275d7e Fix OpenACC 'async'/'wait' issues in 'libgomp.oacc-c-c++-common/lib-{94,95}.c', 'libgomp.oacc-fortran/lib-16{,-2}.f90'
Fix-up for r265842 (commit 58168bbf6f)
"[OpenACC 2.5, libgomp] Add *_async versions of runtime library API functions".

	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/lib-94.c: Fix OpenACC
	'async'/'wait' issue.
	* testsuite/libgomp.oacc-c-c++-common/lib-95.c: Likewise.
	* testsuite/libgomp.oacc-fortran/lib-16-2.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/lib-16.f90: Likewise.

Co-Authored-By: Julian Brown <julian@codesourcery.com>
2021-07-27 11:16:24 +02:00

63 lines
1008 B
Fortran

! 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)
if (acc_is_present (h) .neqv. .TRUE.) stop 1
call acc_wait (async)
h(:) = 0
call acc_copyout_async (h, sizeof (h), async)
call acc_wait (async)
do i = 1, N
if (h(i) /= i + i) stop 2
end do
call acc_copyin (h, sizeof (h))
h(:) = 0
call acc_update_self_async (h, sizeof (h), async)
if (acc_is_present (h) .neqv. .TRUE.) stop 3
call acc_wait (async)
do i = 1, N
if (h(i) /= i + i) stop 4
end do
call acc_delete_async (h, async)
call acc_wait (async)
if (acc_is_present (h) .neqv. .FALSE.) stop 5
end program