reduction-6.f90 493 B

12345678910111213141516171819202122232425262728293031
  1. ! { dg-do run }
  2. program reduction
  3. implicit none
  4. integer, parameter :: n = 100
  5. integer :: i, s1, s2, vs1, vs2
  6. s1 = 0
  7. s2 = 0
  8. vs1 = 0
  9. vs2 = 0
  10. !$acc parallel vector_length (1000)
  11. !$acc loop reduction(+:s1, s2)
  12. do i = 1, n
  13. s1 = s1 + 1
  14. s2 = s2 + 2
  15. end do
  16. !$acc end parallel
  17. ! Verify the results
  18. do i = 1, n
  19. vs1 = vs1 + 1
  20. vs2 = vs2 + 2
  21. end do
  22. if (s1.ne.vs1) call abort ()
  23. if (s2.ne.vs2) call abort ()
  24. end program reduction