OpenMP* Fortran Compiler Directive: Specifies one or more blocks of code that must be divided among threads in the team. Each section is executed once by a thread in the team.
c$OMP SECTIONS [clause[[,] clause] ... ]
[c$OMP SECTION]
block
[c$OMP SECTION
block]...
c$OMP END SECTIONS[NOWAIT]
c |
Is one of the following: C (or c), !, or * (see Syntax Rules for Compiler Directives). |
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. |
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.
In the following example, subroutines XAXIS, YAXIS, and ZAXIS can be executed concurrently:
c$OMP PARALLEL
c$OMP SECTIONS
c$OMP SECTION
CALL XAXIS
c$OMP SECTION
CALL YAXIS
c$OMP SECTION
CALL ZAXIS
c$OMP END SECTIONS
c$OMP END PARALLEL