Alignment to 16 byte boundary for reproducable numerics: a question

Alignment to 16 byte boundary for reproducable numerics: a question

I just wanted to confirm that if data is not aligned to 16 byte boundaries, then on win64 and linux64, the numerics are still identical? i..e it is only 32bit platforms that are affected?

I release that I need to have 16byte boundary alignment to get the best performance; its just that aligning all our f95 dynamically allocated arrays everywhere is going to be a big job because we have to change every allocate call (unless there is some trick you play with Fortran to ensure the alignment?).

Thank you!

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

The basic question of possible numerical dependence on alignment doesn't go away entirely on 64-bit OS. The only advantage is that some of the possible ways for losing 16-byte alignment are eliminated. A Fortran ALLOCATE should automatically give you 16-byte alignment, I think even on 32-bit platform.

A Fortran allocate does not always align to 16bytes - on win32 or win64 - using the Fortran allocate statement, though an alternative using a pointerand calling mkl_allocis provided in the MKL documentation.

Though I am somewhat concerned that even with alignment, the results from one call to the next could be different, even if the same number of cores are used? From a numerical analysis viewpoint, this is horrible; Even if the differences are within some error bound, since it takes away reproducability. Is my understanding correct?


The MKL docs do warn about reproducibility. Consistent alignments and KMP_AFFINITY ought to help when using same number of threads and same platform.

Leave a Comment

Please sign in to add a comment. Not a member? Join today