QUDA  1.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Private Member Functions | Private Attributes | List of all members
quda::RNG Class Reference

Class declaration to initialize and hold CURAND RNG states. More...

#include <random_quda.h>

Public Member Functions

 RNG (const LatticeField &meta, unsigned long long seedin)
 allocate curand rng states array in device memory More...
 
 RNG (const LatticeFieldParam &param, unsigned long long seedin)
 Constructor that takes its metadata from a param. More...
 
void Release ()
 Release Device memory for CURAND RNG states. More...
 
void Init ()
 Initialize CURAND RNG states. More...
 
unsigned long long Seed ()
 
__host__ __device__ __inline__ cuRNGStateState ()
 
void restore ()
 Restore CURAND array states initialization. More...
 
void backup ()
 Backup CURAND array states initialization. More...
 

Private Member Functions

void AllocateRNG ()
 local lattice dimensions More...
 

Private Attributes

cuRNGStatestate
 
cuRNGStatebackup_state
 
unsigned long long seed
 
int size
 
int size_cb
 number of curand states More...
 
int X [4]
 number of curand states checkerboarded (equal to size if we have a single parity) More...
 

Detailed Description

Class declaration to initialize and hold CURAND RNG states.

Definition at line 23 of file random_quda.h.

Constructor & Destructor Documentation

◆ RNG() [1/2]

quda::RNG::RNG ( const LatticeField meta,
unsigned long long  seedin 
)

allocate curand rng states array in device memory

Constructor that takes its metadata from a field

Parameters
[in]metaThe field whose data we use
[in]seedSeed to initialize the RNG

Definition at line 85 of file random.cu.

References getVerbosity(), printfQuda, QUDA_VERBOSE, state, X, and quda::LatticeField::X().

Here is the call graph for this function:

◆ RNG() [2/2]

quda::RNG::RNG ( const LatticeFieldParam param,
unsigned long long  seedin 
)

Constructor that takes its metadata from a param.

Parameters
[in]paramThe param whose data we use
[in]seedSeed to initialize the RNG

Definition at line 101 of file random.cu.

References getVerbosity(), printfQuda, QUDA_VERBOSE, quda::LatticeFieldParam::siteSubset, size, size_cb, state, X, and quda::LatticeFieldParam::x.

Here is the call graph for this function:

Member Function Documentation

◆ AllocateRNG()

void quda::RNG::AllocateRNG ( )
private

local lattice dimensions

Allocate Device memory for CURAND RNG states.

Definition at line 130 of file random.cu.

References CUDA_SAFE_CALL, device_malloc, errorQuda, getVerbosity(), printfQuda, QUDA_DEBUG_VERBOSE, size, and state.

Referenced by Init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ backup()

void quda::RNG::backup ( )

Backup CURAND array states initialization.

Definition at line 166 of file random.cu.

References backup_state, errorQuda, host_free, safe_malloc, size, and state.

Referenced by quda::SpinorNoise< real, Ns, Nc, type, Arg >::preTune(), and State().

Here is the caller graph for this function:

◆ Init()

void quda::RNG::Init ( )

Initialize CURAND RNG states.

initialize curand rng states with seed

Definition at line 122 of file random.cu.

References AllocateRNG(), quda::launch_kernel_random(), seed, size, size_cb, state, and X.

Referenced by quda::gaugeGauss(), main(), quda::MG::MG(), quda::TRLM::operator()(), and quda::spinorNoise().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Release()

void quda::RNG::Release ( )

Release Device memory for CURAND RNG states.

free array

Definition at line 145 of file random.cu.

References device_free, getVerbosity(), printfQuda, QUDA_DEBUG_VERBOSE, size, and state.

Referenced by quda::gaugeGauss(), main(), quda::TRLM::operator()(), quda::spinorNoise(), and quda::MG::~MG().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ restore()

void quda::RNG::restore ( )

Restore CURAND array states initialization.

Definition at line 156 of file random.cu.

References backup_state, errorQuda, host_free, size, and state.

Referenced by quda::SpinorNoise< real, Ns, Nc, type, Arg >::postTune(), and State().

Here is the caller graph for this function:

◆ Seed()

unsigned long long quda::RNG::Seed ( )
inline

Definition at line 55 of file random_quda.h.

References seed.

◆ State()

__host__ __device__ __inline__ cuRNGState* quda::RNG::State ( )
inline

Definition at line 57 of file random_quda.h.

References backup(), restore(), and state.

Referenced by quda::SpinorNoiseCPU(), and quda::SpinorNoiseGPU().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ backup_state

cuRNGState* quda::RNG::backup_state
private

array with current curand rng state

Definition at line 27 of file random_quda.h.

Referenced by backup(), and restore().

◆ seed

unsigned long long quda::RNG::seed
private

array for backup of current curand rng state

Definition at line 28 of file random_quda.h.

Referenced by Init(), and Seed().

◆ size

int quda::RNG::size
private

initial rng seed

Definition at line 29 of file random_quda.h.

Referenced by AllocateRNG(), backup(), Init(), Release(), restore(), and RNG().

◆ size_cb

int quda::RNG::size_cb
private

number of curand states

Definition at line 30 of file random_quda.h.

Referenced by Init(), and RNG().

◆ state

cuRNGState* quda::RNG::state
private

Definition at line 26 of file random_quda.h.

Referenced by AllocateRNG(), backup(), Init(), Release(), restore(), RNG(), and State().

◆ X

int quda::RNG::X[4]
private

number of curand states checkerboarded (equal to size if we have a single parity)

Definition at line 31 of file random_quda.h.

Referenced by Init(), and RNG().


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