easybuilders / easybuild-framework

EasyBuild is a software installation framework in Python that allows you to install software in a structured and robust way.
https://easybuild.io
GNU General Public License v2.0
152 stars 202 forks source link

Intel compiler option -fltconsistency #2552

Open klust opened 6 years ago

klust commented 6 years ago

https://github.com/easybuilders/easybuild-framework/blob/0637e49aaefcd8d64da623d758180338cd6aa866/easybuild/toolchains/compiler/inteliccifort.py#L61

I can't find the -fltconsistency option in the Intel compiler manuals for version 18 (I haven't checked the older ones), and indeed when I build with an EasyConfig where I set ieee to true, I do get warnings in the output that the compiler does not recognize that option.

(The concrete case where I got it is an EasyConfig for GROMACS 2018.2 I'm working on. On Ivy Bridge it fails to pass three of the tests, and I was searching for which alternative floating point options produce a working build without too much performance impact, but that is otherwise separate from this issue.)

boegel commented 6 years ago

@klust Thank you for the bug report.

That flag was added ages ago (Intel compilers 11.x era, or even earlier), and the ieee toolchain option is rarely used I think, which explains why this has been overlooked...

Any suggestions for an equivalent flag?

akesandgren commented 6 years ago

-fltconsistency is only available for ifort, not icc (and is still there in intel 18) ieee options are only intended for fortran builds but there is currently no way to ignore it for C compilers i think.

akesandgren commented 6 years ago

Which tests is it failing on?

damianam commented 6 years ago

@akesandgren beat me to it! An alternative form is -mieee-fp in case someone is interested, but as Åke said, the option is still available and relevant. However, maybe we should apply this just to fortran compilers, and not to C?

klust commented 6 years ago

Concerning the equivalent flag: I found an interesting document on the Intel web site about compiling for floating point consistency: https://software.intel.com/sites/default/files/managed/de/a1/FP_Consistency_091117.pdf and that one suggest that -fp-model precise -fp-model source should give good adherence to the IEEE standards, but that is in fact set through another option already (I believe that on 64-bit intel -fp-model source is actually the default when -fp-model precise is already used, but it is not on 32-bit architectures). Alternatively, another option that has to do with cross-platform consistency of floating point computations is -fimf-arch-consistency=true.

@akesandgren Concerning GROMACS: when using the AVX_256 kernels for Ivy Bridge, three tests fail SimdMathTest.exp, SimdMathTest.expSingleAccuracy and SimdMathTest.expSingleAccuracyUnsafe. I've tried a manual build setting only the compiler but no flags (so let GROMACS choose its own flags), and even those fail. I found several working variants for CFLAGS and CXXFLAGS, the shortest of which is -no-ftz. It seems that practically all combinations where I enforce -ftz fail and all those where I enforce -no-ftz work, even when using -fp-model fast=2. It also happens when I enforce the use of the AVX_256 kernels on broadwell, so it is not a CPU hardware problem.

akesandgren commented 6 years ago

Regarding the ieee option, I added it mainly to be able to build lapack/scalapack correctly, but i still haven't gotten around to start adding my fixes, they are Makefile fixes to make sure certain files get compiled with the right flags...

akesandgren commented 6 years ago

regarding the gromacs problem, have you checked with the gromacs dev people? And do you see the same problem on newer HW like haswell/broadwell? I don't recall any such problems...

And we should perhaps continue this in a mail thread instead, if you still feel like following up on this.