OpenMP Directives: Fortran Directive Format
Format: (case insensitive)
| sentinel | directive-name | [clause ...] |
|---|---|---|
| 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. |
Example:
!$OMP PARALLEL DEFAULT(SHARED) PRIVATE(BETA,PI)
Fixed Form Source:
-
!$OMPC$OMP*$OMPare 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:
-
!$OMPis 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.
General Rules:
-
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 >




