[Users] nan using Carpet

Roland Haas rhaas at illinois.edu
Fri Oct 30 14:24:53 CDT 2020


Hello David,

ok, Please note that I made sure to mention that if setting

Carpet::poison_new_timelevels = no
CarpetLib::poison_new_memory = no

makes the NaN go away *then* your code has a bug, since it reads from
unitialized memory. You saw the NaN when Carpet ensured that the
undefined value stored in newly allocated memory is a NaN. Nothing says
that memory allocated via malloc() has any particular value, the OS is
free to set it all to a value of say 42.

Ie setting 

Carpet::poison_new_timelevels = no
CarpetLib::poison_new_memory = no

does not actually fix the bug. It just hides its effect.

Yours,
Roland

> Thank you,
> 
> That was driving me nuts. It works now.
> 
> -DG
> 
> 
> > On Oct 30, 2020, at 2:06 PM, Roland Haas <rhaas at illinois.edu> wrote:
> > 
> > Hello David,
> > 
> > you should be able to run basic PUGH parfiles with Carpet.
> > 
> > The one difference that comes to mind is that Carpet by default will
> > poison (fill with NaN) unitialized memory while PUGH leaves it the way
> > the OS provided it (which usually means either 0 or whatever value it
> > had before.
> > 
> > You an set:
> > 
> > Carpet::poison_new_timelevels = no
> > CarpetLib::poison_new_memory = no
> > 
> > and if that "fixes" the problem then in fact you have a bug in your
> > code and are accessing unitialized memory.
> > 
> > Can you provide a working example parfile to reproduce the problem?
> > 
> > Yours,
> > Roland
> >   
> >> Hello,
> >> 
> >> I’m switching a code I wrote from using PUGH to using Carpet but now I get lots of NAN’s when I run it.  Are there any special parameters needed to run Carpet as unigrid and behave like PUGH?  I am also using MoL and get this issue even when I use Euler methods and trivial initial data.
> >> 
> >> -DG
> >> 
> >> _______________________________________________
> >> Users mailing list
> >> Users at einsteintoolkit.org
> >> http://lists.einsteintoolkit.org/mailman/listinfo/users  
> > 
> > 
> > -- 
> > My email is as private as my paper mail. I therefore support encrypting
> > and signing email messages. Get my PGP key from http://pgp.mit.edu .  
> 
> _______________________________________________
> Users mailing list
> Users at einsteintoolkit.org
> http://lists.einsteintoolkit.org/mailman/listinfo/users


-- 
My email is as private as my paper mail. I therefore support encrypting
and signing email messages. Get my PGP key from http://pgp.mit.edu .
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
Url : http://lists.einsteintoolkit.org/pipermail/users/attachments/20201030/3f06ac4b/attachment-0001.bin 


More information about the Users mailing list