[MITgcm-devel] Problem with unassigned mythid in TAF-generated ad routines

Patrick Heimbach heimbach at MIT.EDU
Tue May 6 14:56:45 EDT 2008


Hi Ralf,

I am having problems with the TAF-generated adjoint of our
latest code. Unfortunately, it's our ECCO production setup,
so somewhat important.
TAF frequently  ignores the myThid index in the adjoint
subroutines. Most of the times it's beign since not used at all,
sometimes it re-appears in an argument list for a
recomputation call in a subroutine, and in a few cases it is
actually used in these subroutines, e.g. to compute a key.

As an example, take S/R admom_fluxform (see attached code)
where we need a few recomputation subroutine calls.
admom_fluxform calls mom_calc_visc
where mythid is used to compute some keys.
This comp. is currently trivial, i.e. mythid = 0 always,
but will become important once we run in multi-threading.

Surprisingly, it's been like this for quite a while,
and seems to have behaved benign, but now,
for our latest code, for certain compilers
(e.g. on the Altix and IBM), and under certain circumstances
the model crashes since mythid is not assigned.
The random content of this variable and its dependence on
current state of memory is apparent, for example,
if you add the print statement in admom_fluxform (in attached code)
cph(
               if (myprocid.EQ.0)
      &             print *, 'ph-debug-mom C'
cph)
the problem disappears,
but if you comment this line the model crashes.
The other way to make this problem go away is to "hand-add"
cph(
       mythid = 0
cph)
at the top of the routine (not very satisfactory).
Some compilers let you initialize unassigned variables to zero,
but that's not a robust solution either.

Any idea, how we can cleanly fix this problem?

Cheers
-Patrick

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ad_taf_output.f_set_mythid.gz
Type: application/x-gzip
Size: 377331 bytes
Desc: not available
URL: <http://mitgcm.org/pipermail/mitgcm-devel/attachments/20080506/42c74bf0/attachment.gz>
-------------- next part --------------


---
Patrick Heimbach | heimbach at mit.edu | http://www.mit.edu/~heimbach
MIT | EAPS 54-1518 | 77 Massachusetts Ave | Cambridge MA 02139 USA
FON +1-617-253-5259 | FAX +1-617-253-4464 | SKYPE patrick.heimbach




More information about the MITgcm-devel mailing list