You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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](https://gcc.gnu.org/onlinedocs/gfortran/intrinsic-procedures/newline.html)).
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
```
What is the feature/what would you like to discuss?
As @nusbaume pointed out in #274 ,
allocate()
can now return an error message!Adding an optional argument to check_allocate will allow us to pass that new message in and print that message when we endrun.
Is there anyone in particular you want to be part of this conversation?
No response
Will this change (regression test) answers?
No
Will you be implementing this enhancement yourself?
Any Software Engineer can do this
The text was updated successfully, but these errors were encountered: