Help with MC Simulation performance

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

Help with MC Simulation performance

Mathias Zetterqvist
Hi

Im using Quantlib for doing some MC simulations. At the moment we are
doing like this to simulate several dependent paths:

PseudoRandom::rsg_type gen =
PseudoRandom::make_sequence_generator(nrAssets_*(grid.size()-1),seed);

boost::shared_ptr<MultiPathGenerator<LowDiscrepancy::rsg_type> >
    multipathGenerator(
    new MultiPathGenerator<LowDiscrepancy::rsg_type> (
                                    procs_,
                                    correlation_, grid,
                                    quasiGen, brownianBridge));

and then to get the paths

multipathHolder = multipathGenerator->next();

This working fine and I'm getting the paths and can use them. But we
are having some perfomance issue, it takes about 1350 millisec to
generate 100 paths (5 assets and a gridsize of 90) on a fairly new
computer. This will take to long time when we wan't to increase the
number of paths.

Does anyone have any ideas how to improve speed?

Thanks for any help
/Mathias Zetterqvist


Reply | Threaded
Open this post in threaded view
|

Re: Help with MC Simulation performance

Luigi Ballabio
On 08/18/2005 11:36:37 AM, Mathias Zetterqvist wrote:

>
> Im using Quantlib for doing some MC simulations.
> [...]
> This working fine and I'm getting the paths and can use them. But we
> are having some perfomance issue, it takes about 1350 millisec to
> generate 100 paths (5 assets and a gridsize of 90) on a fairly new
> computer. This will take to long time when we wan't to increase the
> number of paths.
>
> Does anyone have any ideas how to improve speed?

Mathias,
        can you profile the code and see where the bottleneck is?

Later,
        Luigi

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

Call on God, but row away from the rocks.
-- Indian proverb



Reply | Threaded
Open this post in threaded view
|

Re: Help with MC Simulation performance

Mathias Zetterqvist
Does QuantLib have any built in functions for profiling?

I looked at mcamericanbasketengine.cpp when i was writing the code and
it's very similar to that one. I don't even do anything with my
simulated paths at the moment, only generate them.

/Mathias

On 8/19/05, Luigi Ballabio <[hidden email]> wrote:

>
> On 08/18/2005 11:36:37 AM, Mathias Zetterqvist wrote:
> >
> > Im using Quantlib for doing some MC simulations.
> > [...]
> > This working fine and I'm getting the paths and can use them. But we
> > are having some perfomance issue, it takes about 1350 millisec to
> > generate 100 paths (5 assets and a gridsize of 90) on a fairly new
> > computer. This will take to long time when we wan't to increase the
> > number of paths.
> >
> > Does anyone have any ideas how to improve speed?
>
> Mathias,
>        can you profile the code and see where the bottleneck is?
>
> Later,
>        Luigi
>
> ----------------------------------------
>
> Call on God, but row away from the rocks.
> -- Indian proverb
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Help with MC Simulation performance

Luigi Ballabio
On 08/19/2005 02:53:15 PM, Mathias Zetterqvist wrote:
> Does QuantLib have any built in functions for profiling?

No, but your compiler does. Which one are you using?

Luigi

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

The economy depends about as much on economists as the weather does on
weather forecasters.
-- Jean-Paul Kauffmann



Reply | Threaded
Open this post in threaded view
|

Re: Help with MC Simulation performance

Mathias Zetterqvist
Ok, I'm using the compiler in Visual Studio.NET.

/Mathias

On 8/19/05, Luigi Ballabio <[hidden email]> wrote:

>
> On 08/19/2005 02:53:15 PM, Mathias Zetterqvist wrote:
> > Does QuantLib have any built in functions for profiling?
>
> No, but your compiler does. Which one are you using?
>
> Luigi
>
> ----------------------------------------
>
> The economy depends about as much on economists as the weather does on
> weather forecasters.
> -- Jean-Paul Kauffmann
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Help with MC Simulation performance

Luigi Ballabio
On 08/19/2005 04:00:31 PM, Mathias Zetterqvist wrote:
> Ok, I'm using the compiler in Visual Studio.NET.

I see. I'm not familiar with that one, but if you look up 'profiling'  
in its documentation you should find a way to instrument the library so  
that it can be profiled. After you run your program (which will take  
longer that usual) you'll end up with a listing of the called functions  
together with the number of times they were called, the time they  
consumed, and other information. This should give you a hint as to what  
part of the code should be optimized.

Later,
        Luigi

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

The box said "Use Windows 95 or better," so I got a Macintosh.



Reply | Threaded
Open this post in threaded view
|

Re: Help with MC Simulation performance

Plamen Neykov
Unfortunately the VC 7.1 aka Visual Studio.NET does not include a profiler any
more - I'm using one which is available also as a community version and it is
ok for the job - here the link:
 
http://www.compuware.com/products/devpartner/profiler/default.asp?cid=3019X36&focus=DevPartner&source=Web+%2D+Evaluation+Request&desc=Download+%2D+%27DevPartner+Profiler+Community+Edition%27&offering=DevPartner&sf=1&p=0
(requires unfortunately registration...)

cheers,
Plamen
On Friday 19 August 2005 16:16, Luigi Ballabio wrote:

> On 08/19/2005 04:00:31 PM, Mathias Zetterqvist wrote:
> > Ok, I'm using the compiler in Visual Studio.NET.
>
> I see. I'm not familiar with that one, but if you look up 'profiling'
> in its documentation you should find a way to instrument the library so
> that it can be profiled. After you run your program (which will take
> longer that usual) you'll end up with a listing of the called functions
> together with the number of times they were called, the time they
> consumed, and other information. This should give you a hint as to what
> part of the code should be optimized.
>
> Later,
> Luigi
>
> ----------------------------------------
>
> The box said "Use Windows 95 or better," so I got a Macintosh.
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Quantlib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

attachment0 (189 bytes) Download Attachment