Quantlib - multithreading

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

Quantlib - multithreading

Ghorpadkar, Suhas

I am working on a custom MonteCarlo simulation and was trying to experiment with multiple threads.

I am aware that Quantlib as such is not thread safe. I have uncommented “define QL_ENABLE_SESSIONS” in userconfig.hpp

and have defined sessionId function at the beginning of my cpp file. I was trying to create QL objects such as YieldTermStructure handles and CalibratedModel inside the function that will called by each thread so that QL objects are not shared by multiple threads and each has a copy of its own. This worked for my Model object but not for YieldTermStructure objects. I had to lock the critical section using mutex as below even though swapCurve and dividendCurve objects are thread local.

I do not understand why. May be I need to return something other than zero in my sessionId() function ?

 

std::lock_guard<std::mutex> lg(mapMutex);

{

                Dr_t = swapCurve->discount(t);

                Dr_T = swapCurve->discount(t + dt);

 

                Dq_t = dividendCurve->discount(t);

                Dq_T = dividendCurve->discount(t + dt);

}

 

Thank you.

............................................................................

For further important information about AllianceBernstein please click here
http://www.abglobal.com/disclaimer/email/disclaimer.html


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Quantlib - multithreading

Luigi Ballabio
Yes, you do need to return something other than 0.  It should be a unique number for each thread.

Luigi


On Wed, Dec 21, 2016 at 10:06 AM Ghorpadkar, Suhas <[hidden email]> wrote:

I am working on a custom MonteCarlo simulation and was trying to experiment with multiple threads.

I am aware that Quantlib as such is not thread safe. I have uncommented “define QL_ENABLE_SESSIONS” in userconfig.hpp

and have defined sessionId function at the beginning of my cpp file. I was trying to create QL objects such as YieldTermStructure handles and CalibratedModel inside the function that will called by each thread so that QL objects are not shared by multiple threads and each has a copy of its own. This worked for my Model object but not for YieldTermStructure objects. I had to lock the critical section using mutex as below even though swapCurve and dividendCurve objects are thread local.

I do not understand why. May be I need to return something other than zero in my sessionId() function ?

 

std::lock_guard<std::mutex> lg(mapMutex);

{

                Dr_t = swapCurve->discount(t);

                Dr_T = swapCurve->discount(t + dt);

 

                Dq_t = dividendCurve->discount(t);

                Dq_T = dividendCurve->discount(t + dt);

}

 

Thank you.

............................................................................

For further important information about AllianceBernstein please click here
http://www.abglobal.com/disclaimer/email/disclaimer.html

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Quantlib - multithreading

Ghorpadkar, Suhas

Thank you. I am using the following setup but I am not sure how to return sessionId per each thread.

Any help much appreciated.

 

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

 

//launch threads using async,  doWork() is called by multiple threads simultaneously

 

std::async(std::launch::async,doWork,Handle<YieldTermStructure>,arg2,arg3)

 

//how do I return sessionId from here ? I am not sure where exactly sessionId() method should go.

std::vector<Real> doWork(Handle<YieldTermStructure> & swapCurve, arg2, arg3) {

               

                //QuantLib::sessionId() = 10;  ?

               

                Real y_t = swapCurve->discount(t);

 

}

 

From: Luigi Ballabio [mailto:[hidden email]]
Sent: Wednesday, December 21, 2016 4:09 AM
To: Ghorpadkar, Suhas; [hidden email]
Subject: Re: [Quantlib-users] Quantlib - multithreading

 

Yes, you do need to return something other than 0.  It should be a unique number for each thread.

 

Luigi

 

 

On Wed, Dec 21, 2016 at 10:06 AM Ghorpadkar, Suhas <[hidden email]> wrote:

I am working on a custom MonteCarlo simulation and was trying to experiment with multiple threads.

I am aware that Quantlib as such is not thread safe. I have uncommented “define QL_ENABLE_SESSIONS” in userconfig.hpp

and have defined sessionId function at the beginning of my cpp file. I was trying to create QL objects such as YieldTermStructure handles and CalibratedModel inside the function that will called by each thread so that QL objects are not shared by multiple threads and each has a copy of its own. This worked for my Model object but not for YieldTermStructure objects. I had to lock the critical section using mutex as below even though swapCurve and dividendCurve objects are thread local.

I do not understand why. May be I need to return something other than zero in my sessionId() function ?

 

