Skip to content
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

Do not allocate ustar and tau_mag together #464

Merged
merged 2 commits into from
Sep 28, 2023

Conversation

Hallberg-NOAA
Copy link
Member

Modified MOM_surface_forcing_gfdl.F90 and MOM_surface_forcing.F90 to allocate either ustar or tau_mag, but not both, in the forcing and mech_forcing types, depending on whether the model is in Boussinesq mode. Also added tests to convert_IOB_to_forces in the FMS_cap code and to routines in MOM_surface_forcing in the solo_driver code to ensure that only arrays that are associated are set. All answers are bitwise identical, but checksum statements for the unused arrays are eliminated when DEBUG = True.

@codecov
Copy link

codecov bot commented Aug 20, 2023

Codecov Report

Merging #464 (62aeb04) into dev/gfdl (8d628bd) will decrease coverage by 0.02%.
The diff coverage is 15.38%.

❗ Current head 62aeb04 differs from pull request most recent head 565e5b5. Consider uploading reports for the commit 565e5b5 to get more accurate results

@@             Coverage Diff              @@
##           dev/gfdl     #464      +/-   ##
============================================
- Coverage     37.90%   37.88%   -0.02%     
============================================
  Files           270      270              
  Lines         78100    78125      +25     
  Branches      14436    14456      +20     
============================================
  Hits          29600    29600              
- Misses        43123    43146      +23     
- Partials       5377     5379       +2     
Files Coverage Δ
...ig_src/drivers/solo_driver/MOM_surface_forcing.F90 23.62% <15.38%> (-0.39%) ⬇️

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@marshallward marshallward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a surprising number of tau_mag/ustar updates with unnecessary if (associate() blocks inside of them. Although the local value of tau_mag is used to compute ustar, it does potentially impact the performance on platforms with poor branch prediction.

There are also instances of such loops which have the stress magnitude nested inside of the expression for ustar. At the very least, there is some inconsistency here.

Although I am unsure about the frequency of this function call and the overall impact on performance, I would recommend rewriting these loops to avoid such if-blocks within the loops.

  Modified MOM_surface_forcing_gfdl.F90 and  MOM_surface_forcing.F90 to allocate
either ustar or tau_mag, but not both, in the forcing and mech_forcing types,
depending on whether the model is in Boussinesq mode.  Also added tests to
convert_IOB_to_forces in the FMS_cap code and to routines in MOM_surface_forcing
in the solo_driver code to ensure that only arrays that are associated are set.
All answers are bitwise identical, but checksum statements for the unused arrays
are eliminated when DEBUG = True.
@Hallberg-NOAA
Copy link
Member Author

I have revised this PR to move all of the if (associated()) checks outside of the i- and j- do loops, as suggested in the review of the original version by @marshallward.

Copy link
Member

@marshallward marshallward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks more consistent now.

@marshallward
Copy link
Member

Gaea regression: https://gitlab.gfdl.noaa.gov/ogrp/MOM6/-/pipelines/20777 ✔️

@marshallward marshallward merged commit 3ef5b93 into NOAA-GFDL:dev/gfdl Sep 28, 2023
@Hallberg-NOAA Hallberg-NOAA deleted the ustar_or_taumag branch November 8, 2023 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants