lib.mpi.MPIRandomState¶
- class lib.mpi.MPIRandomState(size, seed=None, chunksize=100000, mpicomm=None)¶
Bases:
objectA Random number generator that is invariant against number of ranks, when the total size of random number requested is kept the same. The algorithm here assumes the random number generator from numpy produces uncorrelated results when the seeds are sampled from a single random generator. The sampler methods are collective calls; multiple calls will return uncorrelated results. The result is only invariant under different
mpicomm.sizewhenmpicomm.allreduce(size)andchunksizeare kept invariant.Taken from https://github.com/bccp/nbodykit/blob/master/nbodykit/mpirng.py
Methods
Produce
sizenormals, each of shape itemshape.Produce
sizepoissons, each of shape itemshape.Produce
sizeuniforms, each of shape itemshape.- normal(loc=0, scale=1, itemshape=(), dtype='f8')¶
Produce
sizenormals, each of shape itemshape. This is a collective MPI call.
- poisson(lam, itemshape=(), dtype='f8')¶
Produce
sizepoissons, each of shape itemshape. This is a collective MPI call.
- uniform(low=0.0, high=1.0, itemshape=(), dtype='f8')¶
Produce
sizeuniforms, each of shape itemshape. This is a collective MPI call.