2015-08-28 15:33:40 +00:00
|
|
|
! { dg-do run }
|
|
|
|
|
|
|
|
program test
|
2019-06-02 15:48:37 +00:00
|
|
|
use openacc
|
2015-08-28 15:33:40 +00:00
|
|
|
integer, parameter :: N = 8
|
|
|
|
real, allocatable :: a(:,:), b(:,:)
|
2019-06-02 15:48:37 +00:00
|
|
|
real, allocatable :: c(:), d(:)
|
|
|
|
integer i, j
|
|
|
|
|
|
|
|
i = 0
|
|
|
|
j = 0
|
2015-08-28 15:33:40 +00:00
|
|
|
|
|
|
|
allocate (a(N,N))
|
|
|
|
allocate (b(N,N))
|
|
|
|
|
|
|
|
a(:,:) = 3.0
|
|
|
|
b(:,:) = 0.0
|
|
|
|
|
|
|
|
!$acc enter data copyin (a(1:N,1:N), b(1:N,1:N))
|
|
|
|
|
|
|
|
!$acc parallel
|
|
|
|
do i = 1, n
|
|
|
|
do j = 1, n
|
|
|
|
b(j,i) = a (j,i)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
!$acc exit data copyout (a(1:N,1:N), b(1:N,1:N))
|
|
|
|
|
|
|
|
do i = 1, n
|
|
|
|
do j = 1, n
|
2018-12-28 15:30:48 +00:00
|
|
|
if (a(j,i) .ne. 3.0) STOP 1
|
|
|
|
if (b(j,i) .ne. 3.0) STOP 2
|
2015-08-28 15:33:40 +00:00
|
|
|
end do
|
|
|
|
end do
|
2019-06-02 15:48:37 +00:00
|
|
|
|
|
|
|
allocate (c(N))
|
|
|
|
allocate (d(N))
|
|
|
|
|
|
|
|
c(:) = 3.0
|
|
|
|
d(:) = 0.0
|
|
|
|
|
|
|
|
!$acc enter data copyin (c(1:N)) create (d(1:N)) async
|
|
|
|
!$acc wait
|
|
|
|
|
|
|
|
!$acc parallel
|
|
|
|
do i = 1, N
|
|
|
|
d(i) = c(i) + 1
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
!$acc exit data copyout (c(1:N), d(1:N)) async
|
|
|
|
!$acc wait
|
|
|
|
|
|
|
|
do i = 1, N
|
|
|
|
if (d(i) .ne. 4.0) call abort
|
|
|
|
end do
|
|
|
|
|
|
|
|
c(:) = 3.0
|
|
|
|
d(:) = 0.0
|
|
|
|
|
|
|
|
!$acc enter data copyin (c(1:N)) async
|
|
|
|
!$acc enter data create (d(1:N)) wait
|
|
|
|
!$acc wait
|
|
|
|
|
|
|
|
!$acc parallel
|
|
|
|
do i = 1, N
|
|
|
|
d(i) = c(i) + 1
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
!$acc exit data copyout (d(1:N)) async
|
|
|
|
!$acc exit data async
|
|
|
|
!$acc wait
|
|
|
|
|
|
|
|
do i = 1, N
|
|
|
|
if (d(i) .ne. 4.0) call abort
|
|
|
|
end do
|
|
|
|
|
2015-08-28 15:33:40 +00:00
|
|
|
end program test
|