Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

DISTRIBUTE

OpenMP* Fortran Compiler Directive: Specifies that loop iterations will be distributed among the primary threads of all thread teams in a league created by a teams construct.

Syntax

!$OMP DISTRIBUTE [clause[[,] clause]... ]

   do-loop

[!$OMP END DISTRIBUTE]

clause

Is one of the following:

  • ALLOCATE ([allocator :] list)

  • COLLAPSE (n)

  • DIST_SCHEDULE (kind [, chunk-size])

    Specifies how iterations are divided.

    The kind must be STATIC (see SCHEDULE in DO Directive).

    The chunk-size must be a positive scalar integer expression. If specified, iterations are divided into chunks of size chunk-size. Chunks are assigned round-robin to the teams of the parallel region in the order of the team numbers.

    When no chunk-size is specified, iterations are divided into chunks that are approximately equal in size. In this case, at most one chunk is distributed to each team of the parallel region.

  • FIRSTPRIVATE (list)

  • LASTPRIVATE ([CONDITIONAL:] list)

  • PRIVATE (list)

do-loop

Is one or more DO iterations (DO loops). The DO iteration cannot be a DO WHILE or a DO loop without loop control. The DO loop iteration variable must be of type integer.

If an END DO directive follows a DO construct in which several loop statements share a DO termination statement, then the directive can only be specified for the outermost of these DO statements. The DISTRIBUTE construct inherits the restrictions of the loop construct.

The iterations of the DO loop are distributed across the existing team of threads. The values of the loop control parameters of the DO loop associated with a DO directive must be the same for all the threads in the team.

If more than one loop is associated with the DISTRIBUTE construct, then the iterations of all associated loops are collapsed into one larger iteration space. The sequential execution of the iterations in all associated loops determines the order of the iterations in the collapsed iteration space.

You cannot branch out of a DO loop associated with a DISTRIBUTE directive.

The binding thread set for a DISTRIBUTE construct is the set of primary threads created by a TEAMS construct. A DISTRIBUTE region binds to the innermost enclosing team's parallel region. Only the threads that execute the binding team's parallel region participate in the execution of the loop iterations. A DISTRIBUTE construct must be closely nested in a team's region.

If used, the END DISTRIBUTE directive must appear immediately after the end of the loop. If you do not specify an END DISTRIBUTE directive, an END DISTRIBUTE directive is assumed at the end of the do-loop.

The DISTRIBUTE construct is associated with loop iterations that follow the directive. The iterations are distributed across the primary threads of all teams that execute the team's parallel region to which the DISTRIBUTE region binds.

A list item may appear in a FIRSTPRIVATE or LASTPRIVATE clause but not both.