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

Move file parser inquire calls to root PE #419

Merged

Conversation

marshallward
Copy link
Member

MOM_file_parser's open_param_file() contains explicit inquire() calls when assessing the correctness of opening such a file. As written, these could be called by any rank, and are not thread safe. In rare cases (usually related to testing), this would cause a race condition and raise an error.

Even ignoring the errors, it is probably better if only one rank makes these calls, rather than all of them.

The following patch modifies the function so that only root PE invokes inquire().

There is not much to celebrate about this patch; it does not try to clean up the intrinsic weirdness of the IO handling. But it does appear to fix some of the most apparent problems.

@marshallward
Copy link
Member Author

I believe this will fix the error described in #189, which has become frustratingly common lately.

@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Merging #419 (b681c40) into dev/gfdl (fd31e01) will increase coverage by 0.00%.
The diff coverage is 83.33%.

❗ Current head b681c40 differs from pull request most recent head 45bf529. Consider uploading reports for the commit 45bf529 to get more accurate results

@@            Coverage Diff            @@
##           dev/gfdl     #419   +/-   ##
=========================================
  Coverage     38.07%   38.08%           
=========================================
  Files           269      269           
  Lines         76957    76959    +2     
  Branches      14204    14206    +2     
=========================================
+ Hits          29305    29306    +1     
  Misses        42340    42340           
- Partials       5312     5313    +1     
Files Changed Coverage Δ
src/framework/MOM_file_parser.F90 90.47% <83.33%> (-0.10%) ⬇️

... and 1 file with indirect coverage changes

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

Copy link
Member

@Hallberg-NOAA Hallberg-NOAA left a comment

Choose a reason for hiding this comment

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

These changes are a good idea, and they should be beneficial or benign in all cases.

MOM_file_parser's open_param_file() contains explicit inquire() calls
when assessing the correctness of opening such a file.  As written,
these could be called by any rank, and are not thread safe.  In rare
cases (usually related to testing), this would cause a race condition
and raise an error.

Even ignoring the errors, it is probably better if only one rank makes
these calls, rather than all of them.

The following patch modifies the function so that only root PE invokes
inquire().

There is not much to celebrate about this patch; it does not try to
clean up the intrinsic weirdness of the IO handling.  But it does appear
to fix some of the most apparent problems.
@Hallberg-NOAA
Copy link
Member

This PR has passed pipeline testing at https://gitlab.gfdl.noaa.gov/ogrp/MOM6/-/pipelines/20164.

@Hallberg-NOAA Hallberg-NOAA merged commit 45cd5c6 into NOAA-GFDL:dev/gfdl Aug 5, 2023
10 checks passed
@marshallward marshallward deleted the file_parser_inquire_parallel branch May 8, 2024 14:54
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