workshare2.f90 794 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. subroutine f1
  2. integer a(20:50,70:90)
  3. !$omp parallel workshare
  4. a(:,:) = 17
  5. !$omp end parallel workshare
  6. if (any (a.ne.17)) call abort
  7. end subroutine f1
  8. subroutine f2
  9. integer a(20:50,70:90),d(15),e(15),f(15)
  10. integer b, c, i
  11. !$omp parallel workshare
  12. c = 5
  13. a(:,:) = 17
  14. b = 4
  15. d = (/ 0, 1, 2, 3, 4, 0, 6, 7, 8, 9, 10, 0, 0, 13, 14 /)
  16. forall (i=1:15, d(i) /= 0)
  17. d(i) = 0
  18. end forall
  19. e = (/ 4, 5, 2, 6, 4, 5, 2, 6, 4, 5, 2, 6, 4, 5, 2 /)
  20. f = 7
  21. where (e.ge.5) f = f + 1
  22. !$omp end parallel workshare
  23. if (any (a.ne.17)) call abort
  24. if (c.ne.5.or.b.ne.4) call abort
  25. if (any(d.ne.0)) call abort
  26. do i = 1, 15
  27. if (e(i).ge.5) then
  28. if (f(i).ne.8) call abort
  29. else
  30. if (f(i).ne.7) call abort
  31. end if
  32. end do
  33. end subroutine f2
  34. call f1
  35. call f2
  36. end