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
SEGFAULT or SIGFPE at src/tools/SwitchingFunction.cpp:188. #210
Comments
@GiovanniBussi could you, please, take a look on this? Thanks! |
Hi, thanks for reporting this issue and finding a solution as well. Could you please try if the following fix works as well? --- a/src/tools/SwitchingFunction.cpp
+++ b/src/tools/SwitchingFunction.cpp
@@ -185,7 +185,7 @@ void SwitchingFunction::set(const std::string & definition,std::string& errormsg
present=Tools::findKeyword(data,"D_MAX");
if(present && !Tools::parse(data,"D_MAX",dmax)) errormsg="could not parse D_MAX";
- dmax_2=dmax*dmax;
+ if(dmax<std::sqrt(std::numeric_limits<double>::max())) dmax_2=dmax*dmax;
bool dostretch=false;
Tools::parseFlag(data,"STRETCH",dostretch); // this is ignored now
dostretch=true; I would prefer this change since it can be backported to v2.2 which is still maintained. Thanks again! Giovanni |
Yes of course. Give me a while and I'll test it. |
@GiovanniBussi, patch applied, and compiled OK. I've sent a job. When it starts to run I'll see how it goes. Best regards, |
Job running, and working. Could you please apply this patch into the master (and any other branch needed)? Thanks! |
Merged now. Thanks to you Giovanni |
When running a gromacs 5.1.4, with plumed 2.3.0 and hrex, and matheval 1.1.11.
In the case this line:
dmax_2=dmax*dmax;
is executed withdmax=std::numeric_limits<double>::max();
thendmax_2
has a value similar tostd::numeric_limits<double>::infinity();
but in some processors like Intel(R) Xeon(R) CPU E5-2670 when the code is compiled with Intel Compilers (in my case 2017.0.098) this multiplication (that is beyond the representable double values) throws a SEGFAULT (when compiled with -O3, release compilation) of a SIGFPE (when compiled with -O0 -g, debug compilation).Applying this patch:
with
patch -p0 < plumed.patch
solves the gromacs signal failure. I have tested this patch with gromacs and input files that caused a failure, and it worked OK. The results were OK.Please, confirm the patch is correct, so I can apply it in a production environment. Merge the patch into your code if you think it is OK. If not OK, please, give me details on how to fix this error.
Thanks in advance,
Carlos.
The text was updated successfully, but these errors were encountered: