MFlowCode / MFC

Exascale simulation of multiphase/physics fluid dynamics
https://mflowcode.github.io
MIT License
143 stars 68 forks source link

Building with strict floating point operations for testing purposes #622

Open sbryngelson opened 2 months ago

sbryngelson commented 2 months ago

A --strict build flag that passes compile options that enforce floating point consistency. This would be used for generating goldenfiles and on the runners.

These need to be documented for the relevant compilers. GCC, CCE, Intel, and NVHPC.

In practice, the compilers that seem to need many flags may actually not need so many, since one flag could automatically trigger the others.

The default is -Knoieee and the compiler does not provide special compilation semantics.

-K<flag>

ieee 
Perform floating-point operations in strict conformance with the IEEE 754 standard.
Some optimizations are disabled, and on some systems a more accurate math library is
linked if -Kieee is used during the link step.

and

[no]fprelaxed[=option] 
Perform certain floating point intrinsic functions using
relaxed precision.
sbryngelson commented 1 month ago

@okBrian https://www.godbolt.org/ I've been playing with this and have not had much success... it suggests visibly different assembly for the two compilers (though perhaps consistent across compiler versions)... even when using special compiler flags.