multi threading in QuantLib

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

multi threading in QuantLib

Grison PG Pierre (External DEXIA-US)

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
Reply | Threaded
Open this post in threaded view
|

Re: multi threading in QuantLib

Luigi Ballabio
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

 


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

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




--

------------------------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|

Re: multi threading in QuantLib

Giorgio Pazmandi
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”).


If you like to give it a try, you can use the git branch or the attached patch (baseline is QuantLib 1.4) and then uncomment the variable QL_ENABLE_SESSIONS_TSS (if you prefer, I can also send you a zip with the modified files).

With the patch enabled every thread has its private copy of every QL singleton, including the evaluation date.


Hoping this will help,

Giorgio

 

 

--
Giorgio Pazmandi

THEMA Consulting
Via Balestra 31/33, CH-6901 Lugano
Tel.
+41 (0)91 911 64 64, Fax +41 (0)91 911 64 74
www.themaconsulting.ch

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]]
Sent: martedì, 18. novembre 2014 12:52
To: Grison PG Pierre (External DEXIA-US)
Cc: [hidden email]
Subject: Re: [Quantlib-users] multi threading in QuantLib

 

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

 


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

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



 

--


------------------------------------------------------------------------------
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