Node: Aligned Data, Next: , Up: Faster Programs

Aligned Data

On some systems, such as those with Pentium Pro CPUs, programs that make heavy use of REAL(KIND=2) (DOUBLE PRECISION) might run much slower than possible due to the compiler not aligning these 64-bit values to 64-bit boundaries in memory. (The effect also is present, though to a lesser extent, on the 586 (Pentium) architecture.)

The Intel x86 architecture generally ensures that these programs will work on all its implementations, but particular implementations (such as Pentium Pro) perform better with more strict alignment. (Such behavior isn't unique to the Intel x86 architecture.) Other architectures might demand 64-bit alignment of 64-bit data.

There are a variety of approaches to use to address this problem:

Progress is being made on making this work "out of the box" on future versions of g77, gcc, and some of the relevant operating systems (such as GNU/Linux).

A package that tests the degree to which a Fortran compiler (such as g77) aligns 64-bit floating-point variables and arrays is available at