mirror of
https://github.com/autc04/Retro68.git
synced 2024-12-04 16:50:57 +00:00
37 lines
717 B
Fortran
37 lines
717 B
Fortran
! { dg-do run }
|
|
|
|
program main
|
|
implicit none
|
|
integer, parameter :: n = 1024
|
|
integer, dimension (0:n-1) :: a, b, c
|
|
integer :: i, ii
|
|
|
|
!$acc enter data create (a(0:n-1), b(0:n-1), c(0:n-1))
|
|
|
|
!$acc kernels present (a(0:n-1))
|
|
do i = 0, n - 1
|
|
a(i) = i * 2
|
|
end do
|
|
!$acc end kernels
|
|
|
|
!$acc parallel present (b(0:n-1))
|
|
!$acc loop
|
|
do i = 0, n -1
|
|
b(i) = i * 4
|
|
end do
|
|
!$acc end parallel
|
|
|
|
!$acc kernels present (a(0:n-1), b(0:n-1), c(0:n-1))
|
|
do ii = 0, n - 1
|
|
c(ii) = a(ii) + b(ii)
|
|
end do
|
|
!$acc end kernels
|
|
|
|
!$acc exit data copyout (a(0:n-1), b(0:n-1), c(0:n-1))
|
|
|
|
do i = 0, n - 1
|
|
if (c(i) .ne. a(i) + b(i)) call abort
|
|
end do
|
|
|
|
end program main
|