data-1.f90 720 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ! { dg-do run }
  2. program test
  3. integer, parameter :: N = 8
  4. real, allocatable :: a(:), b(:)
  5. allocate (a(N))
  6. allocate (b(N))
  7. a(:) = 3.0
  8. b(:) = 0.0
  9. !$acc enter data copyin (a(1:N), b(1:N))
  10. !$acc parallel
  11. do i = 1, n
  12. b(i) = a (i)
  13. end do
  14. !$acc end parallel
  15. !$acc exit data copyout (a(1:N), b(1:N))
  16. do i = 1, n
  17. if (a(i) .ne. 3.0) call abort
  18. if (b(i) .ne. 3.0) call abort
  19. end do
  20. a(:) = 5.0
  21. b(:) = 1.0
  22. !$acc enter data copyin (a(1:N), b(1:N))
  23. !$acc parallel
  24. do i = 1, n
  25. b(i) = a (i)
  26. end do
  27. !$acc end parallel
  28. !$acc exit data copyout (a(1:N), b(1:N))
  29. do i = 1, n
  30. if (a(i) .ne. 5.0) call abort
  31. if (b(i) .ne. 5.0) call abort
  32. end do
  33. end program test