Hello, Is there an easy way to deal with multi threading in QuantLib. I encounter the same problem that many people with: Settings::instance().evaluationDate() And other similar functions. Thanks in advance for any help, Pierre ------------------------------------------------------------------------------ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
No easy way, unfortunately. The best you can do is to enable per-thread singletons. On Windows, edit ql/userconfig.hpp and uncomment #define QL_ENABLE_SESSIONS at the end of the file; on other platforms, run ./configure --enable-sessions In both cases, you'll have to recompile the library and to provide a function Integer sessionId(); that returns a unique integer for each thread and that needs to be linked together with the library and your application. Luigi On Tue, Nov 4, 2014 at 7:21 PM, Grison PG Pierre (External DEXIA-US) <[hidden email]> wrote:
------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
In reply to this post by Grison PG Pierre (External DEXIA-US)
Hi Pierre, another alternative is to use TSS (thread safe storage). We have an implementation, based on boost_thread, that was submitted last year to QuantLib by my colleague Riccardo Ghetta (it is currently sitting in git, in the branch “thread-local-singleton”).
With the patch enabled every thread has its private copy of every QL singleton, including the evaluation date.
Giorgio -- THEMA Consulting This message (including any attachments) contains confidential and/or proprietary information intended only for the addressee. Any unauthorized disclosure, copying, distribution or reliance on the contents of this information is strictly prohibited and may constitute a violation of law. If you are not the intended recipient, please notify the sender immediately by responding to this e-mail, and delete the message from your system. If you have any questions about this e-mail please notify the sender immediately. From: Luigi Ballabio [[hidden email]] No easy way, unfortunately. The best you can do is to enable per-thread singletons. On Windows, edit ql/userconfig.hpp and uncomment #define QL_ENABLE_SESSIONS at the end of the file; on other platforms, run ./configure --enable-sessions In both cases, you'll have to recompile the library and to provide a function Integer sessionId(); that returns a unique integer for each thread and that needs to be linked together with the library and your application. Luigi On Tue, Nov 4, 2014 at 7:21 PM, Grison PG Pierre (External DEXIA-US) <[hidden email]> wrote: Hello, Is there an easy way to deal with multi threading in QuantLib. I encounter the same problem that many people with: Settings::instance().evaluationDate() And other similar functions. Thanks in advance for any help, Pierre
-- ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users rg-quantlib-tss-sessions.patch (3K) Download Attachment |
Free forum by Nabble | Edit this page |