Nesting and Binding Rules

This section describes the dynamic nesting and binding rules for OpenMP* Fortran API directives.

Binding Rules

The following rules apply to dynamic binding:

Nesting Rules

The following rules apply to dynamic nesting:

Examples

The following example shows nested PARALLEL regions:

c$OMP PARALLEL DEFAULT(SHARED)

c$OMP DO

DO I =1, N

c$OMP PARALLEL SHARED(I,N)

c$OMP DO

DO J =1, N

CALL WORK(I,J)

END DO

c$OMP END PARALLEL

END DO

c$OMP END PARALLEL

Note that the inner and outer DO directives bind to different PARALLEL regions.

The following example shows a variation of the preceding example:

c$OMP PARALLEL DEFAULT(SHARED)

c$OMP DO

DO I =1, N

CALL SOME_WORK(I,N)

END DO

c$OMP END PARALLEL

...

SUBROUTINE SOME_WORK(I,N)

c$OMP PARALLEL DEFAULT(SHARED)

c$OMP DO

DO J =1, N

CALL WORK(I,J)

END DO

c$OMP END PARALLEL

RETURN

END