Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: random numbers in parallel
Replies: 3   Last Post: Apr 26, 2013 1:12 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Peter Perkins

Posts: 113
Registered: 8/12/11
Re: random numbers in parallel
Posted: Apr 26, 2013 12:01 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 4/25/2013 8:01 PM, Gideon wrote:
> I was wondering if people knew how robust the standard matlab rng function was when used in parallel matlab. The problem I have in mind just has a parfor loop and I'm generating monte carlo samples. I know there are issues when using random numbers in parallel to ensure each thread is generating independent samples. How is this handled in MATLAB? If I generically set rng(SEED) at the beginning of my code, then go into the parallel section, calling randn, will that be sufficient, or do I need to do something more sophisticated?

Gideon, on parallel workers, the default generator is mrg32k3a, which is
specifically designed for parallel simulation. Without knowing
specifically what you are doing, it's hard to say exactly what
initialization you might need to do, but it may be that you don't need
to do anything at all -- the workers are automatically set up with
parallel independent streams, and in many cases that's all you need.

Hope this helps.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.