Re: Openmp work on mcarlo
Posted by
Joseph Wang-4 on
Oct 22, 2013; 2:51am
URL: http://quantlib.414.s1.nabble.com/Openmp-work-on-mcarlo-tp14601p14604.html
It's possible to figure out the number of random number evaluations, and then skip ahead N evaluations for each thread. In practice this works but the code is very fragile. Having each thread have its own state is also used but it requires the user to know ahead of time how many threads to use, and you have to be very careful not to introduce bad correlations.
I'm trying to get deterministic order by putting the RNG into a critical section. Right now the goal isn't to get the same order between non-OMP and OMP but to at least get identical answers between different OMP runs. This isn't a hard algorithm issue, but its a C++ class/architecture issue, since it involves changing the interface of the MC classes, and I'd like to get this right before moving anything to the main code branch.
One other technique that I've see is to generate all of the paths ahead of time, store in memory and the run the pricing afterwards. This gets you deterministic ordering, and you can do clever things with RNG, and it's very useful for generating greeks, but you then have to carefully manage memory, and I want to avoid that.
I've been able to get nice speedups with OpenMP with FD and lattice, and I'd appreciate it if people could test the patches (openmp branch on joequant/quantlib github). One thing that MP does is favor simple schemes so I've parallelized those. There are some well known MP algorithms for tridiagonalizing a matrix and I can implement that once MC gets put in.
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev