### 15.2.4.10 PDO Directive (TU*X only)

The PDO directive specifies that the iterations of the immediately following DO loop must be executed in parallel. It takes the following form:

  c$PAR PDO [option[[,] option] ... ]
  do_loop
  [c$PAR END PDO [NOWAIT]]
  c
  Is one of the following: C (or c), !, or * (see Section 15.2.1).
  option
  Is one of the following:
  - CHUNK (chunksize)

    Adjusts the number of consecutive iterations assigned to a thread. At the end of the PDO construct, chunksize reverts to the default. The effect of CHUNK varies, depending on the scheduling type.

    A chunksize specified in a PDO directive supersedes any chunksize set with a CHUNK directive earlier in the program, and applies only for the duration of the PDO construct.

    For details on default chunksize and on the effect of specifying chunksizes for the same program in more than one context, see Section 15.2.4.2.

    BLOCKED is allowed as an alternative spelling for CHUNK.

  - FIRSTPRIVATE (list)

    See Section 15.2.2.3.

  - LASTLOCAL (var[[,] var] ...)

    The LASTLOCAL keyword is the same as the LASTPRIVATE clause described in Section 15.2.2.4.

    LAST LOCAL is allowed as an alternative spelling for LASTLOCAL, even in free form source code.

  - [MP_SCHEDTYPE=] mode

    Controls the scheduling type and allocation of work for the PDO construct.

    There are several ways to specify a scheduling type. The scheduling type defaults to STATIC when no other information is available. For a description of mode and scheduling types, see Section 15.2.4.6.

    At the end of the PDO construct, the scheduling type reverts to the default. The scheduling type does not affect the correctness of the program, but may affect performance.

  - (ORDERED)

    Specifies that iterations are assigned to threads in the same order in which iterations would be generated by a normal Compaq Fortran DO statement.

  - PRIVATE (list)

    See Section 15.2.2.5.

    LOCAL is allowed as an alternative spelling for PRIVATE.

  - REDUCTION (var[[,] var] ...)

    The REDUCTION keyword used here is different from the REDUCTION clause described in Section 15.2.2.6, where both a variable and an operator type need to be specified.

    In this version of the keyword, the operator is not given in the PDO directive. The compiler must be able to determine the reduction operation from the source code.

    The REDUCTION keyword can be applied to a variable in a DO loop only if the variable meets the following criteria:

    - It must be scalar.
    - It must be assigned to exactly once in the DO loop.
    - It must be read from exactly once in the DO loop and only in the right side of the assignment.
    - The assignment must be one of the following forms:

            x = x operator expr

            x = expr operator x (except for subtraction)

            x  = operator(x, expr)

            x = operator(expr, x)

      where operator is one of the following supported reduction operations: +, -, *, .AND., .OR., .EQV., .NEQV., MAX, MIN, IAND, or IOR.

    The compiler rewrites the reduction operation by computing partial results into local variables and then combining the results into the reduction variable. The reduction variable must be SHARED in the enclosing context.

  do_loop
  Is a Compaq Fortran DO construct with loop control. It cannot be a DO WHILE or a DO loop without loop control. The DO loop iteration variable must be of type integer.

  The iterations of the DO loop are distributed across the already existing threads.

Rules and Behavior

Specifying NOWAIT is the same as specifying NOWAIT in an OpenMP Fortran API DO directive (see Section 15.2.3.5).

PDO directives are permitted only within the lexical extent of the PARALLEL and END PARALLEL directives.

For more information about rules and restrictions, see your user manual.

Previous Page Next Page Table of Contents