-
Notifications
You must be signed in to change notification settings - Fork 131
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
Unelegant crash writing initial condition when 'histfreq' is more frequent then any 'f_*' output variable #521
Comments
I'll take responsibility for this one. |
#548 may address this in part. |
I am not able to duplicate this error with either the intel or gnu compiler even with debug flags on on the current code. I propose we close this and assume some of the recent fixes addressed the problem. @phil-blain, do you want to run a quick test again to see if you are still seeing the problem with the current master? |
Yes I'll check again. I've just submitted a quick run. |
I confirm that I can't reproduce with the steps in the description. Bug fixed itself :P Let's close then. |
Thanks @phil-blain ! Closing the issue. |
Thanks @phil-blain for confirming. |
I just had this issue again, relaunching the exact same case as two weeks ago... I guess it depends on the state of the memory on the system... I could not find a core dump though....
The call to
And again it crashed at the same place, the first use of CICE/cicecore/cicedynB/analysis/ice_history.F90 Line 1903 in 2a692af
|
Let me take a look at this again. Just sounds like there needs to be another if condition. Dave |
I'm guessing it's the logic in CICE/cicecore/cicedynB/analysis/ice_history_shared.F90 Lines 781 to 796 in 6e89728
I think the code does not enter that So when we arrive here in CICE/cicecore/cicedynB/analysis/ice_history.F90 Lines 1647 to 1653 in 6e89728
the array is not allocated at all... |
I think the issue is with the check: if (f_hi(1:1) /= 'x') I think this should be f_hi(ns:ns). When I implemented this originally, I was checking to make sure at least the first stream was set. Can you send me your namelist values from ice_in that generate this crash? These should be: histfreq, histfreq_n, and f_hi Dave |
Yes, sure. histfreq = 'd','x','x','x','x'
histfreq_n = 1 , 1 , 1 , 1 , 1
f_hi = 'm' |
I am beginning to see the problem now. The first stream here is daily, but the variable specification is indicating monthly. Because the check only makes sure that the first character of f_hi is not 'x', then it tries to do something. However, a2D is not defined for a monthly stream. I think I can add a more graceful warning message here. |
Ok. I have a fix in place and I will submit a PR soon. It is actually more involved than just a warning message. I changed the checks for accumulating the variables to be: if (f_hi(ns:ns) == histfreq(ns)) then This makes sure that the character in the string for f_hi matches up with the stream you are averaging on. I also have a check that prints a warning if there are no fields going to the history files. |
So, this strategy was flawed. The accum_hist_field subroutine has a loop internally that goes over all streams. My new fix is to check if a2D, a3Dc, etc. are allocated or not. Then it will skip over the accum_hist_calls. However, I did find something curious that I am looking at. Say the namelist is set as: histfreq = 'd','x','x','x','x' f_hi = 'mdxxx' This still writes hi to the daily stream even though the d is in the second place for f_hi. I feel like this should not work and I am trying to figure out why. |
That example should work, in my opinion -- if you have a 'd' in both places, you'd expect the variable to be written. If it were writing monthly output, then there's a problem. Also my opinion: the extra 'x's shouldn't be necessary. The order that the frequencies appear in these lists shouldn't matter, although I know the first one is 'special' in that the file names are formatted differently for the others. |
I guess I was concerned that you might not be doing the averaging interval correctly if it is in a different order. However it does look like it does the correct thing. It checks for avail_hist_fields(n)%vhistfreq == histfreq(ns). So, that as long as there is something on one of the streams that matches the vhistfreq for the variable, it should be good to go. I guess I will submit what I have to fix the crash when the a2D, a3Dc, etc. arrays are not allocated. Interestingly, some of the ice_history_*.F90 tracer routines did have this check, but it was not in ice_history.F90. |
I agree the x should be treated the same as a blank. It also should not matter what order they are for an individual field (this is being tested now). Finally, I think an x in the first slot ('xdmxx') should not lead to skipping the d and m. The order of the streams defined by histfreq should not require any alignment with the active streams specified by the fields. I think that's almost the case now (except for maybe a leading "x"). |
I noticed that if I change
histfreq
tod
or1
in the namelist, and I don't change nothing else from the defaults (i.e. allf_*
output variables are either set to'm'
or'x'
), then the model crashes very inelegantly inaccum_hist
when called incice_init
to write the initial condition.Here is the backtrace from the Intel compiler runtime (code compiled with
-traceback
):The call to
accum_hist
is here:CICE/cicecore/drivers/standalone/cice/CICE_InitMod.F90
Line 224 in e662c79
And this is the line where it crashes:
CICE/cicecore/cicedynB/analysis/ice_history.F90
Line 1893 in e662c79
It's not super important, but it's a little bit disconcerting. I think we could improve that and abort early, with a message like:
or something like that... at least we should not cause a runtime crash like this.
The text was updated successfully, but these errors were encountered: