Collapse of program due to allocation problems with MultiPathGenerator

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

Collapse of program due to allocation problems with MultiPathGenerator

LotharK
Dear all,

I am currentlly using all "ingridients" of the testSwaptionPricing method of libormarketmodel.cpp from the testsuite. My aim is to simulate 40-50 forward rates according to the way it's done in libormarketmodel.cpp. Therefore, all I have changed are the variables Size size from 10 to 40 and Size steps from 8*size to 10*size.
Now I am experiencing allocation problems due to the MultiPathGenerator. The reason for that is probably the number of elements simulated by the generator: The method "PseudoRandom::make_sequence_generator" has to simulate size*(grid.size()-1) normally distributed random numbers. In my case 40*(400-1) = 15960.
Now I am considering nrTrails = 5000 (number of trajectories). This makes in total: 15960*5000 = 79.800.000 elements at once.
Could that be the reason for the collapse of my problem throwing a malloc exception?

Generally speaking, I think it would be much more efficient if we simulated trajectories just for one grid step (theoretically possible since increments of Brownian motions are independent), we could recover and save the forward rates for this step and then overwrite the sample_type path with the trajectories of the next grid step.
Has anybody tried something like that before or experienced the same problems?

I am a beginner with Quantlib and I would really appreciate any kind of help. I haven't found something about my issue in the forum. If there already exists sth. I apologize and thank in advance for the link.

Cheers,
Lothar
Reply | Threaded
Open this post in threaded view
|

Re: Collapse of program due to allocation problems with MultiPathGenerator

Klaus Spanderen-2
Hi Lothar

On Wednesday 14 January 2009 18:22:55 LotharK wrote:
> I am currentlly using all "ingridients" of the testSwaptionPricing method
> of libormarketmodel.cpp from the testsuite. My aim is to simulate 40-50
> forward rates according to the way it's done in libormarketmodel.cpp.
> Therefore, all I have changed are the variables Size size from 10 to 40 and
> Size steps from 8*size to 10*size.

I've just ran the test case with size = 40 and steps = 10*size (okay running
it takes forever;-). Memory consumption is moderate, about 20mb. As far as I
can see not all 5000 paths are generated at once. Therefore the memory
footprint should be relatively small and should not break your calculation
process.

regards
 Klaus


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users