Intel® Fortran Compiler 16.0 User and Reference Guide
OpenMP* Fortran Compiler Directive: Creates a league of thread teams 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:
|
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:
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 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.