<div dir="ltr"><div>Awesome J-M. Thanks for looking at this and also for opening the PR.</div><div><br></div><div>Best</div><div>Dan</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 8, 2019 at 9:29 PM Jean-Michel Campin <<a href="mailto:jmc@mit.edu">jmc@mit.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Dan,<br>
<br>
I don't see any reason why we would like to keep these 2 arguments<br>
in these 2 S/R ; Long ago (before Aug 2003) tFld was used in CALC_GRAD_PHI_HYD<br>
(and at that time, sFld should have been used too) but it got replaced<br>
to use "alphRho" instead (which is more consistent too).<br>
And did not find any use of tFld,sFld in DIAGS_PHI_RLOW.<br>
<br>
An other thing is that we could also safely remove tFld & sFld from<br>
argument list of calling S/R CALC_PHI_HYD and use instead theta & salt<br>
(available in common block). Was needed for the old implementation <br>
of staggerTimeStep (until July 2004) but not the case anymore.<br>
<br>
I will create a PR with tFld,sFld removed from CALC_GRAD_PHI_HYD<br>
and DIAGS_PHI_RLOW (+ may be CALC_PHI_HYD also) soon.<br>
<br>
Cheers,<br>
Jean-Michel<br>
<br>
On Fri, Mar 08, 2019 at 03:42:27PM +0000, Daniel Goldberg wrote:<br>
> Hi All<br>
> <br>
> (apologies if this gets double posted)<br>
> <br>
> I have noticed that CALC_PHI_HYD passes the arrays SFLD and TFLD to<br>
> CALC_GRAD_PHI_HYD and DIAGS_PHI_RLOW, but i can't see where these arrays<br>
> are then used within these called subroutines -- are the arguments required?<br>
> <br>
> If not, i would think the performance hit is negligible in most cases, but<br>
> when compiling with OpenAD the result is that OAD_convert is called to<br>
> convert the active arrays SFLD and TFLD to real arrays -- and since this is<br>
> called within the dynamics loop, the unncessary array conversion takes<br>
> place Nr times per time step.<br>
> <br>
> In my current setup this seems to increase "plain mode" run time (and<br>
> presumably adjoint mode too) by at least 200%. Im unsure if there is<br>
> anywhere else such a performance hit is occuring. (Of course, i set<br>
> useDiagPhiRlow to .false., but i can't avoid calling CALC_GRAD_PHI_HYD!)<br>
> There may be a way to "trick" openad into not behaving this way -- but i<br>
> wanted to check whether these arguments are even needed.<br>
> <br>
> Best<br>
> Dan<br>
> <br>
> <br>
> -- <br>
> <br>
> Daniel Goldberg, PhD<br>
> Sr. Lecturer in Glaciology<br>
> School of Geosciences, University of Edinburgh<br>
> Geography Building, Drummond Street, Edinburgh EH8 9XP<br>
> <br>
> <br>
> em: <a href="mailto:dan.goldberg@ed.ac.uk" target="_blank">dan.goldberg@ed.ac.uk</a><br>
> web: <a href="https://www.geos.ed.ac.uk/homes/dgoldber" rel="noreferrer" target="_blank">https://www.geos.ed.ac.uk/homes/dgoldber</a><br>
<br>
> _______________________________________________<br>
> MITgcm-devel mailing list<br>
> <a href="mailto:MITgcm-devel@mitgcm.org" target="_blank">MITgcm-devel@mitgcm.org</a><br>
> <a href="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-devel" rel="noreferrer" target="_blank">http://mailman.mitgcm.org/mailman/listinfo/mitgcm-devel</a><br>
<br>
_______________________________________________<br>
MITgcm-devel mailing list<br>
<a href="mailto:MITgcm-devel@mitgcm.org" target="_blank">MITgcm-devel@mitgcm.org</a><br>
<a href="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-devel" rel="noreferrer" target="_blank">http://mailman.mitgcm.org/mailman/listinfo/mitgcm-devel</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><br>Daniel Goldberg, PhD<br>Sr. Lecturer in Glaciology<div>School of Geosciences, University of Edinburgh<br><span style="color:rgb(0,0,0);font-family:arial,helvetica,clean,sans-serif;line-height:15px">Geography Building, Drummond Street, Edinburgh EH8 9XP</span><br><br><br>em: <a href="mailto:dan.goldberg@ed.ac.uk" target="_blank">dan.goldberg@ed.ac.uk</a><br>web: <a href="https://www.geos.ed.ac.uk/homes/dgoldber" target="_blank">https://www.geos.ed.ac.uk/homes/dgoldber</a></div></div></div></div></div></div></div></div></div></div></div>