Intel® Fortran Compiler 16.0 User and Reference Guide
General Compiler Directive: Affects data alignment and warnings about data alignment. Also controls whether a target attribute is assigned to a section of program declarations.
!DIR$ OPTIONS option[option]
...
!DIR$ END OPTIONS
option |
Is one (or more) of the following:
|
The OPTIONS (and accompanying END OPTIONS) directives must come after OPTIONS, SUBROUTINE, FUNCTION, and BLOCK DATA statements (if any) in the program unit, and before the executable part of the program unit.
The OPTIONS directive supersedes compiler option align.
For performance reasons, Intel® Fortran aligns local data items on natural boundaries. However, EQUIVALENCE, COMMON, RECORD, and STRUCTURE data declaration statements can force misaligned data. If /WARN=NOALIGNMENT is specified, warnings will not be issued if misaligned data is encountered.
Misaligned data significantly increases the time it takes to execute a program. As the number of misaligned fields encountered increases, so does the time needed to complete program execution. Specifying /ALIGN (or compiler option align) minimizes misaligned data.
If you want aligned data in common blocks, do one of the following:
Specify OPTIONS /ALIGN=COMMONS=STANDARD for data items up to 32 bits in length.
Specify OPTIONS /ALIGN=COMMONS=NATURAL for data items up to 64 bits in length.
Place source data declarations within the common block in descending size order, so that each data item is naturally aligned.
If you want packed, unaligned data in a record structure, do one of the following:
Specify OPTIONS /ALIGN=RECORDS=PACKED.
Place source data declarations in the record structure so that the data is naturally aligned.
! directives can be nested up to 100 levels !DIR$ OPTIONS /ALIGN=PACKED ! Start of Group A declarations !DIR$ OPTIONS /ALIGN=RECO=NATU ! Start of nested Group B more declarations !DIR$ END OPTIONS ! End of Group B still more declarations !DIR$ END OPTIONS ! End of Group A
The OPTIONS specification for Group B only applies to RECORDS; common blocks within Group B will be PACKED. This is because COMMONS retains the previous setting (in this case, from the Group A specification).
In the following example that applies to Intel® MIC Architecture only, the target attribute is passed to function h and real variables a and b.
SUBROUTINE f(x) REAL x INTERFACE SUBROUTINE g(y) REAL y END SUBROUTINE g END INTERFACE !DIR$ OPTIONS /OFFLOAD_ATTRIBUTE_TARGET=mic INTERFACE FUNCTION h (z) REAL z END FUNCTION h END INTERFACE REAL a, b !DIR$ END OPTIONS ... END SUBROUTINE f
The following example demonstrates incorrect usage of the Intel® MIC Architecture directive.
!DIR$ OPTIONS /OFFLOAD_ATTRIBUTE_TARGET=mic SUBROUTINE INVALID() ... END SUBROUTINE INVALID !DIR$ END OPTIONS