[MITgcm-devel] floating point problems in exf_getffieldrec.F
Martin Losch
Martin.Losch at awi.de
Thu Oct 12 06:13:39 EDT 2017
Hi all,
Elena (cc) just ran into a problem (on our Cray CS400 ollie), where exf was not reading the correct records from a file. The reason is line 190 in exf_getffieldrec.F
fldsecs = MOD(fldsectot,fldPeriod)
in some cases (e.g. MOD(2952000.,2952000.)) this did not give the expected result (0.) but 2952000. This then leads to changed=.FALSE. and the new record is skipped, leading to very different results in the simulations.
It turns out that the problem is solved by reducing the floating point optimization from -hfp3 to -hfp2. Apparently with -hfp3, 2952000. is not exactly equal to 2952000., but probably a little less so that 2952000. as the remainder is returned.
My question: Can we think of a more robust way for this operation? (I can’t.) We found this problem only very accidentally because we were looking for a reason why two different exf-settings gave unexpectedly different results, and it is very likely that errors like this will go unnoticed.
Martin
More information about the MITgcm-devel
mailing list