std::lock_guard<std::mutex> lg(mapMutex);

{

                Dr_t = swapCurve->discount(t);

                Dr_T = swapCurve->discount(t + dt);

 

                Dq_t = dividendCurve->discount(t);

                Dq_T = dividendCurve->discount(t + dt);

}

 

Thank you.

............................................................................

For further important information about AllianceBernstein please click here
http://www.abglobal.com/disclaimer/email/disclaimer.html

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Quantlib - multithreading

Luigi Ballabio
You don't have to call sessionId() from your code.  The idea is that, inside sessionId, you should somehow detect in what thread you are and return a corresponding id.  One way you could do that is to use some system function to return a unique id for the thread; searching for "thread id" should get you some directions.  But I haven't tried myself, so it would be better if someone else stepped in to share their experience.

Luigi


On Wed, Dec 21, 2016 at 3:07 PM Ghorpadkar, Suhas <[hidden email]> wrote:

Thank you. I am using the following setup but I am not sure how to return sessionId per each thread.

Any help much appreciated.

 

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

 

//launch threads using async,  doWork() is called by multiple threads simultaneously

 

std::async(std::launch::async,doWork,Handle<YieldTermStructure>,arg2,arg3)

 

//how do I return sessionId from here ? I am not sure where exactly sessionId() method should go.

std::vector<Real> doWork(Handle<YieldTermStructure> & swapCurve, arg2, arg3) {

               

                //QuantLib::sessionId() = 10;  ?

               

                Real y_t = swapCurve->discount(t);

 

}

 

From: Luigi Ballabio [mailto:[hidden email]]
Sent: Wednesday, December 21, 2016 4:09 AM
To: Ghorpadkar, Suhas; [hidden email]
Subject: Re: [Quantlib-users] Quantlib - multithreading

 

Yes, you do need to return something other than 0.  It should be a unique number for each thread.

 

Luigi

 

 

On Wed, Dec 21, 2016 at 10:06 AM Ghorpadkar, Suhas <[hidden email]> wrote:

I am working on a custom MonteCarlo simulation and was trying to experiment with multiple threads.

I am aware that Quantlib as such is not thread safe. I have uncommented “define QL_ENABLE_SESSIONS” in userconfig.hpp

and have defined sessionId function at the beginning of my cpp file. I was trying to create QL objects such as YieldTermStructure handles and CalibratedModel inside the function that will called by each thread so that QL objects are not shared by multiple threads and each has a copy of its own. This worked for my Model object but not for YieldTermStructure objects. I had to lock the critical section using mutex as below even though swapCurve and dividendCurve objects are thread local.

I do not understand why. May be I need to return something other than zero in my sessionId() function ?

 

std::lock_guard<std::mutex> lg(mapMutex);

{

                Dr_t = swapCurve->discount(t);

                Dr_T = swapCurve->discount(t + dt);

 

                Dq_t = dividendCurve->discount(t);

                Dq_T = dividendCurve->discount(t + dt);

}

 

Thank you.

............................................................................

For further important information about AllianceBernstein please click here
http://www.abglobal.com/disclaimer/email/disclaimer.html

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Quantlib - multithreading

Marianne James

Hi Suhas,

I've just done a simple test on the following and it works fine. The idea is to modify the sessionId() function to return the threadId. Note that you have to modify sessionId() to return a BigNatural to match the return type from the Windows GetCurrentThreadID() function. Search for QL_ENABLE_SESSIONS and modify the return type of sessionID() and modify the instances_ map in singleton.h to have a BigNatural as the key then try this in the file you are calling std::async:

#if defined(QL_ENABLE_SESSIONS)
namespace QuantLib {
BigNatural sessionId()
{
#ifdef _WIN32
return GetCurrentThreadId();
// In C++ 11 use std::this_thread::get_id() ?
#elif defined _LINUX
return 0;
#endif
}
}
#endif

You will still have an issue with thread safety as there needs to be a lock around access to the static instances_ map. There's an open patch to fix this using boost thread specific pointers called "#71 thread-safe session handling using tss" or you could try something like this (which is what I've been using locally):

 singleton.h

..

#include "GenericProtection.h"

.

.


