Cray Fortran Directive Use
Directives are lines into source code that specify actions to be performed by the compiler. They are not Fortran statements.
Directives are lines inserted into source code that specify actions to be performed by the compiler. They are not Fortran statements.
If a directive is specified while running on a system that does not support that particular directive, the compiler generates a message and continues with the compilation.
Directive Lines
A directive line begins with the characters CDIR$ or !DIR$, unless otherwise noted. These leading characters are sometimes referred to as a sentinel.
OpenMP directives are indicated using the !OMP$ sentinel. OpenACC directives are indicated with the !ACC$ sentinel.
- If using fixed source form, indicate a directive line by placing the characters CDIR$ or !DIR$ in columns 1 through 5. If the compiler encounters a nonblank character in column 6, the line is assumed to be a directive continuation line. Columns 7 and beyond can contain one or more directives. Characters in directives entered in columns beyond the default column width are ignored.
- If using free source form, indicate a directive by the characters !DIR$, followed by a space, and then one or more directives. If the position following the !DIR$ contains a character other than a blank, tab, or newline character, the line is assumed to be a continuation line. The !DIR$ need not start in column 1, but it must be the first text on a line.In the following example, an asterisk (*) appears in column 6 to indicate that the second line is a continuation of the preceding line:
!DIR$ NOSIDEEFFECTS !DIR$*abThe FIXED and FREE directives must appear alone on a directive line and cannot be continued.
To specify more than one directive on a line, separate each directive with a comma. Some directives require specification of one or more arguments; when specifying a directive of this type, no other directive can appear on the line.
Spaces can precede, follow, or be embedded within a directive, regardless of source form.
Code portability is maintained despite the use of directives. In the following example, the ! symbol in column 1 causes other compilers to treat the Cray Fortran compiler directive as a comment:A=10. !DIR$ NOVECTOR DO 10,I=1,10...Do not use source preprocessor (#) directives within multiline compiler directives (CDIR$ or !DIR$).