/ OpenMP Directives: Fortran Directive Format
OpenMP Directives: Fortran Directive Format
Format: (case insensitive)
All Fortran OpenMP directives must begin with a sentinel. The accepted sentinels depend upon the type of Fortran source. Possible sentinels are: !$OMP C$OMP *$OMP
A valid OpenMP directive must appear after the sentinel and before any clauses.
Optional. Clauses can be in any order, and repeated as necessary unless otherwise restricted.
!$OMP PARALLEL DEFAULT(SHARED) PRIVATE(BETA,PI)
Fixed Form Source:
!$OMPC$OMP*$OMP are accepted sentinels and must start in column 1.
All Fortran fixed form rules for line length, white space, continuation and comment columns apply for the entire directive line.
Initial directive lines must have a space/zero in column 6.
Continuation lines must have a non-space/zero in column 6.
Free Form Source:
!$OMP is the only accepted sentinel. Can appear in any column, but must be preceded by white space only.
All Fortran free form rules for line length, white space, continuation and comment columns apply for the entire directive line.
Initial directive lines must have a space after the sentinel.
Continuation lines must have an ampersand as the last non-blank character in a line. The following line must begin with a sentinel and then the continuation directives.
Comments can not appear on the same line as a directive.
Only one directive-name may be specified per directive.
Fortran compilers which are OpenMP enabled generally include a command line option which instructs the compiler to activate and interpret all OpenMP directives.
Several Fortran OpenMP directives come in pairs and have the form shown below. The “end” directive is optional but advised for readability.
!$OMP <directive >
[ structured block of code ]
!$OMP end <directive >
Lawrence Livermore National Laboratory
7000 East Avenue • Livermore, CA 94550 | LLNL-WEB-458451
Operated by the Lawrence Livermore National Security, LLC for the
Department of Energy's National Nuclear Security Administration
Learn about the Department of Energy's Vulnerability Disclosure Program