BindingThe binding thread set for a teams region is the encountering thread.
DescriptionWhen a thread encounters a teams construct, a league of teams is created. Each team is an
initial team, and the initial thread in each team executes the teams region.
The number of teams created is implementation defined, but is less than or equal to the value specified in the
num_teams clause. A thread may obtain the number of initial teams created by the construct by a call to
the omp_get_num_teams routine.
The maximum number of threads participating in the contention group that each team initiates is
implementation defined, but is less than or equal to the value specified in the thread_limit
clause.
On a combined or composite construct that includes target and teams constructs, the expressions in
num_teams and thread_limit clauses are evaluated on the host device on entry to the target
construct.
Once the teams are created, the number of initial teams remains constant for the duration of the teams
region.
Within a teams region, initial team numbers uniquely identify each initial team. Initial team numbers are
consecutive whole numbers ranging from zero to one less than the number of initial teams. A thread may
obtain its own initial team number by a call to the omp_get_team_num library routine. The policy for
assigning the initial threads to places is implementation defined. The teams construct sets the
place-partition-var and default-device-var ICVs for each initial thread to an implementation-defined
value.
After the teams have completed execution of the teams region, the encountering task resumes execution of
the enclosing task region.
Execution Model Events
The teams-begin event occurs in a thread that encounters a teams construct before any initial task is
created for the corresponding teams region.
Upon creation of each initial task, an initial-task-begin event occurs in the thread that executes the initial
task after the initial task is fully initialized but before the thread begins to execute the structured block of the
teams construct.
If the teams region creates a native thread, a native-thread-begin event occurs as the first event in the
context of the new thread prior to the initial-task-begin event.
When a thread finishes an initial task, an initial-task-end event occurs in the thread.
The teams-end event occurs in the thread that encounters the teams construct after the thread executes its
initial-task-end event but before it resumes execution of the encountering task.
If a native thread is destroyed at the end of a teams region, a native-thread-end event occurs in the thread
as the last event prior to destruction of the thread.
Tool Callbacks
A thread dispatches a registered ompt_callback_parallel_begin callback for each occurrence of a
teams-begin event in that thread. The callback occurs in the task that encounters the teams construct. This
callback has the type signature ompt_callback_parallel_begin_t. In the dispatched callback,
(flags&ompt_parallel_league) evaluates to true.
A thread dispatches a registered ompt_callback_implicit_task callback with ompt_scope_begin
as its endpoint argument for each occurrence of an initial-task-begin in that thread. Similarly, a thread
dispatches a registered ompt_callback_implicit_task callback with ompt_scope_end as its
endpoint argument for each occurrence of an initial-task-end event in that thread. The callbacks occur in the
context of the initial task and have type signature ompt_callback_implicit_task_t. In the
dispatched callback, (flags&ompt_task_initial) evaluates to true.
A thread dispatches a registered ompt_callback_parallel_end callback for each occurrence of a
teams-end event in that thread. The callback occurs in the task that encounters the teams construct. This
callback has the type signature ompt_callback_parallel_end_t.
A thread dispatches a registered ompt_callback_thread_begin callback for the native-thread-begin
event in that thread. The callback occurs in the context of the thread. The callback has type signature
ompt_callback_thread_begin_t.
A thread dispatches a registered ompt_callback_thread_end callback for the native-thread-end
event in that thread. The callback occurs in the context of the thread. The callback has type signature
ompt_callback_thread_end_t.
RestrictionsRestrictions to the teams construct are as follows:
A
program
that
branches
into
or
out
of
a
teams
region
is
non-conforming.
A
program
must
not
depend
on
any
ordering
of
the
evaluations
of
the
clauses
of
the
teams
directive,
or
on
any
side
effects
of
the
evaluation
of
the
clauses.
At
most
one
thread_limit
clause
can
appear
on
the
directive.
The
thread_limit
expression
must
evaluate
to
a
positive
integer
value.
At
most
one
num_teams
clause
can
appear
on
the
directive.
The
num_teams
expression
must
evaluate
to
a
positive
integer
value.
A
teams
region
can
only
be
strictly
nested
within
the
implicit
parallel
region
or
a
target
region.
If
a
teams
construct
is
nested
within
a
target
construct,
that
target
construct
must
contain
no
statements,
declarations
or
directives
outside
of
the
teams
construct.
distribute,
distribute
simd,
distribute
parallel
worksharing-loop,
distribute
parallel
worksharing-loop
SIMD,
parallel
regions,
including
any
parallel
regions
arising
from
combined
constructs,
omp_get_num_teams()
regions,
and
omp_get_team_num()
regions
are
the
only
OpenMP
regions
that
may
be
strictly
nested
inside
the
teams
region.