This section describes a set of restrictions on the nesting of regions. The restrictions on nesting are as
follows:
A
loop
region
that
binds
to
a
parallel
region
or
a
worksharing
region
may
not
be
closely
nested
inside
a
worksharing,
loop,
task,
taskloop,
critical,
ordered,
atomic,
or
masked
region.
A
barrier
region
may
not
be
closely
nested
inside
a
worksharing,
loop,
task,
taskloop,
critical,
ordered,
atomic,
or
masked
region.
A
masked
region
may
not
be
closely
nested
inside
a
worksharing,
loop,
atomic,
task,
or
taskloop
region.
An
ordered
region
that
corresponds
to
an
ordered
construct
without
any
clause
or
with
the
threads
or
depend
clause
may
not
be
closely
nested
inside
a
critical,
ordered,
loop,
atomic,
task,
or
taskloop
region.
An
ordered
region
that
corresponds
to
an
ordered
construct
without
the
simd
clause
specified
must
be
closely
nested
inside
a
worksharing-loop
region.
An
ordered
region
that
corresponds
to
an
ordered
construct
with
the
simd
clause
specified
must
be
closely
nested
inside
a
simd
or
worksharing-loop
SIMD
region.
An
ordered
region
that
corresponds
to
an
ordered
construct
with
both
the
simd
and
threads
clauses
must
be
closely
nested
inside
a
worksharing-loop
SIMD
region
or
closely
nested
inside
a
worksharing-loop
and
simd
region.
A
critical
region
may
not
be
nested
(closely
or
otherwise)
inside
a
critical
region
with
the
same
name.
This
restriction
is
not
sufficient
to
prevent
deadlock.
OpenMP
constructs
may
not
be
encountered
during
execution
of
an
atomic
region.
The
only
OpenMP
constructs
that
can
be
encountered
during
execution
of
a
simd
(or
worksharing-loop
SIMD)
region
are
the
atomic
construct,
the
loop
construct
without
a
defined
binding
region,
the
simd
construct
and
the
ordered
construct
with
the
simd
clause.
If
a
targetupdate,
targetdata,
targetenterdata,
or
targetexitdata
construct
is
encountered
during
execution
of
a
target
region,
the
behavior
is
unspecified.
If
a
target
construct
is
encountered
during
execution
of
a
target
region
and
a
device
clause
in
which
the
ancestordevice-modifier
appears
is
not
present
on
the
construct,
the
behavior
is
unspecified.
A
teams
region
must
be
strictly
nested
either
within
the
implicit
parallel
region
that
surrounds
the
whole
OpenMP
program
or
within
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,
loop,
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.
A
loop
region
that
binds
to
a
teams
region
must
be
strictly
nested
inside
a
teams
region.
A
distribute
region
must
be
strictly
nested
inside
a
teams
region.
If
construct-type-clause
is
taskgroup,
the
cancel
construct
must
be
closely
nested
inside
a
task
construct
and
the
cancel
region
must
be
closely
nested
inside
a
taskgroup
region.
If
construct-type-clause
is
sections,
the
cancel
construct
must
be
closely
nested
inside
a
sections
or
section
construct.
Otherwise,
the
cancel
construct
must
be
closely
nested
inside
an
OpenMP
construct
that
matches
the
type
specified
in
construct-type-clause
of
the
cancel
construct.
A
cancellationpoint
construct
for
which
construct-type-clause
is
taskgroup
must
be
closely
nested
inside
a
task
construct,
and
the
cancellationpoint
region
must
be
closely
nested
inside
a
taskgroup
region.
A
cancellationpoint
construct
for
which
construct-type-clause
is
sections
must
be
closely
nested
inside
a
sections
or
section
construct.
Otherwise,
a
cancellationpoint
construct
must
be
closely
nested
inside
an
OpenMP
construct
that
matches
the
type
specified
in
construct-type-clause.
The
only
constructs
that
may
be
encountered
inside
a
region
that
corresponds
to
a
construct
with
an
order
clause
that
specifies
concurrent
are
the
loop
construct,
the
parallel
construct,
the
simd
construct,
and
combined
constructs
for
which
the
first
construct
is
a
parallel
construct.
A
region
that
corresponds
to
a
construct
with
an
order
clause
that
specifies
concurrent
may
not
contain
calls
to
procedures
that
contain
OpenMP
directives
or
calls
to
the
OpenMP
Runtime
API.
A
scope
region
may
not
be
closely
nested
inside
a
worksharing,
loop,
task,
taskloop,
critical,
ordered,
atomic,
or
masked
region.