Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

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:

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