Re: Openmp work on mcarlo
Posted by
Kyle Schlansker on
Oct 21, 2013; 8:31pm
URL: http://quantlib.414.s1.nabble.com/Openmp-work-on-mcarlo-tp14601p14603.html
I think the standard solution is to have each thread maintain its own state (i.e. rand seed).
Having a shared q, lock free or not, would then introduce nondeterminism unless all consumer threads read from that q in the same order from run to run, which it seems is not guaranteed.
--
kyle
Sent from my mobile; apologies for any deficiencies of spelling or message tone.
Does the number of random numbers needed per iteration change or is it a constant amount?
Would it be possible to encapsulate the random generator state so each thread could own its own RNG?
If that isn't feasible or reduces the quality of the generation, would it be possible to spawn a producer thread that pushes random numbers onto a queue (could even investigate boost::lockfree::queue to avoid locking, though it requires boost 1.53) and have the worker thread just pop off from that queue whenever a new random number is needed?
Mike
------------------------------------------------------------------------------October Webinars: Code for PerformanceFree 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
------------------------------------------------------------------------------
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