RandomTask#
- class caput.pipeline.tasklib.random.RandomTask[source]#
Bases:
caput.pipeline.tasklib.base.MPILoggedTaskA base class for MPI tasks that need to generate random numbers.
- Attributes:
- seed
int Set the seed for use in the task. If not set, a random seed is generated and broadcast to all ranks. The seed being used is logged, to repeat a previous run, simply set this as the seed parameter.
- threads
int Set the number of threads to use for the random number generator. If not explicitly set this will use the value of the OMP_NUM_THREADS environment variable, or fall back to four.
- seed
- property local_seed[source]#
Get the seed to be used on this rank.
- Returns:
- rank_local_seed
int Seed local to this rank.
- rank_local_seed
- property rng[source]#
A random number generator for this task.
Warning
Initialising the RNG is a collective operation if the seed is not set, and so all ranks must participate in the first access of this property.
- Returns:
- rng
MultiThreadedRNG A deterministically seeded random number generator suitable for use in MPI jobs.
- rng