Most of the bugs when running QuantLib under x64 seem to come down to
the Null template. As far as I can tell this is supposed to return the largest integer which is then interpreted as a non-set piece of data. In x64, it gets turned into a zero and this causes problems. I haven't found a solution to the issue yet. Any ideas? Mark ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Dear Mark,
these errors must be caused by the Microsoft compiler, because I don't have any problems on my linux x64 system (boost 1.37, quantlib svn). Maybe some flags have to be turn on, like fPIC on linux? Are you compiling static or dynamic libs? Unfortunately I don't have 64bit studio to test it. Best, Tamas On 16 Feb 2009, at 05:14, Mark joshi wrote: > Most of the bugs when running QuantLib under x64 seem to come down to > the Null template. > > As far as I can tell this is supposed to return the largest integer > which is then interpreted as a non-set piece of data. > In x64, it gets turned into a zero and this causes problems. I haven't > found a solution to the issue yet. > > Any ideas? > > Mark > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San > Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the > Enterprise > -Strategies to boost innovation and cut costs with open source > participation > -Receive a $600 discount off the registration fee with the source > code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > QuantLib-dev mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-dev ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Hi Mark & Tamas, It is unlikely to be a problem with flags (-fPIC is for "position independent code" so something that would come up at linking stage). If you are getting zeros as the NULL template values the most likely reason is that the template null hasn't been specialised for a type that is being used. See the file: ql/utilities/null.hpp // BN: This is the un-specialised version which returns Type() // which will be zero //! template class providing a null value for a given type. template <class Type> class Null { public: Null() {} operator Type() const { return Type(); } }; // Specialised versions follow.... I suspect you need to add a specialisation for the size_t type since on 64bit windows size_t is (I think) not the same type as unsigned int. Best, Bojan -- Bojan Nikolic || http://www.bnikolic.co.uk ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
indeed:
http://www.viva64.com/content/articles/64-bit-development/?f=PortSample.html&lang=en&content=64-bit-development Best, Tamas On 16 Feb 2009, at 08:23, Bojan Nikolic wrote: > > Hi Mark & Tamas, > > It is unlikely to be a problem with flags (-fPIC is for "position > independent code" so something that would come up at linking stage). > > If you are getting zeros as the NULL template values the most likely > reason is that the template null hasn't been specialised for a type > that is being used. See the file: > > ql/utilities/null.hpp > > // BN: This is the un-specialised version which returns Type() > // which will be zero > > //! template class providing a null value for a given type. > template <class Type> > class Null { > public: > Null() {} > operator Type() const { return Type(); } > }; > > // Specialised versions follow.... > > I suspect you need to add a specialisation for the size_t type since > on 64bit windows size_t is (I think) not the same type as unsigned > int. > > Best, > Bojan > > > > > -- > Bojan Nikolic || http://www.bnikolic.co.uk > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San > Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the > Enterprise > -Strategies to boost innovation and cut costs with open source > participation > -Receive a $600 discount off the registration fee with the source > code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > QuantLib-dev mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-dev ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
In reply to this post by Bojan Nikolic
On Mon, 2009-02-16 at 08:23 +0000, Bojan Nikolic wrote:
> If you are getting zeros as the NULL template values the most likely > reason is that the template null hasn't been specialised for a type > that is being used. True. Mark, can you run a compilation after replacing <ql/utilities/null.hpp> with the one I'm attaching? You'll get a number of errors saying that Null<T> is undefined for a few types. I'm interested in knowing for what built-in type(s) it fails. Also, is there any #define we can check to see if we're compiling for 64 bits? Luigi P.S. re the other 64-bit fix (atoi vs lexical_cast): it compiles, but it changes behavior. If the input is, say, "foo", lexical_cast raises an exception, whereas atoi quietly returns 0. I'd prefer a solution that keeps the old behavior. -- The young man knows the rules, but the old man knows the exceptions. -- O. W. Holmes ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev null.hpp (3K) Download Attachment |
I'll do some more experimenting tomorrow -- I did try specializing
Null for Size but this didn't seem to fix the problem... 2009/2/16 Luigi Ballabio <[hidden email]>: > On Mon, 2009-02-16 at 08:23 +0000, Bojan Nikolic wrote: >> If you are getting zeros as the NULL template values the most likely >> reason is that the template null hasn't been specialised for a type >> that is being used. > > True. Mark, can you run a compilation after replacing > <ql/utilities/null.hpp> with the one I'm attaching? You'll get a number > of errors saying that Null<T> is undefined for a few types. I'm > interested in knowing for what built-in type(s) it fails. > > Also, is there any #define we can check to see if we're compiling for 64 > bits? > > Luigi > > P.S. re the other 64-bit fix (atoi vs lexical_cast): it compiles, but it > changes behavior. If the input is, say, "foo", lexical_cast raises an > exception, whereas atoi quietly returns 0. I'd prefer a solution that > keeps the old behavior. > > > -- > > The young man knows the rules, but the old man knows the exceptions. > -- O. W. Holmes > > -- Quant Job Interview Questions and Answers is now out: www.markjoshi.com Assoc Prof Mark Joshi Centre for Actuarial Studies University of Melbourne My website is www.markjoshi.com ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
In reply to this post by Luigi Ballabio
OK I tried Luigi's null.hpp
error C2514: 'QuantLib::Null<Type>' : class has no constructors 1> with 1> [ 1> Type=QuantLib::Size 1> ] Type=QuantLib::IntervalPrice Type=QuantLib::Array These seem to be the only 3. WIN32 is defined for 32 bit projects so we could use it to test for 64 bit, I guess. best mark 2009/2/16 Luigi Ballabio <[hidden email]>: > On Mon, 2009-02-16 at 08:23 +0000, Bojan Nikolic wrote: >> If you are getting zeros as the NULL template values the most likely >> reason is that the template null hasn't been specialised for a type >> that is being used. > > True. Mark, can you run a compilation after replacing > <ql/utilities/null.hpp> with the one I'm attaching? You'll get a number > of errors saying that Null<T> is undefined for a few types. I'm > interested in knowing for what built-in type(s) it fails. > > Also, is there any #define we can check to see if we're compiling for 64 > bits? > > Luigi > > P.S. re the other 64-bit fix (atoi vs lexical_cast): it compiles, but it > changes behavior. If the input is, say, "foo", lexical_cast raises an > exception, whereas atoi quietly returns 0. I'd prefer a solution that > keeps the old behavior. > > > -- > > The young man knows the rules, but the old man knows the exceptions. > -- O. W. Holmes > > -- Quant Job Interview Questions and Answers is now out: www.markjoshi.com Assoc Prof Mark Joshi Centre for Actuarial Studies University of Melbourne My website is www.markjoshi.com ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Ok I tried inserting
template <> class Null<Size> { public: Null() {} operator Size() const { return Size(QL_NULL_INTEGER); } }; into null.hpp and it didn't help. As far as i can tell, the template specialization did nothing. Mark 2009/2/17 Mark joshi <[hidden email]>: > OK I tried Luigi's null.hpp > > error C2514: 'QuantLib::Null<Type>' : class has no constructors > 1> with > 1> [ > 1> Type=QuantLib::Size > 1> ] > > Type=QuantLib::IntervalPrice > Type=QuantLib::Array > > These seem to be the only 3. > > WIN32 is defined for 32 bit projects so we could use it to test for 64 > bit, I guess. > > best > > mark > > > > 2009/2/16 Luigi Ballabio <[hidden email]>: >> On Mon, 2009-02-16 at 08:23 +0000, Bojan Nikolic wrote: >>> If you are getting zeros as the NULL template values the most likely >>> reason is that the template null hasn't been specialised for a type >>> that is being used. >> >> True. Mark, can you run a compilation after replacing >> <ql/utilities/null.hpp> with the one I'm attaching? You'll get a number >> of errors saying that Null<T> is undefined for a few types. I'm >> interested in knowing for what built-in type(s) it fails. >> >> Also, is there any #define we can check to see if we're compiling for 64 >> bits? >> >> Luigi >> >> P.S. re the other 64-bit fix (atoi vs lexical_cast): it compiles, but it >> changes behavior. If the input is, say, "foo", lexical_cast raises an >> exception, whereas atoi quietly returns 0. I'd prefer a solution that >> keeps the old behavior. >> >> >> -- >> >> The young man knows the rules, but the old man knows the exceptions. >> -- O. W. Holmes >> >> > > > > -- > Quant Job Interview Questions and Answers is now out: www.markjoshi.com > > Assoc Prof Mark Joshi > Centre for Actuarial Studies > University of Melbourne > My website is www.markjoshi.com > -- Quant Job Interview Questions and Answers is now out: www.markjoshi.com Assoc Prof Mark Joshi Centre for Actuarial Studies University of Melbourne My website is www.markjoshi.com ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Hi Mark, Mark joshi <[hidden email]> writes: > Ok I tried inserting > > template <> > class Null<Size> { > public: > Null() {} > operator Size() const { return Size(QL_NULL_INTEGER); } > }; > > into null.hpp and it didn't help. I guess you tried combining this with: //! template class providing a null value for a given type. template <class Type> class Null; to check no further compilation errors come up? > As far as i can tell, the template specialization did nothing. You should be able to just printing the Null value to check it is not zero, i.e., std::cout<< Null<Size>(); c Without a Windows setup this is now all guess work, but : In termstructure.cpp: > namespace QuantLib { > > TermStructure::TermStructure(const DayCounter& dc) > : moving_(false), > updated_(true), > settlementDays_(Null<Size>()), > dayCounter_(dc) {} Here we try to convert Size to Natural as settlementDays_ is declared Natural > TermStructure::TermStructure(const Date& referenceDate, > const Calendar& cal, > const DayCounter& dc) > : moving_(false), calendar_(cal), > referenceDate_(referenceDate), updated_(true), > settlementDays_(Null<Natural>()), > dayCounter_(dc) {} Here we use Natural to assign to Natural > > // rest of file I would try replacing the first settlementDays_(Null<Size>()) with settlementDays_(Null<Natural>()) Best, Bojan -- Bojan Nikolic || http://www.bnikolic.co.uk ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
OK i've committed a new version that works with x64.
I've added a preprocessor macro x64 to indicate that building is under x64. I've removed the default value for the null template and added specializations for array and IntervalPrice. I've put the specializations for these in their header files rather than in null.hpp since this makes more sense from a levelization viewpoint (and I couldn't get it to compile with them null.hpp.) I've also added a specialization under x64 only for Size. I'll look into dealing with the lexical_cast issue. mark 2009/2/17 Bojan Nikolic <[hidden email]>: > > Hi Mark, > > Mark joshi <[hidden email]> writes: > >> Ok I tried inserting >> >> template <> >> class Null<Size> { >> public: >> Null() {} >> operator Size() const { return Size(QL_NULL_INTEGER); } >> }; >> >> into null.hpp and it didn't help. > > I guess you tried combining this with: > > //! template class providing a null value for a given type. > template <class Type> > class Null; > > to check no further compilation errors come up? > >> As far as i can tell, the template specialization did nothing. > > You should be able to just printing the Null value to check it is not > zero, i.e., std::cout<< Null<Size>(); > c > Without a Windows setup this is now all guess work, but : > > In termstructure.cpp: > >> namespace QuantLib { >> >> TermStructure::TermStructure(const DayCounter& dc) >> : moving_(false), >> updated_(true), >> settlementDays_(Null<Size>()), >> dayCounter_(dc) {} > > Here we try to convert Size to Natural as settlementDays_ is declared Natural > >> TermStructure::TermStructure(const Date& referenceDate, >> const Calendar& cal, >> const DayCounter& dc) >> : moving_(false), calendar_(cal), >> referenceDate_(referenceDate), updated_(true), >> settlementDays_(Null<Natural>()), >> dayCounter_(dc) {} > > Here we use Natural to assign to Natural > >> >> // rest of file > > I would try replacing the first settlementDays_(Null<Size>()) with > settlementDays_(Null<Natural>()) > > > Best, > Bojan > > -- > Bojan Nikolic || http://www.bnikolic.co.uk > -- Quant Job Interview Questions and Answers is now out: www.markjoshi.com Assoc Prof Mark Joshi Centre for Actuarial Studies University of Melbourne My website is www.markjoshi.com ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
On Tue, 2009-03-03 at 17:00 +1100, Mark joshi wrote:
> OK i've committed a new version that works with x64. Good, thanks. > I've added a preprocessor macro x64 to indicate that building is under x64. > > I've removed the default value for the null template and added > specializations for array and IntervalPrice. > I've put the specializations for these in their header files rather > than in null.hpp since this makes more > sense from a levelization viewpoint (and I couldn't get it to compile > with them null.hpp.) True. I've just moved the Date specialization to date.hpp as well. > I've also added a specialization under x64 only for Size. This works, but I'm still curious about what native type Size actually is (it's typedef to size_t, but that's not native either.) I'd rather specialize the template for the native type, to reduce the risk of conflicts between specializations. May you run the preprocessor on types.hpp and see how size_t is defined? I don't know how to do it from the IDE---you'll probably have to call the x64 compiler from the command line (see <http://msdn.microsoft.com/en-us/library/x4d2c09s.aspx>) as cd path/to/QuantLib cl /E /I. /Ipath/to/boost ql\types.hpp > types.pp You'll get a truckload of code. After that, look for size_t in types.pp. > I'll look into dealing with the lexical_cast issue. Ok, thanks. Luigi -- The wisdom of the wise and the experience of the ages are perpetuated by quotations. -- Benjamin Disraeli ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
As far as I can tell the type of Size is
const unsigned __int64 I am never very keen on using code with __ in it. What do you think? Mark 2009/3/4 Luigi Ballabio <[hidden email]>: > On Tue, 2009-03-03 at 17:00 +1100, Mark joshi wrote: >> OK i've committed a new version that works with x64. > > Good, thanks. > >> I've added a preprocessor macro x64 to indicate that building is under x64. >> >> I've removed the default value for the null template and added >> specializations for array and IntervalPrice. >> I've put the specializations for these in their header files rather >> than in null.hpp since this makes more >> sense from a levelization viewpoint (and I couldn't get it to compile >> with them null.hpp.) > > True. I've just moved the Date specialization to date.hpp as well. > > >> I've also added a specialization under x64 only for Size. > > This works, but I'm still curious about what native type Size actually > is (it's typedef to size_t, but that's not native either.) I'd rather > specialize the template for the native type, to reduce the risk of > conflicts between specializations. May you run the preprocessor on > types.hpp and see how size_t is defined? I don't know how to do it from > the IDE---you'll probably have to call the x64 compiler from the command > line (see <http://msdn.microsoft.com/en-us/library/x4d2c09s.aspx>) as > > cd path/to/QuantLib > cl /E /I. /Ipath/to/boost ql\types.hpp > types.pp > > You'll get a truckload of code. After that, look for size_t in types.pp. > > >> I'll look into dealing with the lexical_cast issue. > > Ok, thanks. > > Luigi > > > -- > > The wisdom of the wise and the experience of the ages are perpetuated > by quotations. > -- Benjamin Disraeli > > > -- Quant Job Interview Questions and Answers is now out: www.markjoshi.com Assoc Prof Mark Joshi Centre for Actuarial Studies University of Melbourne My website is www.markjoshi.com ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
On Wed, 2009-03-04 at 11:41 +1100, Mark joshi wrote:
> As far as I can tell the type of Size is > > const unsigned __int64 > > I am never very keen on using code with __ in it. What do you think? I think it stinks... sigh. Had I faced this problem earlier on, I'd have gotten rid of Null altogether and used boost::optional instead. Now it's probably too messy to tackle before 1.0. Anyway: the specialization would be into a VC9-specific section of code, so I think it's not a bit deal if we use the specific __int64 type. Luigi -- Dealing with failure is easy: work hard to improve. Success is also easy to handle: you've solved the wrong problem. Work hard to improve. -- Alan Perlis ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Free forum by Nabble | Edit this page |