[MITgcm-support] NaNQ

Constantinos Evangelinos ce107 at ocean.mit.edu
Tue Mar 20 12:20:51 EDT 2007


On Tue 20 Mar 2007 11:27, Sergey Vinogradov wrote:

> Hi
> Does anyone know how to make MITgcm break its execution once it starts
> to produce NaNQs? I'm not sure if it is platform/compiler- dependent;
> NaNQs are being dumped if a numerical instability is encountered (or by
> some other reasons??) but the model continues to run further and burn
> precious CPU time.
> Thanks,

This is probably an FAQ:
a) At the cost of slowing down your code a bit you can make MonitorFreq 
smaller so it can catch the blowup before it happens. That usually requires 
checking as low as every 5th timestep which may be impractical speed wise.
b) Depending on the platform/compiler there can be a compiler flag or two that 
unmask floating point exceptions including NaNQs. For example on Linux or 
MacOS X IA32/X86_64/EMT64/IA64 platforms with the Intel compilers -fpe0 or 
-fpe1. You don't have full control over which exceptions are unmasked.
c) On platforms which have the GNU Scientific Library (GSL) which include 
Linux systems and most Unix Systems (you can always compile it yourself) one 
can use the GSL IEEE arithmetic support I added to the model.

Specifically you add a "-gsl" flag at the genmake2 level and then you can 
control which exceptions to mask by using the environment variable 
GSL_IEEE_MODE as explained below:
http://www.gnu.org/software/gsl/manualhttp://www.gnu.org/software/gsl/manual/html_node/Setting-up-your-IEEE-environment.html/html_node/Setting-up-your-IEEE-environment.htmlThis 
is entirely portable.

Constantinos
-- 
Dr. Constantinos Evangelinos
Department of Earth, Atmospheric and Planetary Sciences
Massachusetts Institute of Technology




More information about the MITgcm-support mailing list