| 1 |
! { dg-do run } |
| 2 |
! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } |
| 3 |
|
| 4 |
! Fortran version of libgomp.oacc-c-c++-common/lib-95.c |
| 5 |
|
| 6 |
program main |
| 7 |
use iso_c_binding |
| 8 |
use openacc |
| 9 |
implicit none (type, external) |
| 10 |
|
| 11 |
integer(c_size_t), parameter :: N = 127 |
| 12 |
integer(c_size_t) :: i |
| 13 |
integer(acc_handle_kind) :: q = 5 |
| 14 |
integer(kind=1), allocatable :: h(:), g(:) |
| 15 |
type(c_ptr) :: d |
| 16 |
|
| 17 |
q = 5 |
| 18 |
|
| 19 |
allocate (h(-N:N), g(-N:N)) |
| 20 |
do i = -N, N |
| 21 |
g(i) = i |
| 22 |
end do |
| 23 |
|
| 24 |
call acc_create_async (h, 2*N + 1, q) |
| 25 |
|
| 26 |
call acc_memcpy_to_device_async (acc_deviceptr (h), g, 2*N + 1, q) |
| 27 |
|
| 28 |
call acc_wait (q) |
| 29 |
|
| 30 |
h = 0 |
| 31 |
|
| 32 |
call acc_update_self_async (h, 2*N + 1, q + 1) |
| 33 |
call acc_delete_async (h, 2*N + 1, q + 1) |
| 34 |
|
| 35 |
call acc_wait (q + 1) |
| 36 |
|
| 37 |
do i = -N, N |
| 38 |
if (h(i) /= i) & |
| 39 |
stop 1 |
| 40 |
end do |
| 41 |
deallocate (h, g) |
| 42 |
end |