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

+Gracefully handle longer input parameter lines #89

Merged

Conversation

Hallberg-NOAA
Copy link
Member

This PR is a series of commits that will enable to MOM6 to handle much longer
input parameter lines, of up to 1000 characters in a single line, and with no
limit for lines with continuation. This required the addition of a new internal
function and type, but all changes are private to the MOM_file_parser module.
This PR addresses the problems noted in MOM6 issue #75, which can be closed once
this PR is accepted. All answers and output are bitwise identical in any cases
that worked before.

The commits in this PR include:

  • 11328d440 Set INPUT_STR_LENGTH to 1024
  • 5ee5daee3 Reduce the populate_param_data memory footprint
  • eb677ebd8 Support arbitrarily long parameter spec lines
  • f4dfb9648 +Better multi-line parameter specification handling

  Added the ability to detect and handle multiline parameter specifications that
are longer than INPUT_STR_LENGTH after the lines have been concatenated.  Many
instances where character strings are set to length INPUT_STR_LENGTH are
replaced by param_file_type%max_line_len.  This commit partially addresses MOM6
issue mom-ocean#75.  All answers and output are bitwise identical in cases that worked
previously, but there is a new element in the publicly visible param_file_type,
and some cases where there had previously been errors due to very long input
specification may now work.
  Make the lines of the param_file_type individually allocatable to support
arbitrarily long input lines.  This required the introduction of a new private
type to hold the actual allocatable array, so the lines are now an array of this
type.  All answers are bitwise identical.
  Use a character buffer to minimize the memory footprint associated with
reading the input parameters on root_PE and broadcasting it to all PEs.  All
answers are bitwise identical.
  Now that INPUT_STR_LENGTH is only used as the size of a single temporary
character string, the maximum permitted line length can be increased to a larger
value without unduly impacting the memory footprint of the model, so it has been
increased to 1024.  If this is not large enough, considering that MOM6 also
supports line continuation, there is a bigger problem than this limit.  Some
message strings were also changed to be allocatable, while others have sizes
that are set using param_file_type%max_line_len.  Also eliminated the hard-coded
internal parameter all_PEs_read, which had a note that it should have been
eliminated in about 2010 (before MOM6 existed).  All answers and output are
bitwise identical.
@andrew-c-ross
Copy link

Thanks for working on this. I tried out the PR with my full Northwest Atlantic setup and can confirm it works as expected.

@codecov
Copy link

codecov bot commented Mar 25, 2022

Codecov Report

Merging #89 (c491fdd) into dev/gfdl (8bf9abb) will increase coverage by 0.03%.
The diff coverage is 73.68%.

❗ Current head c491fdd differs from pull request most recent head 585f1ed. Consider uploading reports for the commit 585f1ed to get more accurate results

@@             Coverage Diff              @@
##           dev/gfdl      #89      +/-   ##
============================================
+ Coverage     28.99%   29.02%   +0.03%     
============================================
  Files           245      245              
  Lines         72177    72223      +46     
============================================
+ Hits          20925    20962      +37     
- Misses        51252    51261       +9     
Impacted Files Coverage Δ
src/framework/MOM_file_parser.F90 63.93% <73.68%> (+1.10%) ⬆️
src/framework/MOM_get_input.F90 74.28% <0.00%> (-0.72%) ⬇️
src/tracer/MOM_tracer_flow_control.F90 52.61% <0.00%> (-0.20%) ⬇️
src/core/MOM.F90 58.41% <0.00%> (-0.03%) ⬇️
src/ocean_data_assim/MOM_oda_driver.F90 0.00% <0.00%> (ø)
config_src/infra/FMS1/MOM_coms_infra.F90 43.36% <0.00%> (+1.62%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8bf9abb...585f1ed. Read the comment docs.

@marshallward
Copy link
Member

marshallward commented Mar 28, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

INPUT_STR_LENGTH is too short for many open boundary segment data specifications
3 participants