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

Add errmsg to check_allocate abort message #311

Open
wants to merge 3 commits into
base: development
Choose a base branch
from

Conversation

jimmielin
Copy link
Member

Fixes #297

Following up from the tropopause_find PR I've updated check_allocate to take in errmsg and updated the tropopause_climo_read to use it and other places within SIMA. I did not update all instances of check_allocate, particularly those in dynamics and in cpl/nuopc as I was not sure if they were brought in externally or not.

If the optional errmsg argument is present a linebreak is added to the end of the abort message using the new_line intrinsic (Fortran 2003). Since errmsg in allocate is a F2003 feature I think this is safe to use? It can otherwise be removed, it's just used to make the output prettier.

This is what it looks like:

 ERROR: cam_thermo_init: Allocate of 'test(test)' failed with code 1. Memory highwater is     641.32 mb, current memory usage is      42.41 mb
Allocation failed with: Hello world this is not really a failure but just a test at /somewhere/CAM-SIMA/src/data/cam_thermo.F90:203

or an actual example made possible by a duplicate allocation...

 ERROR: cam_thermo_init: Allocate of 'kmcnd(pcols,pverp)--2test' failed with code 5014. Memory highwater is     641.35 mb, current memory usage is      43.08 mb
Allocation failed with: Attempt to allocate an allocated object at /somewhere/CAM-SIMA/src/data/cam_thermo.F90:207

@jimmielin jimmielin added the enhancement New feature or request label Oct 8, 2024
@jimmielin jimmielin self-assigned this Oct 8, 2024
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
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant