-
Notifications
You must be signed in to change notification settings - Fork 1
Adjust store directives, so that it compiles with MITgcm PR862 without any intervention #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
but it is not clear if the gradients are correct
for reference, but commented out, as it leads to errors
@IvanaEscobar I created the PR just to show my changes in a compact form. |
!$TAF STORE arr, narr, ray2d = tapelev2, key = ilev_2 | ||
!$TAF STORE angles%dalpha = tapelev2, key = ilev_2 | ||
!$TAF STORE bdry%bot, bdry%top = tapelev2, key = ilev_2 | ||
!$TAF STORE beam%nsteps = tapelev2, key = ilev_2 | ||
!$TAF STORE pos%rz, pos%sz = tapelev2, key = ilev_2 | ||
!$TAF STORE ssp%c, ssp%cmat = tapelev2, key = ilev_2 | ||
!$TAF STORE ssp%cz, ssp%czmat = tapelev2, key = ilev_2 | ||
!$TAF STORE ssp%rho = tapelev2, key = ilev_2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be done in a similar way for tapelevel3 and tapelevel4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the PASSIVE statement does not work properly
src/ihop_driver.F
Outdated
CML# ifdef ALLOW_AUTODIFF_TAMC | ||
CML tkey = nts*(ikey_dynamics-1) + t | ||
CML!$TAF STORE arr, bdry, ray2d = comlev1_ihop_nts, key = tkey | ||
CML!$TAF STORE angles%dalpha = comlev1_ihop_nts, key = tkey | ||
CML!$TAF STORE bdry%bot, bdry%top = comlev1_ihop_nts, key = tkey | ||
CML!$TAF STORE beam%nsteps = comlev1_ihop_nts, key = tkey | ||
CML!$TAF STORE pos%rz, pos%sz = comlev1_ihop_nts, key = tkey | ||
CML!$TAF STORE ssp%c = comlev1_ihop_nts, key = tkey | ||
CML# endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the commented part that leads to the segmentation fault at TAF's end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may lead to issues due to ray2d
and other derived types being extended into arrays. TAF seems to have a hard time with allocatable arrays within an array of derived types.
One way around this is to create a bunch of temporary arrays to store into tapes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, I tried different subsets of the full set, but it always gave the segmentation fault. I store ray2d
in other places without (obvious) problems.
@@ -1004,6 +1019,9 @@ SUBROUTINE gcmSSP( myThid ) | |||
k = k + 1 | |||
END DO | |||
END DO | |||
#ifdef ALLOW_AUTODIFF_TAMC | |||
!$TAF STORE ssp%cMat = comlev1_ihop, key = ikey_dynamics | |||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These stores avoid recomputing tmpssp
and ssp%cMat
in the AD-code (something that TAF didn't warn about)
allows to remove an now unused tape
mitgcm_code/the_main_loop.F
Outdated
!$TAF STORE ssp%c, ssp%cmat = comlev1_ihop, key = ikey_dynamics | ||
!$TAF STORE ssp%cz, ssp%czmat = comlev1_ihop, key = ikey_dynamics | ||
C for some reason TAF does not do this right, so we store ssp instead | ||
CML!$TAF STORE ssp%rho = comlev1_ihop, key = ikey_dynamics | ||
!$TAF STORE ssp = comlev1_ihop, key = ikey_dynamics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as ssp
is stored, we don't need the rest
!$TAF STORE ssp%c, ssp%cmat = comlev1_ihop, key = ikey_dynamics | |
!$TAF STORE ssp%cz, ssp%czmat = comlev1_ihop, key = ikey_dynamics | |
C for some reason TAF does not do this right, so we store ssp instead | |
CML!$TAF STORE ssp%rho = comlev1_ihop, key = ikey_dynamics | |
!$TAF STORE ssp = comlev1_ihop, key = ikey_dynamics | |
CML!$TAF STORE ssp%c, ssp%cmat = comlev1_ihop, key = ikey_dynamics | |
CML!$TAF STORE ssp%cz, ssp%czmat = comlev1_ihop, key = ikey_dynamics | |
C for some reason TAF does not do this right, so we store ssp instead | |
CML!$TAF STORE ssp%rho = comlev1_ihop, key = ikey_dynamics | |
!$TAF STORE ssp = comlev1_ihop, key = ikey_dynamics |
local tapes of gcmSSP are commented out for illustrative purposes
More comments:
|
Adding a note here on TAF inner workings as of 6.5.0: A derived type should be able to support both passive and active components mixed. To enforce a passive component within a derived type, one may set it as such at the point of declaration.
This will enforce any call of NOTE: TAF should figure this out without human intervention. We have experienced TAF missing some derived type components mostly due to misplaced code flow within |
It is not clear if tape keys are correct. The gradients have not been tested.
There are no remaining recomputation warnings after adjusting logic in
ihop_driver.F
On my MacBook, I can now type
and everything compiles. Only at the link step I get a memory error: