Visible to Intel only — GUID: GUID-72534196-E7EC-4EAB-86D4-9A05A9D12A10
Visible to Intel only — GUID: GUID-72534196-E7EC-4EAB-86D4-9A05A9D12A10
TEAMS
OpenMP* Fortran Compiler Directive: Creates a league of thread teams to execute a structured block in the primary thread of each team.
Syntax
!$OMP TEAMS [clause[[,] clause]... ]
loosely-structured-block
!$OMP END TEAMS
-or-
!$OMP TEAMS [clause[[,] clause]... ]
strictly-structured-block
[!$OMP END TEAMS]
clause |
Is one of the following:
|
loosely-structured-block |
Is a structured block (section) of statements or constructs. You cannot branch into or out of the block. |
strictly-structured-block |
Is a Fortran BLOCK construct. You cannot branch into or out of the BLOCK construct. |
The binding thread set for a TEAMS construct is the encountering thread.
If a TEAMS construct appears 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:
DISTRIBUTE
PARALLEL
PARALLEL SECTIONS
PARALLEL WORKSHARE
PARALLEL DO
PARALLEL DO SIMD
The thread that encounters this directive constructs a league of thread teams that execute the block in the primary 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 primary thread of each team. Other threads do not begin execution until the primary 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.
The IF and NUM_TEAM clauses determine how many teams are created. If the IF clause is present and evaluates to .TRUE., the number of teams created is specified by the NUM_TEAMS clause. If the IF clause is present and evaluates to .FALSE., only one team is created. 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 variable used in the scalar-logical-expression of an IF clause results in an implicit reference to the variable in all enclosing constructs. The scalar-logical-expression is evaluated in the context outside of the TEAMS construct.
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* runtime 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 runtime library routine OMP_GET_THREAD_NUM. As in any thread team, the thread identifier starts at zero for the primary thread up to THREAD_LIMIT - 1 for the remaining threads.
Immediately after this directive, only the primary 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.
A variable with LOCAL_INIT or SHARED locality in a DO CONCURRENT statement associated with a LOOP directive that binds to the teams region of this construct cannot appear in a PRIVATE or FIRST_PRIVATE clause in the TEAMS directive.