template <class T>
T& MySingleton<T>::instance()
{
static boost::scoped_ptr<GenericProtection> l_pGenericProtection(new GenericProtection());

#if (QL_MANAGED == 0)
static std::map<BigNatural, boost::shared_ptr<T> > instances_;
#endif

#if defined(QL_ENABLE_SESSIONS)
BigNatural id = sessionId();
#else
BigNatural id = 0;
#endif

l_pGenericProtection->Lock();
boost::shared_ptr<T>& instance = instances_[id];
if (!instance)
instance = boost::shared_ptr<T>(new T);
l_pGenericProtection->Unlock();
return *instance;
}

GenericProtection.h

#ifndef __GENERICPROTECTION_H__
#define __GENERICPROTECTION_H__

#include <boost/scoped_ptr.hpp>

class GenericProtection
{
public:
GenericProtection();
~GenericProtection();

void Lock();
void Unlock();

private:
class GenericProtectionImpl;
boost::scoped_ptr<GenericProtectionImpl> m_pGenericProtectionImpl;
};

#endif


GenericProctection.cpp


#include "GenericProtection.h"

#ifdef _WIN32
// Windows implementation
#include <windows.h>
class GenericProtection::GenericProtectionImpl
{
public:
GenericProtectionImpl()
{
::InitializeCriticalSection(&m_cs);
}

~GenericProtectionImpl()
{
::DeleteCriticalSection(&m_cs);
}

void Lock()
{
::EnterCriticalSection(&m_cs);
}

void Unlock()
{
::LeaveCriticalSection(&m_cs);
}

private:
CRITICAL_SECTION m_cs;
};
#elif defined _LINUX
// Linux implementation
class GenericProtection::GenericProtectionImpl
{
public:
GenericProtectionImpl()
{
}

~GenericProtectionImpl()
{
}

void Lock()
{
}

void Unlock()
{
}

private:
};
#endif

// Call through to the implementation
GenericProtection::GenericProtection() : m_pGenericProtectionImpl(new GenericProtection::GenericProtectionImpl()) {}
GenericProtection::~GenericProtection() {}
void GenericProtection::Lock() { m_pGenericProtectionImpl->Lock(); }
void GenericProtection::Unlock() { m_pGenericProtectionImpl->Unlock(); }

Regards

Ed James

On 21 December 2016 at 15:13 Luigi Ballabio <[hidden email]> wrote:

You don't have to call sessionId() from your code.  The idea is that, inside sessionId, you should somehow detect in what thread you are and return a corresponding id.  One way you could do that is to use some system function to return a unique id for the thread; searching for "thread id" should get you some directions.  But I haven't tried myself, so it would be better if someone else stepped in to share their experience.

Luigi


On Wed, Dec 21, 2016 at 3:07 PM Ghorpadkar, Suhas <[hidden email]> wrote:

Thank you. I am using the following setup but I am not sure how to return sessionId per each thread.

Any help much appreciated.

 

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

 

//launch threads using async,  doWork() is called by multiple threads simultaneously

 

std::async(std::launch::async,doWork,Handle<YieldTermStructure>,arg2,arg3)

 

//how do I return sessionId from here ? I am not sure where exactly sessionId() method should go.

std::vector<Real> doWork(Handle<YieldTermStructure> & swapCurve, arg2, arg3) {

               

                //QuantLib::sessionId() = 10;  ?

               

                Real y_t = swapCurve->discount(t);

 

}

 

From: Luigi Ballabio [mailto:[hidden email]]
Sent: Wednesday, December 21, 2016 4:09 AM
To: Ghorpadkar, Suhas; [hidden email]
Subject: Re: [Quantlib-users] Quantlib - multithreading

 

Yes, you do need to return something other than 0.  It should be a unique number for each thread.

 

Luigi

 

 

On Wed, Dec 21, 2016 at 10:06 AM Ghorpadkar, Suhas <[hidden email]> wrote:

I am working on a custom MonteCarlo simulation and was trying to experiment with multiple threads.

I am aware that Quantlib as such is not thread safe. I have uncommented “define QL_ENABLE_SESSIONS” in userconfig.hpp

and have defined sessionId function at the beginning of my cpp file. I was trying to create QL objects such as YieldTermStructure handles and CalibratedModel inside the function that will called by each thread so that QL objects are not shared by multiple threads and each has a copy of its own. This worked for my Model object but not for YieldTermStructure objects. I had to lock the critical section using mutex as below even though swapCurve and dividendCurve objects are thread local.

I do not understand why. May be I need to return something other than zero in my sessionId() function ?

 

