インテル® Fortran コンパイラー 19.0 デベロッパー・ガイドおよびリファレンス

TEAMS

OpenMP* Fortran Compiler Directive: Creates a league of thread teams inside a target region to execute a structured block in the master thread of each team.

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

   block

!$OMP END TEAMS

clause

Is one of the following:

  • DEFAULT (PRIVATE | FIRSTPRIVATE | SHARED | NONE)

  • FIRSTPRIVATE (list)

  • NUM_TEAMS (scalar-integer-expression)

    Specifies the number of teams to be used in a parallel region. The scalar-integer-expression must evaluate to a positive scalar integer value.

    Only a single NUM_TEAMS clause can appear in the directive.

  • PRIVATE (list)

  • REDUCTION (reduction-identifier : list)

  • SHARED (list)

  • THREAD_LIMIT (scalar-integer-expression)

    Specifies the maximum number of threads participating in the contention group that each team initiates. The scalar-integer-expression must evaluate to a positive scalar integer value.

    At most one THREAD_LIMIT clause can appear in the directive.

block

Is a structured block (section) of statements or constructs. No branching into or out of the block of code is allowed.

The binding thread set for a TEAMS construct is the encountering thread.

The TEAMS construct must appear within a TARGET construct. The enclosing TARGET construct must contain no other statements or directives outside of the TEAMS construct. The following are the only OpenMP* constructs that can be nested in the team's region:

The thread that encounters this directive constructs a league of thread teams that execute the block in the master thread of each team. After the teams are created, the number of teams remains constant for the duration of the team's parallel region.

The region following the TEAMS construct is executed by the master thread of each team. Other threads do not begin execution until the master thread encounters a parallel region. After the teams complete execution of the TEAMS construct region, the encountering thread resumes execution of the enclosing target region.

If NUM_TEAMS is not specified, the default number of teams is one. If THREAD_LIMIT is not specified, the default number of threads is the-number-of-available-hardware-threads / NUM_TEAMS.

A program must not depend on any side effects or any ordering of the evaluation of clauses in the TEAMS directive.

Each team has a unique team number. You can use the OpenMP* run-time library routine OMP_GET_TEAM_NUM to get the team number of the calling thread.

Each thread within the team has a unique thread identifier returned by the OpenMP run-time library routine OMP_GET_THREAD_NUM. As in any thread team, the thread identifier starts at zero for the master thread up to THREAD_LIMIT - 1 for the remaining threads.

Immediately after this directive, only the master threads in each team are executing, the other team members will only start to execute at the next (nested) parallel region. Therefore, there are only NUM_TEAMS threads executing, and each of them has OMP_GET_THREAD_NUM() == 0.

See Also