2015-08-28 15:33:40 +00:00
|
|
|
! { dg-do run }
|
|
|
|
|
2017-04-10 11:32:00 +00:00
|
|
|
program asyncwait
|
2015-08-28 15:33:40 +00:00
|
|
|
integer, parameter :: N = 64
|
|
|
|
real, allocatable :: a(:), b(:), c(:)
|
|
|
|
integer i
|
|
|
|
|
|
|
|
allocate (a(N))
|
|
|
|
allocate (b(N))
|
|
|
|
allocate (c(N))
|
|
|
|
|
|
|
|
!$acc parallel async (0)
|
|
|
|
!$acc loop
|
|
|
|
do i = 1, N
|
|
|
|
a(i) = 1
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
!$acc parallel async (1)
|
|
|
|
!$acc loop
|
|
|
|
do i = 1, N
|
|
|
|
b(i) = 1
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
!$acc wait (0, 1)
|
|
|
|
|
|
|
|
!$acc parallel
|
|
|
|
!$acc loop
|
|
|
|
do i = 1, N
|
|
|
|
c(i) = a(i) + b(i)
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
2017-04-10 11:32:00 +00:00
|
|
|
do i = 1, N
|
|
|
|
if (c(i) .ne. 2.0) call abort
|
|
|
|
end do
|
|
|
|
|
|
|
|
!$acc kernels async (0)
|
|
|
|
!$acc loop
|
|
|
|
do i = 1, N
|
|
|
|
a(i) = 1
|
|
|
|
end do
|
|
|
|
!$acc end kernels
|
|
|
|
|
|
|
|
!$acc kernels async (1)
|
|
|
|
!$acc loop
|
|
|
|
do i = 1, N
|
|
|
|
b(i) = 1
|
|
|
|
end do
|
|
|
|
!$acc end kernels
|
|
|
|
|
|
|
|
!$acc wait (0, 1)
|
|
|
|
|
|
|
|
!$acc kernels
|
|
|
|
!$acc loop
|
|
|
|
do i = 1, N
|
|
|
|
c(i) = a(i) + b(i)
|
|
|
|
end do
|
|
|
|
!$acc end kernels
|
|
|
|
|
2015-08-28 15:33:40 +00:00
|
|
|
do i = 1, N
|
|
|
|
if (c(i) .ne. 2.0) call abort
|
|
|
|
end do
|
|
|
|
|
|
|
|
deallocate (a)
|
|
|
|
deallocate (b)
|
|
|
|
deallocate (c)
|
2017-04-10 11:32:00 +00:00
|
|
|
end program asyncwait
|