Hello all
I've got a question about the usage of the Settings::evaluationDate() in a multithreaded environment. First of all, I'm not completely sure whether I really need to set this. I'm evaluating bonds and barrier options only. Where exactly is the Settings class really used? Second, I would like to evaluate multiple instruments for different valuation dates, and I want to do this concurrently with multiple threads. It appears to me, that - if I really need to use the Settings singleton - this would not be possible at all. Do I miss something here? Thanks a lot! Bernhard |
Hi Bernhard,
apologies for the delay. On Mon, 2009-04-20 at 04:33 -0700, Bernhard MAeder wrote: > I've got a question about the usage of the Settings::evaluationDate() in a > multithreaded environment. > > First of all, I'm not completely sure whether I really need to set this. I'm > evaluating bonds and barrier options only. Where exactly is the Settings > class really used? It might be used for determining what coupons are still to be paid and what coupons are expired. In case of floating-rate bonds, it's definitely used to determine what libor fixings are to be forecast and what are fixed. > Second, I would like to evaluate multiple instruments for different > valuation dates, and I want to do this concurrently with multiple threads. > It appears to me, that - if I really need to use the Settings singleton - > this would not be possible at all. Do I miss something here? You can turn the Singleton in a Multiton, so to speak. If you define the QL_ENABLE_SESSIONS macro, you can have a different Singleton instance (and therefore a different valuation date) for each thread. You'll have to provide and link with your program a function sessionId() that returns a different integer for each thread (the mechanism to do that is up to you.) Finally, to define the macro: if you're using Windows, edit ql/userconfig.hpp and uncomment the macro definition (it's at the end of the file.) If you're using another platform, run configure as ./configure --enable-sessions Luigi -- No, I'm not interested in developing a powerful brain. All I'm after is just a mediocre brain, something like the president of American Telephone and Telegraph Company. -- Alan Turing on the possibilities of a thinking machine, 1943. ------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |