# SECTIONS

OpenMP* Fortran Compiler Directive: Specifies that the enclosed SECTION directives define blocks of code to be divided among threads in a team. Each section is executed once by a thread in the team.

## Syntax

!$OMP SECTIONS [clause[[,] clause] ... ]

[!$OMP SECTION]

block

[!$OMP SECTION

block]...

!$OMP END SECTIONS[NOWAIT]

clause | Is one of the following: ALLOCATE ([allocator :] list) FIRSTPRIVATE (list) LASTPRIVATE ([CONDITIONAL:] list) PRIVATE (list) REDUCTION (reduction-identifier : list)
block | Is a structured block (section) of statements or constructs. Any constituent section must also be a structured block. You cannot branch into or out of the block.

The binding thread set for a SECTIONS construct is the current team. A SECTIONS region binds to the innermost enclosing parallel region.

Each section of code is preceded by a SECTION directive, although the directive is optional for the first section. The SECTION directives must appear within the lexical extent of the SECTIONS and END SECTIONS directive pair.

The last section ends at the END SECTIONS directive. Threads that complete execution of their SECTIONs encounter an implied barrier at the END SECTIONS directive unless NOWAIT is specified.

SECTIONS directives must be encountered by all threads in a team or by none at all.

## Example

In the following example, subroutines XAXIS, YAXIS, and ZAXIS can be executed concurrently:

      !$OMP PARALLEL
      !$OMP SECTIONS
      !$OMP SECTION
            CALL XAXIS
      !$OMP SECTION
            CALL YAXIS
      !$OMP SECTION
            CALL ZAXIS
      !$OMP END SECTIONS
      !$OMP END PARALLEL

Parent topic: S

## See Also

OpenMP Fortran Compiler Directives
Syntax Rules for Compiler Directives
Parallel Processing Model for information about Binding Sets