[Numpy-discussion] numpy.random and multiprocessing

Pauli Virtanen pav@iki...
Thu Dec 11 10:16:04 CST 2008


Fri, 12 Dec 2008 00:57:26 +0900, David Cournapeau wrote:
[clip]
> On Fri, Dec 12, 2008 at 12:20 AM, Gael Varoquaux wrote:
> [clip]
>> Now I understand why this is the case: the different instances of the
>> random number generator where created by forking from the same process,
>> so they are exactly the very same object. This is howver a fairly bad
>> trap. I guess other people will fall into it.
> 
> I am not sure I am following: the objects in python are not the same if
> you fork a process, or I don't understand what you mean by same. They
> may be initialized the same way, though.

The RandomState object handling numpy.random.random is created (and 
seeded) at import time. So, an identical generator should be shared by 
all processes after that.

-- 
Pauli Virtanen



More information about the Numpy-discussion mailing list