Fortran Programming Guide

Interaction Between DOSERIAL* and DOALL

If both DOSERIAL and DOALL are specified, the last one prevails.

Example: Specifying both DOSERIAL and DOALL:


C$PAR DOSERIAL*
      do i = 1, 1000
C$PAR DOALL
        do j = 1, 1000
            ...
        end do
      end do

In the preceding example, the i loop is not parallelized, but the j loop is.

Also, the scope of the DOSERIAL* directive does not extend beyond the textual loop nest immediately following it. The directive is limited to the same function or subroutine that it is in.

Example: DOSERIAL* does not extend to a loop of a called subroutine:


      program caller
      common /block/ a(10,10)
C$PAR DOSERIAL*
      do i = 1, 10
        call callee(i)
      end do
      end

      subroutine callee(k)
      common /block/a(10,10)
      do j = 1, 10
        a(j,k) = j + k
      end do
      return
      end

In the preceding example, DOSERIAL* applies only to the i loop and not to the j loop, regardless of whether the call to the subroutine callee is inlined.