std::lock_guard<std::mutex> lg(mapMutex);

{

                Dr_t = swapCurve->discount(t);

                Dr_T = swapCurve->discount(t + dt);

 

                Dq_t = dividendCurve->discount(t);

                Dq_T = dividendCurve->discount(t + dt);

}

 

Thank you.

............................................................................

For further important information about AllianceBernstein please click here
http://www.abglobal.com/disclaimer/email/disclaimer.html

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users


 


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Quantlib - multithreading

Ghorpadkar, Suhas

Thank you Edward. I followed your instructions but still getting memory access violations when I remove the locks around my curve->discount() functions. Also, if I add your MySingleton template as it is to singleton.hpp, I get compilation errors. So I just replaced the original Singleton template with your code. So here are all of my changes :

 

1.       userconfig.hpp

 

#ifndef QL_ENABLE_SESSIONS

#   define QL_ENABLE_SESSIONS

#endif

 

2.       singleton.hpp

 

#include “GenericProtection.h”

….

 

namespace QuantLib {

 

    #if defined(QL_ENABLE_SESSIONS)

    // definition must be provided by the user

                BigNatural sessionId();

    #endif

 

….

 

template <class T> T& Singleton<T>::instance() {

static boost::scoped_ptr<GenericProtection> l_pGenericProtection(new GenericProtection());

#if (QL_MANAGED == 0)

static std::map<BigNatural, boost::shared_ptr<T> > instances_;

#endif

#if defined(QL_ENABLE_SESSIONS)

BigNatural id = sessionId();

#else

BigNatural id = 0;

#endif

 

l_pGenericProtection->Lock();

boost::shared_ptr<T>& instance = instances_[id];

if (!instance)

instance = boost::shared_ptr<T>(new T);

l_pGenericProtection->Unlock();

return *instance;

}

 

3.       Added GenericProtection.h and GenericProtection.cpp

 

4.       Built quantlib library

 

5.       My cpp file

 

#if defined(QL_ENABLE_SESSIONS)

                namespace QuantLib {

                                BigNatural sessionId()

                                {

                #ifdef _WIN32

                                                return GetCurrentThreadId();

                                                // In C++ 11 use std::this_thread::get_id() ?

                #elif defined _LINUX

                                                return 0;

                #endif

                                }

                }

#endif

 

Then I removed the Mutex lock around the curve objects and built my library.

 

Thanks,

Suhas

 

From: EDWARD JAMES [mailto:[hidden email]]
Sent: Wednesday, December 21, 2016 12:55 PM
To: Luigi Ballabio; [hidden email]; Ghorpadkar, Suhas
Subject: Re: [Quantlib-users] Quantlib - multithreading

 

Hi Suhas,

I've just done a simple test on the following and it works fine. The idea is to modify the sessionId() function to return the threadId. Note that you have to modify sessionId() to return a BigNatural to match the return type from the Windows GetCurrentThreadID() function. Search for QL_ENABLE_SESSIONS and modify the return type of sessionID() and modify the instances_ map in singleton.h to have a BigNatural as the key then try this in the file you are calling std::async:

#if defined(QL_ENABLE_SESSIONS)
namespace QuantLib {
BigNatural sessionId()
{
#ifdef _WIN32
return GetCurrentThreadId();
// In C++ 11 use std::this_thread::get_id() ?
#elif defined _LINUX
return 0;
#endif
}
}
#endif

You will still have an issue with thread safety as there needs to be a lock around access to the static instances_ map. There's an open patch to fix this using boost thread specific pointers called "#71 thread-safe session handling using tss" or you could try something like this (which is what I've been using locally):

 singleton.h

..

#include "GenericProtection.h"

.

.

 

template <class T>
T& MySingleton<T>::instance()
{
static boost::scoped_ptr<GenericProtection> l_pGenericProtection(new GenericProtection());

#if (QL_MANAGED == 0)
static std::map<BigNatural, boost::shared_ptr<T> > instances_;
#endif

#if defined(QL_ENABLE_SESSIONS)
BigNatural id = sessionId();
#else
BigNatural id = 0;
#endif

l_pGenericProtection->Lock();
boost::shared_ptr<T>& instance = instances_[id];
if (!instance)
instance = boost::shared_ptr<T>(new T);
l_pGenericProtection->Unlock();
return *instance;
}

GenericProtection.h

