Login  Register

Re: Fwd: Re: QuantLib-1.8 | vc14 | AdaptiveRungeKutta testsuite error

Posted by Ivan A. Cherkasov on Sep 09, 2016; 5:11am
URL: http://quantlib.414.s1.nabble.com/QuantLib-1-8-vc14-AdaptiveRungeKutta-testsuite-error-tp17619p17709.html

3rd attempt, SF blocks attachments.

It failed. Supposedly some other function gets messed up by inline expansion and that was caught accidentally by the RK test case. Or compiler ignores the declspec.

 
 
--- ./ql18_vc2015_mk2/QuantLib-1.8/ql/math/ode/adaptiverungekutta.hpp       2015-12-21 13:46:03.000000000 +0300
+++ ./ql18_vc2015_mk3/QuantLib-1.8/ql/math/ode/adaptiverungekutta.hpp    2016-09-08 19:46:27.359406500 +0300
@@ -161,7 +161,7 @@
     }
     template<class T>
-    T AdaptiveRungeKutta<T>::operator()(const OdeFct1d& ode,
+             __declspec(noinline) T AdaptiveRungeKutta<T>::operator()(const OdeFct1d& ode,
                                         const T y1,
                                         const Real x1,
                                         const Real x2) {
@@ -170,7 +170,7 @@
     }
     template<class T>
-    void AdaptiveRungeKutta<T>::rkqs(std::vector<T>& y,
+             __declspec(noinline) void AdaptiveRungeKutta<T>::rkqs(std::vector<T>& y,
                                      const std::vector<T>& dydx,
                                      Real& x,
                                      const Real htry,
@@ -213,7 +213,7 @@
     }
     template <class T>
-    void AdaptiveRungeKutta<T>::rkck(const std::vector<T>& y,
+             __declspec(noinline) void AdaptiveRungeKutta<T>::rkck(const std::vector<T>& y,
                                      const std::vector<T>& dydx,
                                      Real x,
                                      const Real h,
 
 
^C:\TMP\QL18_VC2015_MK3\QUANTLIB-1.8\TEST-SUITE\QUANTLIBTESTSUITE.CPP
/c /IC:\BIN\BOOST_1_61_0 /I.. /Zi /nologo /W3 /WX- /O2 /Ob2 /Ot /D NDEBUG /D WIN32 /D _CONSOLE /D _SCL_SECURE_NO_DEPRECATE /D _CRT_SECURE_NO_DEPRECATE /D _MBCS /GF /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo".\BUILD\VC140\X64\RELEASE\\" /Fd".\BUILD\VC140\X64\RELEASE\VC140.PDB" /Gd /TP C:\TMP\QL18_VC2015_MK3\QUANTLIB-1.8\TEST-SUITE\QUANTLIBTESTSUITE.CPP
 
 
 
  Testing adaptive Runge Kutta...
unknown location : fatal error : in "QuantLib test suite/ode tests/QuantLib::detail::quantlib_test_case(&OdeTest::testAdaptiveRungeKutta)": class QuantLib::Error: Stepsize (3.1414) underflow in AdaptiveRungeKutta::rkqs
  c:\tmp\ql18_vc2015_mk3\quantlib-1.8\test-suite\utilities.hpp(74): last checkpoint
  Testing matrix exponential based on ode...
unknown location : fatal error : in "QuantLib test suite/ode tests/QuantLib::detail::quantlib_test_case(&OdeTest::testMatrixExponential)": class QuantLib::Error: Too many steps (10000) in AdaptiveRungeKutta
  c:\tmp\ql18_vc2015_mk3\quantlib-1.8\test-suite\utilities.hpp(74): last checkpoint
  Testing matrix exponential of a zero matrix based on ode...
 

On Sep 9, 2016 10:15 AM, "Ivan A. Cherkasov" <[hidden email]> wrote:
---------- Forwarded message ----------
From: "Ivan A. Cherkasov" <[hidden email]>
Date: Sep 9, 2016 10:10 AM
Subject: Re: [Quantlib-dev] QuantLib-1.8 | vc14 | AdaptiveRungeKutta testsuite error
To: "Peter Caspers" <[hidden email]>
Cc: <[hidden email]>, "Luigi Ballabio" <[hidden email]>

Hello.
It failed. Please see the attached files.

Supposedly some other function gets messed up by inline expansion and that was caught accidentally by the RK test case. Or compiler ignores the declspec.

On Sep 8, 2016 4:44 PM, "Peter Caspers" <[hidden email]> wrote:
Yes. Ivan, could you try to put

__declspec(noinline)

before the rkqs and rkck and operator() functions and see if it works then?

On 08 Sep 2016, at 14:22, Luigi Ballabio <[hidden email]> wrote:

Except it's not good if VC14 fails in the default configuration...


On Thu, Sep 8, 2016 at 2:19 PM Peter Caspers <[hidden email]> wrote:
Hi,

I don’t see an issue with /Ob2 on VC12. This all looks like a bug in the VC14 - code optimization to me, nothing we can (or should) really fix in the code?

Regards
Peter

On 08 Sep 2016, at 09:19, Ivan A. Cherkasov <[hidden email]> wrote:

Hello.
 
This failed for me (CL.command.1.tlog):
 
^C:\TMP\QL18_VC2015\REPRO_RK\REPRO_RK.CPP
/c /IC:\BIN\BOOST_1_61_0 /I"C:\TMP\QL18_VC2015\QUANTLIB-1.8" /Zi /nologo /W3 /WX- /sdl /O2 /Oi /GL /D NDEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"X64\RELEASE\\" /Fd"X64\RELEASE\VC140.PDB" /Gd /TP C:\TMP\QL18_VC2015\REPRO_RK\REPRO_RK.CPP
 
This worked for me:
 
^C:\TMP\QL18_VC2015\REPRO_RK\REPRO_RK.CPP
/c /IC:\BIN\BOOST_1_61_0 /I"C:\TMP\QL18_VC2015\QUANTLIB-1.8" /Zi /nologo /W3 /WX- /sdl /O2 /Ob0 /Ot /D NDEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"X64\RELEASE\\" /Fd"X64\RELEASE\VC140.PDB" /Gd /TP C:\TMP\QL18_VC2015\REPRO_RK\REPRO_RK.CPP
 
I’m using “Version 14.0.25422.01 Update 3”.
 
I rebuilt from scratch using QuantLib-1.8.tar.gz and QuantLib_vc14.sln, the only thing I changed in the project settings is the C/C++ -> Optimization -> Inline Function Expansion = Disabled (/Ob0). It succeeded, test suite log attached.

On Sep 7, 2016 10:00 PM, "Peter Caspers" <[hidden email]> wrote:
Can you post the full compiler command line (you find that under C++ / Command Line), I can not provoke the error no matter what optimization flags I use

/FR".\build\vc120\x64\Release\" /GS /W3 /Gy /Zc:wchar_t /I"..\.." /Zi /Gm- /Ox /Ob2 /Fd".\build\vc120\x64\Release\" /fp:fast /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_SCL_SECURE_NO_DEPRECATE" /D "_CRT_SECURE_NO_DEPRECATE" /D "_MBCS" /fp:except /errorReport:prompt /GF /WX- /Zc:forScope /GR /Gd /MD /Fa".\build\vc120\x64\Release\" /EHsc /nologo /Fo".\build\vc120\x64\Release\" /Ot /Fp".\build\vc120\x64\Release\BermudanSwaption.pch” 
On 07 Sep 2016, at 19:59, Ivan A. Cherkasov <[hidden email]> wrote:

Also works with /O2 /Ob0 (w/o inlines)



<testsuite.log>

------------------------------------------------------------------------------
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev


------------------------------------------------------------------------------

_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev