-
Notifications
You must be signed in to change notification settings - Fork 236
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
Replace MOM_control_struct pointers as locals #1429
Replace MOM_control_struct pointers as locals #1429
Conversation
This patch will fix the FMS2 PGI runtime issues for most tests. Only This patch requires a change to the |
The CS was tagged as (Note that some may be required for the rotation testing.) |
@marshallward I never looked into FMS2! (You may recall our past conversations!) Will get in touch with you on Friday to figure out how to test. It's certainly good to get a head start before we update to FMS2. Thanks for the heads up! |
Thanks @sanAkel For you and the others: the only real question is whether there is any issue changing the |
Yes, having a problem:
This is in all my Chapman_coast tests. |
@marshallward looking (at the changes on my phone!) it seems:
So if 1 is true, I should be able to give it a 👍 or 👎 easily without bothering @mathomp4 or @tclune (except via this note!) |
All is well with this change:
|
I may have tracked down the underlying problem while working through another issue, which would make this PR unnecessary. There is probably still value in phasing out these old pointers, but we may be able to delay it if I can work out a solution. I'll update when I've reached a conclusion. |
FYI, the tests of mine that failed were all barotropic. Do you need a barotropic test? |
Yes, that would help. BTW @kshedstrom I think you might be seeing problems related to the memory cleanup. Can you re-try with dev/gfdl rather than this PR? |
dev/gfdl is no problem either. I'm only testing gfortran. |
in UFS we follow GFDL main branch. This time Marshall's PR is aimed for dev/gfdl, so my first work is testing dev/gfdl in UFS. What I found is in dev/gfdl some changes in MOM_wave_interface.F90 is causing compiling failure in UFS. I think the reason is those public properties were being removed at they were defined as public in main (see https://github.com/NOAA-GFDL/MOM6/blob/main/src/user/MOM_wave_interface.F90#L75-L114) this caused the compiling failure in nuopc code at /MOM6/config_src/drivers/nuopc_cap/mom_ocean_model_nuopc.F90(396): error #6292: The parent type of this field is use associated with the PRIVATE fields attribute. [WAVENUM_CEN] |
@jiandewang Let's deal with that in a separate issue or perhaps in the next dev/gfdl merge. Hopefully it is unrelated to the pointer status of |
@kshedstrom Is there a simple way for me to test your configuration? |
@sanAkel Testing with FMS1 should be fine. |
Unfortunately I don't think I can find a way around the problem without this PR, so I will move forward with it. @kshedstrom I will add your suggested changes to the PR. |
The MOM_control_struct is declared and passed as a pointer to a CS (usually allocated anonymously) and treated as if it were a pointer, even though there is currently no real advantage to doing so. After the FMS update, the deallocation of this CS was causing a segmentation fault in the PGI compilers. While the underlying cause was never determined, it is likely due to some automated deallocation of the CS contents, whose addressing became scrambled. This problem can be resolved by moving all of the CS contents to stack, so that the contents are automatically removed upon exiting whatever function it was instantiated. Subsequent calls can reference the local (or parent) stack contents.
7bbc309
to
a61c43a
Compare
One example barotropic case is: https://github.com/ESMG/ESMG-configs/tree/dev/esmg/ocean_only/Tidal_bay |
@marshallward agree, I will testing this PR by manually adding those "public" back in the wave code. |
I modified Kate's suggestion to check Assuming that this PR and NOAA-GFDL/FMS#764 are accepted, we should be able to run our regression suite with both FMS1 and FMS2. (I suppose I now "approve" my own PR...?) |
@marshallward by adding those "public" back in wave-interface code, your branch works fine in UFS |
This is an API change so can @alperaltuntas @gustavo-marques take a look at this PR? |
Approved. Apart from the issue of private wave members that's already pointed out, this PR works fine with the NCAR configuration. |
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.
There is broad agreement that these changes are correct and work for all of the primary MOM6 development forks. Although the automated pipeline testing is broken at the moment due to some unfortunate updates to the Gaea scheduler, I have manually carried out the pipeline tests, and I can confirm that this PR does not change any answers, and that all output is the same.
The MOM_control_struct is declared and passed as a pointer to a CS
(usually allocated anonymously) and treated as if it were a pointer,
even though there is currently no real advantage to doing so.
After the FMS update, the deallocation of this CS was causing a
segmentation fault in the PGI compilers. While the underlying cause was
never determined, it is likely due to some automated deallocation of the
CS contents, whose addressing became scrambled.
This problem can be resolved by moving all of the CS contents to stack,
so that the contents are automatically removed upon exiting whatever
function it was instantiated. Subsequent calls can reference the local
(or parent) stack contents.