Open Qmin
0.8.0
GPU-accelerated Q-tensor-based liquid crystal simulations
|
A class that gives access to a RNG on the cpu and gpu. More...
#include <noiseSource.h>
Public Member Functions | |
noiseSource (bool rep=false) | |
base constructor More... | |
int | getInt (int minimum, int maximum) |
Get a reproducible integer. More... | |
scalar | getRealUniform (scalar minimum=0., scalar maximum=1.) |
Get a real from uniform distribution. More... | |
scalar | getRealNormal (scalar mean=0., scalar std=1.) |
Get a real from normal distribution. More... | |
void | initialize (int _N) |
Set the array size of the cuda rngs. More... | |
void | setReproducible (bool _rep) |
set reproducibility More... | |
void | setReproducibleSeed (int _seed) |
set the seed on a reproducible RNG run More... | |
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? More... | |
int | N |
number of entries for the cuda RNG More... | |
int | RNGSeed |
The seed used by the random number generator, when non-reproducible dynamics have been set. More... | |
random_device | rd |
an initializer for non-reproducible random number generation on the cpu More... | |
mt19937 | gen |
A reproducible Mersenne Twister. More... | |
mt19937 | genrd |
A non-reproducible Mersenne Twister. More... | |
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. More... | |
GPUArray< curandState > | RNGs |
An array random-number-generators for use on the GPU branch of the code. More... | |
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.
|
inline |
base constructor
References gen, genrd, rd, and Reproducible.
int noiseSource::getInt | ( | int | minimum, |
int | maximum | ||
) |
Get a reproducible integer.
References gen, genrd, and Reproducible.
Referenced by poissonDiskSampling::poissonDiskSampling().
Get a real from uniform distribution.
References gen, genrd, Reproducible, and scalar.
Referenced by poissonDiskSampling::poissonDiskSampling(), poissonDiskSampling::sample_annulus_point(), qTensorLatticeModel::setNematicQTensorRandomly(), and simpleModel::setParticlePositionsRandomly().
Get a real from normal distribution.
References gen, genrd, Reproducible, and scalar.
Referenced by cubicLattice::setSpinsRandomly(), and simpleModel::setVelocitiesMaxwellBoltzmann().
|
inline |
Set the array size of the cuda rngs.
References N, GPUArray< T >::resize(), and RNGs.
Referenced by qTensorLatticeModel::setNematicQTensorRandomly(), and cubicLattice::setSpinsRandomly().
|
inline |
set reproducibility
References Reproducible.
void noiseSource::setReproducibleSeed | ( | int | _seed | ) |
void noiseSource::initializeGPURNGs | ( | int | globalSeed = 1337 , |
int | tempSeed = 0 |
||
) |
allow for whatever GPU RNG initialization is needed
globalSeed | the global seed to use |
tempSeed | a 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 qTensorLatticeModel::setNematicQTensorRandomly(), and cubicLattice::setSpinsRandomly().
bool noiseSource::Reproducible |
should the dynamics be reproducible?
Referenced by getInt(), getRealNormal(), getRealUniform(), initializeGPURNGs(), noiseSource(), and setReproducible().
int noiseSource::N |
number of entries for the cuda RNG
Referenced by initialize(), and initializeGPURNGs().
int noiseSource::RNGSeed |
The seed used by the random number generator, when non-reproducible dynamics have been set.
Referenced by initializeGPURNGs(), and setReproducibleSeed().
random_device noiseSource::rd |
an initializer for non-reproducible random number generation on the cpu
Referenced by noiseSource().
mt19937 noiseSource::gen |
A reproducible Mersenne Twister.
Referenced by getInt(), getRealNormal(), getRealUniform(), noiseSource(), and setReproducibleSeed().
mt19937 noiseSource::genrd |
A non-reproducible Mersenne Twister.
Referenced by getInt(), getRealNormal(), getRealUniform(), noiseSource(), and setReproducibleSeed().
bool noiseSource::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> noiseSource::RNGs |
An array random-number-generators for use on the GPU branch of the code.
Referenced by initialize(), initializeGPURNGs(), qTensorLatticeModel::setNematicQTensorRandomly(), and cubicLattice::setSpinsRandomly().