-qalign

Category

Portability and migration

Purpose

Specifies the alignment of data objects in storage, which avoids performance problems with misaligned data.

Format

Read syntax diagramSkip visual syntax diagram
                  .-:----------------------------.   
                  V   .-no4k-.                   |   
>>- -q--align--=----+-+-4k---+-----------------+-+-------------><
                    |           .-power------. |     
                    +-bindc--=--+-bit_packed-+-+     
                    |           +-full-------+ |     
                    |           +-mac68k-----+ |     
                    |           +-natural----+ |     
                    |           +-packed-----+ |     
                    |           '-twobyte----' |     
                    |            .-natural-.   |     
                    '-struct--=--+-packed--+---'     
                                 '-port----'         

@PROCESS:

@PROCESS ALIGN({[NO]4K|STRUCT{(suboption)}|BINDC{(suboption)}})

Defaults

-qalign=no4k:struct=natural:bindc=power.

Parameters

The [no]4k, bindc, and struct options can be specified and are not mutually exclusive. The [no]4k option is useful primarily in combination with logical volume I/O and disk striping.

[no]4k
Specifies whether to align large data objects on page (4 KB) boundaries, for improved performance with data-striped I/O. Objects are affected depending on their representation within the object file. The affected objects are arrays and structures that are 4 KB or larger and are in static or bss storage and also CSECTs (typically COMMON blocks) that are 8 KB or larger. A large COMMON block, equivalence group containing arrays, or structure is aligned on a page boundary, so the alignment of the arrays depends on their position within the containing object. Inside a structure of non-sequence derived type, the compiler adds padding to align large arrays on page boundaries.
bindc={suboption}
Specifies that the alignment and padding for an XL Fortran derived type with the BIND(C) attribute is compatible with a C struct type that is compiled with the corresponding XL C alignment option. The compatible alignment options include:

XL Fortran Option

Corresponding
XL C Option

-qalign=bindc=bit_packed -qalign=bit_packed
-qalign=bindc=full | power -qalign=full | power
-qalign=bindc=mac68k | twobyte -qalign=mac68k | twobyte
-qalign=bindc=natural -qalign=natural
-qalign=bindc=packed -qalign=packed
struct={suboption}
The struct option specifies how objects or arrays of a derived type declared using a record structure are stored, and whether or not padding is used between components. All program units must be compiled with the same settings of the -qalign=struct option. The three suboptions available are:
packed
If the packed suboption of the struct option is specified, objects of a derived type are stored with no padding between components, other than any padding represented by %FILL components. The storage format is the same as would result for a sequence structure whose derived type was declared using a standard derived type declaration.
natural
If the natural suboption of the struct option is specified, objects of a derived type are stored with sufficient padding such that components will be stored on their natural alignment boundaries, unless storage association requires otherwise. The natural alignment boundaries for objects of a type that appears in the left-hand column of the following table is shown in terms of a multiple of some number of bytes in the corresponding entry in the right-hand column of the table.
Type Natural Alignment (in multiples of bytes)
INTEGER(1), LOGICAL(1), BYTE, CHARACTER 1
INTEGER(2), LOGICAL(2) 2
INTEGER(4), LOGICAL(4), REAL(4) 4
INTEGER(8), LOGICAL(8), REAL(8), COMPLEX(4) 8
REAL(16), COMPLEX(8), COMPLEX(16) 16
Derived Maximum alignment of its components

If the natural suboption of the struct option is specified, arrays of derived type are stored so that each component of each element is stored on its natural alignment boundary, unless storage association requires otherwise.

port
If the port suboption of the struct option is specified,
  • Storage padding is the same as described above for the natural suboption, with the exception that the alignment of components of type complex is the same as the alignment of components of type real of the same kind.
  • The padding for an object that is immediately followed by a union is inserted at the beginning of the first map component for each map in that union.

Restrictions

The port suboption does not affect any arrays or structures with the AUTOMATIC attribute or arrays that are allocated dynamically. Because this option may change the layout of non-sequence derived types, when compiling programs that read or write such objects with unformatted files, use the same setting for this option for all source files.

You must use -qalign=4k if you are using the I/O techniques that are described in Increasing throughput with logical volume I/O and data striping .

You can tell if an array has the AUTOMATIC attribute and is thus unaffected by -qalign=4k if you look for the keywords AUTOMATIC or CONTROLLED  AUTOMATIC in the listing of -qattr. This listing also shows the offsets of data objects.