[Nek5000-users] Method to detect NaNs
nek5000-users at lists.mcs.anl.gov
nek5000-users at lists.mcs.anl.gov
Tue Mar 8 15:58:04 CST 2011
Hi Neks,
I just wanted to pass on a method that may or may not be useful to you all.
I'm sure manyf NEK simulations are run on machines where the hours
aren't "free." Thus, it's nice to try and minimize any wasted hours
as much as possible. So, if a simulation blows up, you want to end
the simulation as quickly as possible so as to not waste any more
precious computational time.
While there are probably better solutions, I end up putting the
following snippet into my userchk()
if (u_max.ne.u_max) then
if (nid.eq.0) print *,'Sim is blowing up!!'
call exitt()
endif
where u_max is something I calculated before hand. An interesting
property of NaNs I found after doing some googling is that NaNs are
not equal to anything..even themselves. So, if you take some
quantity, and compare it to itself, the only time it isn't equal to
itself is if it is Not a Number. You can use this property to tell
your simulation to quit. I've tested this out on a case that I knew
would blow up on me and it worked perfectly.
Hope you all find this helpful for "hazardous" jobs when you can't
spare the time to monitor its progress at all times.
--
Josh Camp
"All that is necessary for the triumph of evil is that good men do
nothing" -- Edmund Burke
More information about the Nek5000-users
mailing list