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

missing registered fields in diag_field_log.out #1496

Closed
rem1776 opened this issue Apr 24, 2024 · 7 comments · Fixed by #1497
Closed

missing registered fields in diag_field_log.out #1496

rem1776 opened this issue Apr 24, 2024 · 7 comments · Fixed by #1497
Assignees

Comments

@rem1776
Copy link
Contributor

rem1776 commented Apr 24, 2024

Describe the bug
The diag_manager has a nml variable that will create a output log of all register_*_field calls, but during SPEAR runs the output log is missing some register calls in the FV3 code.

To Reproduce
Run the spear regression xml with do_diag_field_log set to true in the diag_manager namelist.

Expected behavior
the log should have every registered field.

System Environment
gaea c5 with intel23-classic

Additional context
It seems like the mom code is likely the culprit. i had the code print the pe for every write to the log, mom starts calling with a different root pe and that seems to erase whatever was in the file up to that point.

Thanks @wfcooke for spotting this!

@thomas-robinson
Copy link
Member

@marshallward is there a MOM wrapper for this?

@wfcooke
Copy link

wfcooke commented Apr 25, 2024 via email

@marshallward
Copy link
Member

I'm not familiar with this feature but I am looking at it now.

It seems like this is all handled within register_static_field and enabled by the do_diag_field_log in diag_manager_nml. I would guess that MOM does not control any of this?

@marshallward
Copy link
Member

@wfcooke I was under the impression that available_diags.* was a MOM6 product separate from the diag manager. (i.e. it is created by the "diag mediatior" which uses the FMS diag manager).

Your explanation seems plausible, although I always had the impression that MOM6 was using the same diag manager as the other components. (That is, all submodels were using the same module-level variables.)

@wfcooke
Copy link

wfcooke commented Apr 25, 2024 via email

@rem1776
Copy link
Contributor Author

rem1776 commented Apr 25, 2024

@wfcooke Yeah I believe thats the problem. The ATM root pe opens the file, and then the OCN root pe opens it again as a new file when it calls diag_manager_init.

I have a PR in (#1497) to include the root pe number at the end of the filename, similar to what we do with logfile.out. My first thought was to just open it in append mode as well, but as Rusty pointed out this way we won't run into any race conditions from two root pe's writing to the same file.

@marshallward
Copy link
Member

marshallward commented Apr 25, 2024

You could just check if the file has already been opened before reopening creating it. There is still a slight possibility of a TOCTOU race condition, but it would be much safer than the current approach.

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 a pull request may close this issue.

4 participants