Closed dpinte closed 10 years ago
I have a build that works under MSVC 2008 for my pybg project, which uses part of pyql, but there are still problems. It compiles, links and runs, but QuantLib's Settings singleton is not a singleton under MSVC--the instance created in each module has a different address and not all have the same values.
This is way beyond my level of expertise, so I'm curious if anyone has any insights.
Also, should mention the changes I had to make included stripping out the distutils directives from the code--they override MSVC's auto-linking, causing it to look for an non-existent QuantLib.lib, instead of the standard QuantLib-vc90-mt.lib created when you build QuantLib with MSVC.
Thanks for the report. This is a known issue with MSVC and mingw/gcc on Windows. We had the very same problem with some previous Ubuntu versions that were solved by preloading the shared library. I am investigating and want to have a robust solution soon
Similar to bondgeek:
After running the tests, the following fail:
test_bonds.py (fail 2, skip 1)
FFs
======================================================================
FAIL: test_excel_example_with_fixed_rate_bond (__main__.BondTestCase)
Port the QuantLib Excel adding bond example to Python.
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\smalov\workspace\stas_sandbox\test\test_bonds.py", line 184, in test_excel_example_with_fixed_rate_bond
calendar.advance(todays_date, 3, Days), bond.settlement_date()
AssertionError: 30/08/2011 != 5/12/2012
======================================================================
FAIL: test_excel_example_with_zero_coupon_bond (__main__.BondTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\smalov\workspace\stas_sandbox\test\test_bonds.py", line 224, in test_excel_example_with_zero_coupon_bond
calendar.advance(todays_date, 3, Days), bond.settlement_date()
AssertionError: 30/08/2011 != 5/12/2012
----------------------------------------------------------------------
Ran 3 tests in 0.001s
FAILED (failures=2, skipped=1)
test_heston_model.py (fail 1)
F...
======================================================================
FAIL: test_DAX_calibration (__main__.HestonModelTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\smalov\workspace\stas_sandbox\test\test_heston_model.py", line 225, in test_DAX_calibration
self.assertAlmostEquals(expected, sse, delta=1.0)
AssertionError: 177.2 != 103062.59612570431 within 1.0 delta
----------------------------------------------------------------------
Ran 4 tests in 1.071s
FAILED (failures=1)
test_mlab.py (fail 1)
.E
======================================================================
ERROR: test_option_to_rate (__main__.OptionPricerTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\smalov\workspace\stas_sandbox\test\test_mlab.py", line 17, in test_option_to_rate
os.path.join('quantlib', 'test','data','df_SPX_24jan2011.pkl')
File "C:\Python27\lib\site-packages\pandas\core\common.py", line 830, in load
f = open(path, 'rb')
IOError: [Errno 2] No such file or directory: 'quantlib\\test\\data\\df_SPX_24jan2011.pkl'
----------------------------------------------------------------------
Ran 2 tests in 0.009s
FAILED (errors=1)
test_piecewise_yield_curve.py (fail 1)
..F.
======================================================================
FAIL: test_deposit_swap (__main__.PiecewiseYieldCurveTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\smalov\workspace\stas_sandbox\test\test_piecewise_yield_curve.py", line 201, in test_deposit_swap
ts.discount(calendar.advance(todays_date, 2, Years)),3)
AssertionError: 0.9103 != 0.9126920284652297 within 3 places
----------------------------------------------------------------------
Ran 4 tests in 0.010s
FAILED (failures=1)
test_vanilla_option.py (fail 3)
FF.F.
======================================================================
FAIL: test_american_vanilla_option (__main__.VanillaOptionTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\smalov\workspace\stas_sandbox\test\test_vanilla_option.py", line 121, in test_american_vanilla_option
self.assertAlmostEquals(4.459628, american_option.net_present_value, 6)
AssertionError: 4.459628 != 0.0 within 6 places
======================================================================
FAIL: test_american_vanilla_option_with_earliest_date (__main__.VanillaOptionTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\smalov\workspace\stas_sandbox\test\test_vanilla_option.py", line 137, in test_american_vanilla_option_with_earliest_date
self.assertAlmostEquals(4.459628, american_option.net_present_value, 6)
AssertionError: 4.459628 != 0.0 within 6 places
======================================================================
FAIL: test_european_vanilla_option_usage (__main__.VanillaOptionTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\smalov\workspace\stas_sandbox\test\test_vanilla_option.py", line 108, in test_european_vanilla_option_usage
self.assertAlmostEquals(3.844308, european_option.net_present_value, 6)
AssertionError: 3.844308 != 0.0 within 6 places
----------------------------------------------------------------------
Ran 5 tests in 0.002s
FAILED (failures=3)
Thanks for the report. Just to confirm, those are mostly issues related to the QuantLib::Settings singleton ...
Will you guys be able to provide a windows binary for this, or a way to do a clean install in Windows 7?
@iceman: no real timeline so far but if somebody really need this, we could prioritize and solve the issue.
Not sure if one vote would count but I definitely need this.
Every single vote counts ;-) This is an annoying bug. I'll try to get some time to look at it in the coming weeks.
Much appreciated. I am looking forward to it.
Even better if the binaries could be hosted on Chris Goehlke's Windows binaries page for us unsophisticated users who are not good at compiler tweaking.
Please keep us posted.
I want to throw in my vote too. I regularly come in check to see if the windows build is fixed. I really need this as well.
So I am guessing this didn't get enough votes...you can add mine.
@RayVR I am working on it in my spare time. It is a nightmare ;-) The Settings singleton is causing way more pain than it should.
Have you spoken with any of the QuantLib developers about a change on their side? (This question is coming from complete ignorance about the nature of the problem)
On Mar 14, 2014, at 7:00 AM, Didrik Pinte notifications@github.com wrote:
@RayVR I am working on it in my spare time. It is a nightmare ;-) The Settings singleton is causing way more pain than it should.
\ Reply to this email directly or view it on GitHub.
@RayVR the key problem is more how we link things on the Windows side. I'll ping the QL mailing list and see if somebody else on Windows have the same kind of issue. I haven't found anything about it in the archives
is a segfault while running the tests the expected symptom of this issue or is that unrelated?
@RayVR No, the test suite runs without segfault. The problem is that the Settings singleton seem to have multiple instances ... This means that if you set your evaluation date two month in the past and construct a bond e.g., the bond settlement date will not be correct (should be two month ago + 3 days but will today + 3 days).
@RayVR good news, I got it to work this morning. There is a bit of work left but I'll push the fist bit of working code in the next two days to the repo.
great news. I'm using the swig wrappers right now, which give me a headache.
@RayVR I got the full test suite passing in this branch https://github.com/dpinte/pyql/tree/fix-win-build If you get a chance to give it a try, it requires MSVC 2008. I'm testing it on Mac/Linux and fix regressions and we will finally have a PR
@BlueCollarWorker @iceman273 @malos @bondgeek If you want to give a try at the fix-win-build branch and report success or failures, please do. It runs on OSX and Win-32 without problems for me. I'll merge master in this week-end.
I have taken a look at this branch but after making all the modifications to the setup file I had to make on enthought/master it still does not compile for me. I get "fatal error LNK1120: 155 unresolved externals"
@RayVR I have that solved on a branch. Will push the latest latest today.
PR #63 comes with a real solution to the issue. The entire test suite passes with no more issue with the Settings singleton.
The build fails at the moment under MSVC 2008.