Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29236 Discussions

Use of fp:precise to guaranttee consistency from run to run?

Tony_Garratt
Beginner
889 Views

I have posted the following comment at the useful page http://software.intel.com/en-us/articles/consistency-of-floating-point-results-using-the-intel-compiler/#comment-46055 but wanted to open up a thread here for discussion too, because the reproducability issue has been causing me a lot of trouble recently and I want to be sure that switching on fp:precise really will solve my problems.

-----------------

Very useful! But I have 2 questions:

(1) You infer (by using the statement "may also be used to improve the run-to-run consistency") that even with fp:/precise, the results may still vary from run to run. Is that the case or not, and, if so, what can we do to be sure the results are consistent?

(2) I would like to understand how the environment and memory alignment can affect the fp operations and optimization? This topic also comes up with MKL (we have protected all of our double precision arrays passed to MKL to be 16-byte boundary aligned), but that is not practical to do for all Fortran Allocate() statements that allocate arrays that are NOT passed to MKL. Is it necessary to ensure ALL double precision arrays are aligned on windows or linux platforms even if you are not using MKL UNLESS you use fp:precise?

---------

0 Kudos
4 Replies
joseph_battelle
Beginner
889 Views
I know this doesn't answer your question but I was just wondering-and couldn't tell from your post why it wasn't practical to align all allocatables--are you using the align directive on your MKL allocatables? Is it just a code maintenance issue?

cDEC$ ATTRIBUTES ALIGN: n:: var

0 Kudos
TimP
Honored Contributor III
889 Views
/fp:source (or precise) removes the auto-vectorization option for sum and dot product reductions. As the grouping of addition under optimization varies with alignment, this eliminates a possible source of numerical variations between runs with varying alignment.
0 Kudos
Tony_Garratt
Beginner
889 Views

Everywhere we call MKL we have aligned the data. But we have a large number of allocate statements in our codes generally, and it would be a large task to go everywhere and add the cDEC$ statement for every double precision array. A compiler directive to force 16 byte boundary alignment for all doubles would be the ideal solution for us.
0 Kudos
Tony_Garratt
Beginner
889 Views

Thank you Tim! So basically, array alignment is not the only issue; loop auto-vectorization can be a cause too; thats helpful to understand. Sounds like we go with fp:precise. However, does it GUARANTEE that all "risky" optimization is turned off to ENSURE consistent run to run fp operations?

thanks
Tony
0 Kudos
Reply