[MITgcm-devel] restoring tapenade-tangent linear for STREAMICE: proposed solution

Daniel Goldberg Dan.Goldberg at ed.ac.uk
Mon Dec 15 10:51:13 EST 2025


thanks martin, i think this is a reasonable idea then.

from what i have seen, if tapenade is passed a subroutine, it does not care if there is a flow file entry or not. one difference is that the flow file for tapenade does not tell the tool which manual subroutines to use. one has to make sure they are defined somewhere (e.g. stubs_tap_adj.F).

thanks
dan
________________________________
From: MITgcm-devel <mitgcm-devel-bounces at mitgcm.org> on behalf of Martin Losch <Martin.Losch at awi.de>
Sent: Monday, December 15, 2025 13:54
To: MITgcm-devel <MITgcm-devel at mitgcm.org>
Subject: Re: [MITgcm-devel] restoring tapenade-tangent linear for STREAMICE: proposed solution

Hi Dan,

there is a similar problem for verification/bottom_ctrl_5x5 where we test the manual AD routine of cg2d (cg2d_mad.F), which does not work for the TLM (there is none) and hence the TLM gradients are totally wrong. An optional model_tlm_diff.list could be useful in this context, too. I am not sure how TAF handles that because when flow directives describing the interfact are given, then usually TAF ignores the corresponding files.

Martin

On 15. Dec 2025, at 13:46, Daniel Goldberg <Dan.Goldberg at ed.ac.uk> wrote:

Dear J-M and all:

Upon the merging of 927<https://github.com/MITgcm/MITgcm/pull/927>(which was a good thing!), the tangent linear test of STREAMICE under Tapenade no longer worked, whereas it seemed to be giving accurate values. I am writing this email to run a proposed solution by the team, rather than submitting a PR unannounced, to get a feel for whether it would be welcomed, and looked at.

The reason is that streamice_cg_solve.f is no longer passed to Tapenade, instead using a "manual" approach as with cg2d.f. This is necessary for large problems where the ad-generated adjoint code would be very slow and/or memory intensive and would preclude external library solvers. These issues would not apply as much to the TLM — but no "manual" solution exists.

My idea for a solution, is to pass streamice_cg_solve.f through tapenade only when the TLM is compiled. I propose to do this by modifying genmake2 to look for "supplemental" files *_tlm_diff.list (in addition to *_ad_diff.list). A list of S/Rs called $(TLM_FILES) (or something) will be created and passed as an argument to tapenade, only for the TLM call. The *_tlm_diff.list files (e.g. streamice_tlm_diff.list) files will be optional, and only need contain files that are passed to the TLM but not adjoint. I think this is justified as in general the set of functions that the TLM can parse easily is larger than that of the adjoint.

All the best
Dan



--
Daniel Goldberg, PhD (he/him)
Reader in Glaciology
School of Geosciences, University of Edinburgh
Geography Building, Drummond Street, Edinburgh EH8 9XP
https://dngoldberg.github.io/
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th’ ann an Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336. _______________________________________________
MITgcm-devel mailing list
MITgcm-devel at mitgcm.org<mailto:MITgcm-devel at mitgcm.org>
http://mailman.mitgcm.org/mailman/listinfo/mitgcm-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.mitgcm.org/pipermail/mitgcm-devel/attachments/20251215/f67c43af/attachment.html>


More information about the MITgcm-devel mailing list