Fix seg fault from ndf15 evolver in #419#423
Fix seg fault from ndf15 evolver in #419#423fruzsinaagocs wants to merge 1 commit intolesgourg:masterfrom
Conversation
There was a problem hiding this comment.
Dear Fruszina,
I think this in general is a good idea, except that when we do the optimization strategy in the Makefile, usually such a check of "x!=x" would be removed by the option "--fast-math" that we had in our Makefile for a long time. As such, I would like to also request the opinion of
@ThomasTram about this, and what he thinks of such a NaN check, especially given that he wrote the ndf15.c evolver.
EDIT: I think we would also need to re-implement this as an issue in the current development branch of CLASS to make sure it gets all the proper tests etc.
Cheers!
|
Hi Nils, Thanks for the quick response! That's completely true, unfortunately the |
|
Thanks for the heads-up on this Nils. This could really lead to problems. How about using |
|
Unfortunately |
|
OK I see. if I guess that this is actually the reason why this particular flag is never included when we compile C/C++ codes in gambit with gcc. Seeing as The question, however, is whether we will have to give up speed in doing so. |
|
Thanks for looking into this! I don't like --fast-math either, we should test how much of a speed difference it really makes. (Also perhaps for a subset of them, lige suggested by @pstoecker ) This seems like something that could be done with a little bit of bash-scripting. However, perhaps the fix could be made more robust: there must be some index calculation that fails with NaNs, but that can be fixed in such a way that it works regardless of --fast-math. Do you happen to have an .ini file that generates a segmentation-fault? Cheers, |
|
Hi everyone, It's been a while since this thread was active, but I wanted to ask if there are any plans to merge this fix (or perhaps a more robust version, as suggested by @ThomasTram) into newer versions of CLASS. Also especially since I was encountering segmentation faults on Thanks for all the work maintaining this code! |
This PR fixes a possible segmentation fault arising from
NaNvalues being passed to thenumjacfunction of the ndf15 numerical solver when asking for the relevant derivatives (i.e. the right-hand-side of the differential equation being solved). I perform aclass_testwhenever the relevant function calculating the derivatives,*derivs, is called, so CLASS throws a more informative error, and doesn't break when called in a loop as part of an MCMC chain.This fixes #419, where a shooting error is delayed until the background module, but is never actually thrown because the segmentation error occurs first. It also fixes an issue encountered in GAMBIT (https://github.com/GambitBSM), where an unphysical point in the MCMC parameter space causes one or more of the differential equations involved to be ill-defined.