[MITgcm-devel] OAD_convert and S/Rs within k-loops

Daniel Goldberg dngoldberg at gmail.com
Fri Mar 8 16:33:16 EST 2019


Awesome J-M. Thanks for looking at this and also for opening the PR.

Best
Dan

On Fri, Mar 8, 2019 at 9:29 PM Jean-Michel Campin <jmc at mit.edu> wrote:

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


-- 

Daniel Goldberg, PhD
Sr. Lecturer in Glaciology
School of Geosciences, University of Edinburgh
Geography Building, Drummond Street, Edinburgh EH8 9XP


em: dan.goldberg at ed.ac.uk
web: https://www.geos.ed.ac.uk/homes/dgoldber
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.mitgcm.org/pipermail/mitgcm-devel/attachments/20190308/c4c1904b/attachment.html>


More information about the MITgcm-devel mailing list