[MITgcm-support] Help with TAF-generated adjoint

Patrick Heimbach heimbach at mit.edu
Mon Mar 16 14:36:51 EDT 2015


Hi there,

just to conclude this thread, there were two issues:

1. extensive recomputations which caused TAF to “give up” with an ERROR message: 
TAF ERROR   ad_input_code.f:421700 : cannot generate correct recomputations for ...
(this requires fixing before running the code)

2. use of CPP option 
#define AUTODIFF_TAMC_COMPATIBILITY
which should never be used, unless you are still working with TAMC (instead of TAF or OpenAD).
When moving from TAMC to TAF, Fastopt had decided to change the order in which subroutine 
arguments of TAF-generated code are produced. This required change in the argument
list of MITgcm's hand-written adjoint code. To remain backward compatible with TAMC 
we’ve been maintaining both argument lists. Hence the CPP option.

-Patrick

On Feb 26, 2015, at 10:15 AM, Patrick Heimbach <heimbach at mit.edu> wrote:

> Dan,
> 
> can be a number of reasons, as a result of which there is a mismatch in argument list between a TAF-generates S/R and a hand-written S/R. As a result, myThid gets value of Zero, which it doesn’t like. Will need to look deeper into your changes of the code.
> 
> p.
> 
> On Feb 26, 2015, at 9:46 AM, Dan Jones <dcjones.work at gmail.com> wrote:
> 
>> Hello all,
>> 
>> I am trying to use TAF 2.8.12 to generate an adjoint model based on a regional Southern Ocean setup.  My cost function is simple (salinity at a point), and my control variables are minimal (initial conditions only).  The forward code runs perfectly well, but when the adjoint code starts running, I receive the following error:
>> 
>> !!!!!!! PANIC !!!!!!! CATASTROPHIC ERROR
>> !!!!!!! PANIC !!!!!!! in S/R BARRIER  myThid = 0  nThreads = 1
>> 
>> The "barrier" subroutine synchronizes  multiple threads in a multi-threaded code.  I checked the taf_ad.log file for errors, and I found the following, which may or may not be relevant:
>> 
>> end   generate adjoint computations of : dynamics
>> TAF WARNING TAF RECOMPUTATION WARNING CALL_STMT ad_input_code.f:421715 in forward_step
>> TAF WARNING  triggered by      : myiter,detasdt,detawdt,etah,etan,hfac_surfs,hfac_surfw,hfacc,hfacs,hfacw, pmepr,recip_hfacc
>> TAF WARNING  still to be recomputed : detasdt,detawdt
>> TAF ERROR   ad_input_code.f:421700 : cannot generate correct recomputations for myiter,detahdt,hfac_surfc, hfacc,hfacs,hfacw,obns,obnt,recip_hfacc,salt,theta
>> TAF ERROR   ad_input_code.f:421700 : ... due to unresolvable conflict for apressure0,apressure1,aqh,aqh0,a qh1,atemp,atemp0,atemp1,climsss0,climsss1,empmr0,empmr1,evap,hflux0,hflux1,lwdown,lwdown0,lwdown1,lwflux1, pload,pload0,pload1,precip,precip0,precip1,qnet0,qnet1,qsw0,qsw1,runoff,runoff0,runoff1,saltflux0,saltflux 1,sflux0,sflux1,snowprecip,snowprecip0,snowprecip1,sss,sss0,sss1,sst,sst0,sst1,swdown,swdown0,swdown1,swfl ux1,taux0,taux1,tauy0,tauy1,ustress0,ustress1,uwind0,uwind1,vstress0,vstress1,vwind0,vwind1,wspeed,wspeed0,wspeed1
>> begin generate adjoint computations of : do_oceanic_phys
>> 
>> I included the "begin" and "end" statements for context.  I found this old support thread, which is certainly relevant:
>> 
>> http://mitgcm.org/pipermail/mitgcm-support/2003-July/001087.html
>> 
>> Again, the forward code works well.  I'm not sure what to do next - could someone give me some suggestions for debugging?  Thanks very much in advance!
>> 
>> Many thanks,
>> Dan
>> 
>> ---------------------------------------------------------
>> 
>> Dr Dan Jones
>> British Antarctic Survey, NERC
>> Cambridge, UK
>> 
>> Phone: +44 (0)1223 221505
>> Fax: +44 (0)1223 362616
>> Skype:  dcjones.work
>> 
>> ---------------------------------------------------------
>> _______________________________________________
>> MITgcm-support mailing list
>> MITgcm-support at mitgcm.org
>> http://mitgcm.org/mailman/listinfo/mitgcm-support
> 
> 
> ---
> Patrick Heimbach | heimbach at mit.edu | http://www.mit.edu/~heimbach
> MIT | EAPS 54-1420 | 77 Massachusetts Ave | Cambridge MA 02139 USA
> FON +1-617-253-5259 | FAX +1-617-253-4464 | SKYPE patrick.heimbach
> 
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1588 bytes
Desc: not available
URL: <http://mitgcm.org/pipermail/mitgcm-support/attachments/20150316/df3f4d93/attachment.p7s>


More information about the MITgcm-support mailing list