#ifndef __GENERICPROTECTION_H__
#define __GENERICPROTECTION_H__

#include <boost/scoped_ptr.hpp>

class GenericProtection
{
public:
GenericProtection();
~GenericProtection();

void Lock();
void Unlock();

private:
class GenericProtectionImpl;
boost::scoped_ptr<GenericProtectionImpl> m_pGenericProtectionImpl;
};

#endif

 

GenericProctection.cpp


#include "GenericProtection.h"

#ifdef _WIN32
// Windows implementation
#include <windows.h>
class GenericProtection::GenericProtectionImpl
{
public:
GenericProtectionImpl()
{
::InitializeCriticalSection(&m_cs);
}

~GenericProtectionImpl()
{
::DeleteCriticalSection(&m_cs);
}

void Lock()
{
::EnterCriticalSection(&m_cs);
}

void Unlock()
{
::LeaveCriticalSection(&m_cs);
}

private:
CRITICAL_SECTION m_cs;
};
#elif defined _LINUX
// Linux implementation
class GenericProtection::GenericProtectionImpl
{
public:
GenericProtectionImpl()
{
}

~GenericProtectionImpl()
{
}

void Lock()
{
}

void Unlock()
{
}

private:
};
#endif

// Call through to the implementation
GenericProtection::GenericProtection() : m_pGenericProtectionImpl(new GenericProtection::GenericProtectionImpl()) {}
GenericProtection::~GenericProtection() {}
void GenericProtection::Lock() { m_pGenericProtectionImpl->Lock(); }
void GenericProtection::Unlock() { m_pGenericProtectionImpl->Unlock(); }

Regards

Ed James

On 21 December 2016 at 15:13 Luigi Ballabio <[hidden email]> wrote:

You don't have to call sessionId() from your code.  The idea is that, inside sessionId, you should somehow detect in what thread you are and return a corresponding id.  One way you could do that is to use some system function to return a unique id for the thread; searching for "thread id" should get you some directions.  But I haven't tried myself, so it would be better if someone else stepped in to share their experience.

 

Luigi

 

 

On Wed, Dec 21, 2016 at 3:07 PM Ghorpadkar, Suhas <[hidden email]> wrote:

Thank you. I am using the following setup but I am not sure how to return sessionId per each thread.

Any help much appreciated.

 

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

 

//launch threads using async,  doWork() is called by multiple threads simultaneously

 

std::async(std::launch::async,doWork,Handle<YieldTermStructure>,arg2,arg3)

 

//how do I return sessionId from here ? I am not sure where exactly sessionId() method should go.

std::vector<Real> doWork(Handle<YieldTermStructure> & swapCurve, arg2, arg3) {

               

                //QuantLib::sessionId() = 10;  ?

               

                Real y_t = swapCurve->discount(t);

 

}

 

From: Luigi Ballabio [mailto:[hidden email]]
Sent: Wednesday, December 21, 2016 4:09 AM
To: Ghorpadkar, Suhas; [hidden email]
Subject: Re: [Quantlib-users] Quantlib - multithreading

 

Yes, you do need to return something other than 0.  It should be a unique number for each thread.

 

Luigi

 

 

On Wed, Dec 21, 2016 at 10:06 AM Ghorpadkar, Suhas <[hidden email]> wrote:

I am working on a custom MonteCarlo simulation and was trying to experiment with multiple threads.

I am aware that Quantlib as such is not thread safe. I have uncommented “define QL_ENABLE_SESSIONS” in userconfig.hpp

and have defined sessionId function at the beginning of my cpp file. I was trying to create QL objects such as YieldTermStructure handles and CalibratedModel inside the function that will called by each thread so that QL objects are not shared by multiple threads and each has a copy of its own. This worked for my Model object but not for YieldTermStructure objects. I had to lock the critical section using mutex as below even though swapCurve and dividendCurve objects are thread local.

I do not understand why. May be I need to return something other than zero in my sessionId() function ?

 

std::lock_guard<std::mutex> lg(mapMutex);

{

                Dr_t = swapCurve->discount(t);

                Dr_T = swapCurve->discount(t + dt);

 

                Dq_t = dividendCurve->discount(t);

                Dq_T = dividendCurve->discount(t + dt);

}

 

Thank you.

............................................................................

For further important information about AllianceBernstein please click here
http://www.abglobal.com/disclaimer/email/disclaimer.html

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users


 


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users