asyncwait-2.f90 621 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ! { dg-do run }
  2. program parallel_wait
  3. integer, parameter :: N = 64
  4. real, allocatable :: a(:), b(:), c(:)
  5. integer i
  6. allocate (a(N))
  7. allocate (b(N))
  8. allocate (c(N))
  9. !$acc parallel async (0)
  10. !$acc loop
  11. do i = 1, N
  12. a(i) = 1
  13. end do
  14. !$acc end parallel
  15. !$acc parallel async (1)
  16. !$acc loop
  17. do i = 1, N
  18. b(i) = 1
  19. end do
  20. !$acc end parallel
  21. !$acc parallel wait (0, 1)
  22. !$acc loop
  23. do i = 1, N
  24. c(i) = a(i) + b(i)
  25. end do
  26. !$acc end parallel
  27. do i = 1, N
  28. if (c(i) .ne. 2.0) call abort
  29. end do
  30. deallocate (a)
  31. deallocate (b)
  32. deallocate (c)
  33. end program parallel_wait