Intel® Fortran Compiler 16.0 User and Reference Guide
The ATTRIBUTES directive option ALIGN specifies the byte alignment for variables and for allocatable or pointer components of derived types.
!DIR$ ATTRIBUTES ALIGN: n:: object
n |
Is the number of bytes for the minimum alignment boundary. For allocatable objects, the boundary value must be a power of 2 between 1 and 16384, such as 1, 2, 4, 8, 16, 32, 64, 128, and so on. For non-allocatable objects, the boundary value must be a power of 2 between 1 and 64 on Windows* systems, between 1 and 2**16 on Linux* systems, or between 1 and 2**12 on OS X* systems. |
object |
Is the variable or the allocatable or pointer component of a derived type to be aligned. |
Objects that can be aligned by this directive include static local variables, automatic variables, module variables, dynamically allocated arrays, allocatable array components of derived types, and the start of common blocks. This directive cannot be used to align variables within common blocks
If you specify directive !DIR$ ATTRIBUTES ALIGN on an object with the ALLOCATABLE or POINTER attribute, an ALLOCATE statement will attempt to use that alignment when the memory is allocated.
For allocatable or pointer components of derived types, the directive must appear within the derived-type TYPE…END TYPE block.
If the TYPE is an extended type, the directive cannot reference a component in the parent type.
Consider the following:
TYPE EXAMPLE !DIR$ ATTRIBUTES ALIGN : 64 :: R_alloc REAL, ALLOCATABLE :: R_alloc ( : ) REAL :: R_scalar INTEGER :: I_nonalloc(25) END TYPE EXAMPLE TYPE (EXAMPLE) :: MyVar ALLOCATE (MyVar%R_alloc(1000)) ! Memory is allocated aligned at a 64-byte boundary
Note that it is valid to give the ALIGN:64 attribute to component R_alloc, but not to component R_scalar or to component I_nonalloc.
The following example shows that the name of a common block may optionally be enclosed in slashes:
!DIR$ ATTRIBUTES ALIGN: n :: /common_name/