CellGPU  0.8.0
GPU-accelerated simulations of cells
Public Member Functions | Public Attributes | List of all members
noiseSource Class Reference

A class that gives access to a RNG on the cpu and gpu. More...

#include <noiseSource.h>

Public Member Functions

 noiseSource ()
 base constructor
 
int getInt (int minimum, int maximum)
 Get a reproducible integer.
 
Dscalar getRealUniform (Dscalar minimum=0., Dscalar maximum=1.)
 Get a real from uniform distribution.
 
Dscalar getRealNormal (Dscalar mean=0., Dscalar std=1.)
 Get a real from normal distribution.
 
void initialize (int _N)
 Set the array size of the cuda rngs.
 
void setReproducible (bool _rep)
 set reproducibility
 
void setReproducibleSeed (int _seed)
 set the seed on a reproducible RNG run
 
void initializeGPURNGs (int globalSeed=1337, int tempSeed=0)
 allow for whatever GPU RNG initialization is needed More...
 

Public Attributes

bool Reproducible
 should the dynamics be reproducible?
 
int N
 number of entries for the cuda RNG
 
int RNGSeed
 The seed used by the random number generator, when non-reproducible dynamics have been set.
 
random_device rd
 an initializer for non-reproducible random number generation on the cpu
 
mt19937 gen
 A reproducible Mersenne Twister.
 
mt19937 genrd
 A non-reproducible Mersenne Twister.
 
bool initializeGPURNG
 A flag to determine whether the CUDA RNGs should be initialized or not (so that the program will run on systems with no GPU by setting this to false.
 
GPUArray< curandState > RNGs
 An array random-number-generators for use on the GPU branch of the code.
 

Detailed Description

A class that gives access to a RNG on the cpu and gpu.

Provides features to some psuedo-rng functions. On the CPU side, one can call for a random integer (in a specified range), a random real with a uniform distribution, or a random real from a normal distribution. On the GPU side, provides access to a GPUArray of curandState objects, and functionality to initialize them.

Member Function Documentation

◆ initializeGPURNGs()

void noiseSource::initializeGPURNGs ( int  globalSeed = 1337,
int  tempSeed = 0 
)

allow for whatever GPU RNG initialization is needed

Parameters
globalSeedthe global seed to use
offsetthe value of the offset that should be sent to the cuda RNG... This is one part of what would be required to support reproducibly being able to load a state from a databse and continue the dynamics in the same way every time. This is not currently supported.

References ArrayHandle< T >::data, access_location::device, GPUArray< T >::getNumElements(), gpu_initialize_RNG_array(), N, access_mode::overwrite, Reproducible, GPUArray< T >::resize(), RNGs, and RNGSeed.

Referenced by updaterWithNoise::setReproducible().


The documentation for this class was generated from the following files: