GPU Workshop Sample Code
 All Data Structures Namespaces Files Functions Variables Macros Pages
Functions
mycuda_random Namespace Reference

Kernels for generating parallel streams of random numbers. More...

Functions

__global__ void random_init (curandState_t *state, const int seed, const int n)
 
__global__ void random_normal (float *z, curandState_t *state, const int n)
 
__global__ void random_uniform (float *z, curandState_t *state, const int n)
 
template<typename T >
__host__ __device__ T norm_cdf_inv (T q)
 
template<typename T >
__host__ __device__ T norm_cdf (T z)
 

Detailed Description

Kernels for generating parallel streams of random numbers.

Function Documentation

template<typename T >
__host__ __device__ T mycuda_random::norm_cdf ( z)

Definition at line 72 of file mycuda_random.h.

template<typename T >
__host__ __device__ T mycuda_random::norm_cdf_inv ( q)

Definition at line 64 of file mycuda_random.h.

__global__ void mycuda_random::random_init ( curandState_t *  state,
const int  seed,
const int  n 
)

Definition at line 14 of file mycuda_random.h.

__global__ void mycuda_random::random_normal ( float *  z,
curandState_t *  state,
const int  n 
)

Definition at line 25 of file mycuda_random.h.

__global__ void mycuda_random::random_uniform ( float *  z,
curandState_t *  state,
const int  n 
)

Notes

  • Getting and saving seed is costly, so better to copy seed to local memory, generate many random numbers, then return updated seed to global memory.

Definition at line 46 of file mycuda_random.h.