[Users] Meetig minutes

Roland Haas roland.haas at physics.gatech.edu
Mon Sep 26 14:56:19 CDT 2011


Hello Erik,

> Regarding segfaults in Fortran: why don't unallocated variables lead
> to an error in Fortran? Do you refer to Fortran allocation or Cactus
> allocations here?
Cactus allocations. Variables for which no STORAGE statement is active 
(either global or in the schedule item).

The reason is that (see configs/*/bindings/include/cctk_Arguments.h) you 
cannot legally pass a NULL pointer as a FORTRAN array subroutine 
argument, there apparently *has* to be some storage (I guess FORTRAN 
does no allow zero-sized arrays). So for non-debug runs Cactus passes in 
the address of a dummy array. This is sufficient to prevent segfaults 
(even for rather larger grids). Caught me recently when adding the 
Multipatch hacks to support non-multipatch runs. I was counting on 
segfaults if I had forgotten any pointers (and for rather large grids, 
so it is not just a small grid issue that goes away in production runs). 
  I ended up unitialized memory which was mostly 0 so it did not show up 
in the test (since the variable without storage was kxx in Minkowski 
spacetime). :-(

Yours,
Roland

--8<-- configs/*/bindings/include/cctk_Arguments.h --8<--
/*
  * References to non-existing or non-allocated variables should be passed
  * as NULL pointers in order to catch any invalid access immediately
  * However, this runtime debugging feature may cause problems
  * with some fortran compilers which require all fortran routine arguments
  * to refer to a valid memory location (eg. to enable the code optimizer
  * to generate conditional load/store instructions if applicable).
  * For this reason, we pass NULL pointers only for debugging 
configurations,
  * and a pointer to a user-accessable memory location (a local dummy 
variable)
  * otherwise.
  */
--8<--


-- 
My email is as private as my paper mail. I therefore support encrypting
and signing email messages. Get my PGP key from http://keys.gnupg.net.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.einsteintoolkit.org/pipermail/users/attachments/20110926/9ecc4526/attachment.bin 


More information about the Users mailing list