Open lukashergt opened 3 years ago
Hi @lukashergt ,
this is interesting. I have seen a similar issue in the context of energy injection with class v3.0.0
and I know exactly what goes wrong here. For your parameter combination, some, if not all, entries of the DE system that will be evolved by ndf15
contain a NaN
such that the calculation that determines the value of nj_ws->Rowmax[j]
fails and it leaves nj_ws->Rowmax[j]
uninitialised such that you go out of bounds of the nj_ws->ydel_Fdel
array and you access random data.
This can be fixed by explicitly checking the derivatives and throwing an error if they are ill-defined.
Best, Patrick
Hi @pstoecker and @lukashergt,
I tried reproducing this issue to see if my fix over at https://github.com/GambitBSM/gambit/issues/278 worked here. I couldn't reproduce the issue with either of these:
In a discussion with Lukas, we pinned down the following:
H_0
from 100*theta_s
.ndf15
are ran. For these parameters, we get a shrinking H
, and it trickles down from some enormous value all the way to nearly 0. NaN
s for all background variables. On my system(s), it doesn't, although I'm doubtful the H
I'm getting is correct.shooting failed
error message, but the error is delayed until later:
/ If shooting fails, postpone error to background module to play nice with MontePython. /
shooting failed
error message is only visible with my fix implemented, otherwise we get a segmentation fault.I'm going to look into
H
CLASS starts shooting from is unnecessarily large.But this discussion makes me more certain that the patch will not rule out valid points in parameter space - we definitely want to avoid that happening.
OK, I see.
I think there are two issues to fix here. The first thing is that ndf15
has to be fixed such that it throws an error whenever the derivatives are ill-defined. This should be independent of the question whether the parameter is actually fine and just due to some weird (system-dependent) computational issue the problem arises. Therefore it would be good if we could try your fix from GambitBSM/gambit#278 here
The other thing is the particular issue that is happening here. Also on my system (ubuntu 18.04, gcc 7.5) this particular parameter point does not crash. I haven't checked the results though but I guess that I will see a similar doubtful value of H. Given your explanation, I agree that this needs some investigation.
Ah, I should've been more clear - we tried the fix from https://github.com/GambitBSM/gambit/issues/278 and it successfully avoids the seg fault, so CLASS fails in a more elegant way and doesn't disrupt the MCMC chains.
Hi @fruzsinaagocs and @pstoecker, thanks for both your inputs that was very helpful. The ndf15-fix definitely proved useful in some cases.
I found another issue, though, that relates to this particular case and to curvature runs in general. The following lines in source/background.c
have been commented out:
/** - control that cosmological parameter values make sense, otherwise inform user */
/* H0 in Mpc^{-1} */
/* Many users asked for this test to be supressed. It is commented out. */
/*class_test((pba->H0 < _H0_SMALL_)||(pba->H0 > _H0_BIG_),
pba->error_message,
"H0=%g out of bounds (%g<H0<%g) \n",pba->H0,_H0_SMALL_,_H0_BIG_);*/
This test is important to filter out cases such as collapsing universes. I don't know why "many users asked for this test to be suppressed", but there are definitely situations where these are relevant. Maybe an approach similar to CAMB would be useful, where you are allowed to set a viable H0 range, maybe with the additional option of leaving it unspecified?
The following parameter set causes a
Segmentation fault
in the'background'
module (both python wrapper and command line call to CLASS):Example python script to reproduce the error:
I've chased it down to line
1355
intools/evolver_ndf15.c
:nj_ws->Rowmax[j]
returns some random number, so I guessj
overshoots theRowmax
array somehow. I'm a bit lost with all these indices. Can anyone else reproduce this? Anybody an idea what might be going wrong here?Versions: