[MITgcm-support] NaN - stop running?

Gus Correa gus at ldeo.columbia.edu
Thu Nov 16 12:14:38 EST 2017


Hi Yangxin

Pass the --ieee and --devel flags to genmake2,
when you build the model (do a 'make CLEAN' beforehand).
Something like this (assuming you use MPI):

/path/to/MITgcm/tools/genmake2 \
--rootdir=/path/to/MITgcm \
--optfile= /path/to/MITgcm/tools/build_options/your_build_options_file \
--mods=/path/to/your/experiment/code \
--mpi \
--ieee \
--devel \


If your build_options file was properly written, it will
turn on your compiler's floating point exceptions (as Jody suggested),
and the model will crash at the first NaN.

Besides, it is also useful to turn on "traceback"
(or "backtrace", check the compiler man page) compiler flag,
which will tell you in which preprocessed ".f" file
(in your build directory)
and on which line of code line the problem happened.
BTW, keep the ".f" files, don't do a 'make clean' while you're
chasing the error.

If your build_options file doesn't have these features,
you can find some example files that do have that
in the MITgcm original build_options directory.
Look there for "macros" such as IEEE, and DEVEL.
Copy the corresponding blocks to your build_options file,
and adjust to your compiler's specific flags.

I hope this helps,
Gus Correa

On 11/15/2017 01:33 PM, Jody Klymak wrote:
> You want to look up floating-point exception handling for your compiler.
> 
> Cheers,   Jody
> 
> 
> 
>> On 15 Nov 2017, at  10:18 AM, Yangxin He <y67he at uwaterloo.ca 
>> <mailto:y67he at uwaterloo.ca>> wrote:
>>
>> Hey,
>>
>> I am having a (probably) small problem. Sometimes my output data gives 
>> all NaN for various reasons. But it still kept running until the end. 
>> Is there any way that I can make the model stop running once it starts 
>> to generate NaNs?
>>
>> Thanks
>>
>> Yangxin
>> _______________________________________________
>> MITgcm-support mailing list
>> MITgcm-support at mitgcm.org <mailto:MITgcm-support at mitgcm.org>
>> http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support
> 
> --
> Jody Klymak
> http://web.uvic.ca/~jklymak/
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support
> 



More information about the MITgcm-support mailing list