XL Fortran for AIX 8.1

Language Reference

DO SERIAL

Purpose

The DO SERIAL directive indicates to the compiler that the DO loop that is immediately following the directive must not be parallelized. This directive is useful in blocking automatic parallelization for a particular DO loop. The DO SERIAL directive only takes effect if you specify the -qsmp compiler option.

Format



>>-DO SERIAL---------------------------------------------------><
 
 

Rules

The first noncomment line (not including other directives) that is following the DO SERIAL directive must be a DO loop. The DO SERIAL directive applies only to the DO loop that immediately follows the directive and not to any loops that are nested within that loop.

You can only specify one DO SERIAL directive for a given DO loop. The DO SERIAL directive must not appear with the DO, or PARALLEL DO directive on the same DO loop.

White space is optional between DO and SERIAL.

You should not use the OpenMP trigger constant with this directive.

Examples

Example 1: An example with nested DO loops where the inner loop (the J loop) is not parallelized.

!$OMP PARALLEL DO PRIVATE(S,I), SHARED(A)
      DO I=1, 500
        S=0
        !SMP$ DOSERIAL
        DO J=1, 500
          S=S+1
        ENDDO
          A(I)=S+I
      ENDDO
 

Example 2: An example with the DOSERIAL directive applied in nested loops. In this case, if automatic parallelization is enabled the I or K loop may be parallelized.

      DO I=1, 100
!SMP$ DOSERIAL
        DO J=1, 100
          DO K=1, 100
            ARR(I,J,K)=I+J+K
          ENDDO
        ENDDO
      ENDDO

Related Information


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]