rocRAND
Macros | Typedefs | Enumerations | Functions
rocRAND host API

Macros

#define ROCRAND_DEFAULT_MAX_BLOCK_SIZE   256
 
#define ROCRAND_DEFAULT_MIN_WARPS_PER_EU   1
 

Typedefs

typedef enum rocrand_status rocrand_status
 rocRAND function call status type
 
typedef enum rocrand_rng_type rocrand_rng_type
 rocRAND generator type
 

Enumerations

enum  rocrand_status {
  ROCRAND_STATUS_SUCCESS = 0, ROCRAND_STATUS_VERSION_MISMATCH = 100, ROCRAND_STATUS_NOT_CREATED = 101, ROCRAND_STATUS_ALLOCATION_FAILED = 102,
  ROCRAND_STATUS_TYPE_ERROR = 103, ROCRAND_STATUS_OUT_OF_RANGE = 104, ROCRAND_STATUS_LENGTH_NOT_MULTIPLE = 105, ROCRAND_STATUS_DOUBLE_PRECISION_REQUIRED = 106,
  ROCRAND_STATUS_LAUNCH_FAILURE = 107, ROCRAND_STATUS_INTERNAL_ERROR = 108
}
 rocRAND function call status type More...
 
enum  rocrand_rng_type {
  ROCRAND_RNG_PSEUDO_DEFAULT = 400, ROCRAND_RNG_PSEUDO_XORWOW = 401, ROCRAND_RNG_PSEUDO_MRG32K3A = 402, ROCRAND_RNG_PSEUDO_MTGP32 = 403,
  ROCRAND_RNG_PSEUDO_PHILOX4_32_10 = 404, ROCRAND_RNG_QUASI_DEFAULT = 500, ROCRAND_RNG_QUASI_SOBOL32 = 501
}
 rocRAND generator type More...
 

Functions

rocrand_status ROCRANDAPI rocrand_create_generator (rocrand_generator *generator, rocrand_rng_type rng_type)
 Creates a new random number generator. More...
 
rocrand_status ROCRANDAPI rocrand_destroy_generator (rocrand_generator generator)
 Destroys random number generator. More...
 
rocrand_status ROCRANDAPI rocrand_generate (rocrand_generator generator, unsigned int *output_data, size_t n)
 Generates uniformly distributed 32-bit unsigned integers. More...
 
rocrand_status ROCRANDAPI rocrand_generate_char (rocrand_generator generator, unsigned char *output_data, size_t n)
 Generates uniformly distributed 8-bit unsigned integers. More...
 
rocrand_status ROCRANDAPI rocrand_generate_short (rocrand_generator generator, unsigned short *output_data, size_t n)
 Generates uniformly distributed 16-bit unsigned integers. More...
 
rocrand_status ROCRANDAPI rocrand_generate_uniform (rocrand_generator generator, float *output_data, size_t n)
 Generates uniformly distributed float values. More...
 
rocrand_status ROCRANDAPI rocrand_generate_uniform_double (rocrand_generator generator, double *output_data, size_t n)
 Generates uniformly distributed double-precision floating-point values. More...
 
rocrand_status ROCRANDAPI rocrand_generate_uniform_half (rocrand_generator generator, half *output_data, size_t n)
 Generates uniformly distributed half-precision floating-point values. More...
 
rocrand_status ROCRANDAPI rocrand_generate_normal (rocrand_generator generator, float *output_data, size_t n, float mean, float stddev)
 Generates normally distributed float values. More...
 
rocrand_status ROCRANDAPI rocrand_generate_normal_double (rocrand_generator generator, double *output_data, size_t n, double mean, double stddev)
 Generates normally distributed double values. More...
 
rocrand_status ROCRANDAPI rocrand_generate_normal_half (rocrand_generator generator, half *output_data, size_t n, half mean, half stddev)
 Generates normally distributed half values. More...
 
rocrand_status ROCRANDAPI rocrand_generate_log_normal (rocrand_generator generator, float *output_data, size_t n, float mean, float stddev)
 Generates log-normally distributed float values. More...
 
rocrand_status ROCRANDAPI rocrand_generate_log_normal_double (rocrand_generator generator, double *output_data, size_t n, double mean, double stddev)
 Generates log-normally distributed double values. More...
 
rocrand_status ROCRANDAPI rocrand_generate_log_normal_half (rocrand_generator generator, half *output_data, size_t n, half mean, half stddev)
 Generates log-normally distributed half values. More...
 
rocrand_status ROCRANDAPI rocrand_generate_poisson (rocrand_generator generator, unsigned int *output_data, size_t n, double lambda)
 Generates Poisson-distributed 32-bit unsigned integers. More...
 
rocrand_status ROCRANDAPI rocrand_initialize_generator (rocrand_generator generator)
 Initializes the generator's state on GPU or host. More...
 
rocrand_status ROCRANDAPI rocrand_set_stream (rocrand_generator generator, hipStream_t stream)
 Sets the current stream for kernel launches. More...
 
rocrand_status ROCRANDAPI rocrand_set_seed (rocrand_generator generator, unsigned long long seed)
 Sets the seed of a pseudo-random number generator. More...
 
rocrand_status ROCRANDAPI rocrand_set_offset (rocrand_generator generator, unsigned long long offset)
 Sets the offset of a random number generator. More...
 
rocrand_status ROCRANDAPI rocrand_set_quasi_random_generator_dimensions (rocrand_generator generator, unsigned int dimensions)
 Set the number of dimensions of a quasi-random number generator. More...
 
rocrand_status ROCRANDAPI rocrand_get_version (int *version)
 Returns the version number of the library. More...
 
rocrand_status ROCRANDAPI rocrand_create_poisson_distribution (double lambda, rocrand_discrete_distribution *discrete_distribution)
 Construct the histogram for a Poisson distribution. More...
 
rocrand_status ROCRANDAPI rocrand_create_discrete_distribution (const double *probabilities, unsigned int size, unsigned int offset, rocrand_discrete_distribution *discrete_distribution)
 Construct the histogram for a custom discrete distribution. More...
 
rocrand_status ROCRANDAPI rocrand_destroy_discrete_distribution (rocrand_discrete_distribution discrete_distribution)
 Destroy the histogram array for a discrete distribution. More...
 

Detailed Description

Enumeration Type Documentation

◆ rocrand_rng_type

rocRAND generator type

Enumerator
ROCRAND_RNG_PSEUDO_DEFAULT 

Default pseudorandom generator.

ROCRAND_RNG_PSEUDO_XORWOW 

XORWOW pseudorandom generator.

ROCRAND_RNG_PSEUDO_MRG32K3A 

MRG32k3a pseudorandom generator.

ROCRAND_RNG_PSEUDO_MTGP32 

Mersenne Twister MTGP32 pseudorandom generator.

ROCRAND_RNG_PSEUDO_PHILOX4_32_10 

PHILOX-4x32-10 pseudorandom generator.

ROCRAND_RNG_QUASI_DEFAULT 

Default quasirandom generator.

ROCRAND_RNG_QUASI_SOBOL32 

Sobol32 quasirandom generator.

◆ rocrand_status

rocRAND function call status type

Enumerator
ROCRAND_STATUS_SUCCESS 

No errors.

ROCRAND_STATUS_VERSION_MISMATCH 

Header file and linked library version do not match.

ROCRAND_STATUS_NOT_CREATED 

Generator was not created using rocrand_create_generator.

ROCRAND_STATUS_ALLOCATION_FAILED 

Memory allocation failed during execution.

ROCRAND_STATUS_TYPE_ERROR 

Generator type is wrong.

ROCRAND_STATUS_OUT_OF_RANGE 

Argument out of range.

ROCRAND_STATUS_LENGTH_NOT_MULTIPLE 

Requested size is not a multiple of quasirandom generator's dimension, or requested size is not even (see rocrand_generate_normal()), or pointer is misaligned (see rocrand_generate_normal())

ROCRAND_STATUS_DOUBLE_PRECISION_REQUIRED 

GPU does not have double precision.

ROCRAND_STATUS_LAUNCH_FAILURE 

Kernel launch failure.

ROCRAND_STATUS_INTERNAL_ERROR 

Internal library error.

Function Documentation

◆ rocrand_create_discrete_distribution()

rocrand_status ROCRANDAPI rocrand_create_discrete_distribution ( const double *  probabilities,
unsigned int  size,
unsigned int  offset,
rocrand_discrete_distribution discrete_distribution 
)

Construct the histogram for a custom discrete distribution.

Construct the histogram for the discrete distribution of size 32-bit unsigned integers from the range [offset, offset + size) using probabilities as probabilities.

Parameters
probabilities- probabilities of the the distribution in host memory
size- size of probabilities
offset- offset of values
discrete_distribution- pointer to the histogram in device memory
Returns
  • ROCRAND_STATUS_ALLOCATION_FAILED if memory could not be allocated
  • ROCRAND_STATUS_OUT_OF_RANGE if discrete_distribution pointer was null
  • ROCRAND_STATUS_OUT_OF_RANGE if size was zero
  • ROCRAND_STATUS_SUCCESS if the histogram was constructed successfully

◆ rocrand_create_generator()

rocrand_status ROCRANDAPI rocrand_create_generator ( rocrand_generator *  generator,
rocrand_rng_type  rng_type 
)

Creates a new random number generator.

Creates a new pseudo random number generator of type rng_type and returns it in generator.

Values for rng_type are:

  • ROCRAND_RNG_PSEUDO_XORWOW
  • ROCRAND_RNG_PSEUDO_MRG32K3A
  • ROCRAND_RNG_PSEUDO_MTGP32
  • ROCRAND_RNG_PSEUDO_PHILOX4_32_10
  • ROCRAND_RNG_QUASI_SOBOL32
Parameters
generator- Pointer to generator
rng_type- Type of generator to create
Returns
  • ROCRAND_STATUS_ALLOCATION_FAILED, if memory could not be allocated
  • ROCRAND_STATUS_VERSION_MISMATCH if the header file version does not match the dynamically linked library version
  • ROCRAND_STATUS_TYPE_ERROR if the value for rng_type is invalid
  • ROCRAND_STATUS_SUCCESS if generator was created successfully

◆ rocrand_create_poisson_distribution()

rocrand_status ROCRANDAPI rocrand_create_poisson_distribution ( double  lambda,
rocrand_discrete_distribution discrete_distribution 
)

Construct the histogram for a Poisson distribution.

Construct the histogram for the Poisson distribution with lambda lambda.

Parameters
lambda- lambda for the Poisson distribution
discrete_distribution- pointer to the histogram in device memory
Returns
  • ROCRAND_STATUS_ALLOCATION_FAILED if memory could not be allocated
  • ROCRAND_STATUS_OUT_OF_RANGE if discrete_distribution pointer was null
  • ROCRAND_STATUS_OUT_OF_RANGE if lambda is non-positive
  • ROCRAND_STATUS_SUCCESS if the histogram was constructed successfully

◆ rocrand_destroy_discrete_distribution()

rocrand_status ROCRANDAPI rocrand_destroy_discrete_distribution ( rocrand_discrete_distribution  discrete_distribution)

Destroy the histogram array for a discrete distribution.

Destroy the histogram array for a discrete distribution created by rocrand_create_poisson_distribution.

Parameters
discrete_distribution- pointer to the histogram in device memory
Returns
  • ROCRAND_STATUS_OUT_OF_RANGE if discrete_distribution was null
  • ROCRAND_STATUS_SUCCESS if the histogram was destroyed successfully

◆ rocrand_destroy_generator()

rocrand_status ROCRANDAPI rocrand_destroy_generator ( rocrand_generator  generator)

Destroys random number generator.

Destroys random number generator and frees related memory.

Parameters
generator- Generator to be destroyed
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_SUCCESS if generator was destroyed successfully

◆ rocrand_generate()

rocrand_status ROCRANDAPI rocrand_generate ( rocrand_generator  generator,
unsigned int *  output_data,
size_t  n 
)

Generates uniformly distributed 32-bit unsigned integers.

Generates n uniformly distributed 32-bit unsigned integers and saves them to output_data.

Generated numbers are between 0 and 2^32, including 0 and excluding 2^32.

Parameters
generator- Generator to use
output_data- Pointer to memory to store generated numbers
n- Number of 32-bit unsigned integers to generate
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed
  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator
  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

◆ rocrand_generate_char()

rocrand_status ROCRANDAPI rocrand_generate_char ( rocrand_generator  generator,
unsigned char *  output_data,
size_t  n 
)

Generates uniformly distributed 8-bit unsigned integers.

Generates n uniformly distributed 8-bit unsigned integers and saves them to output_data.

Generated numbers are between 0 and 2^8, including 0 and excluding 2^8.

Parameters
generator- Generator to use
output_data- Pointer to memory to store generated numbers
n- Number of 8-bit unsigned integers to generate
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed
  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator
  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

◆ rocrand_generate_log_normal()

rocrand_status ROCRANDAPI rocrand_generate_log_normal ( rocrand_generator  generator,
float *  output_data,
size_t  n,
float  mean,
float  stddev 
)

Generates log-normally distributed float values.

Generates n log-normally distributed 32-bit floating-point values and saves them to output_data.

Parameters
generator- Generator to use
output_data- Pointer to memory to store generated numbers
n- Number of floats to generate
mean- Mean value of log normal distribution
stddev- Standard deviation value of log normal distribution
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed
  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator
  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

◆ rocrand_generate_log_normal_double()

rocrand_status ROCRANDAPI rocrand_generate_log_normal_double ( rocrand_generator  generator,
double *  output_data,
size_t  n,
double  mean,
double  stddev 
)

Generates log-normally distributed double values.

Generates n log-normally distributed 64-bit double-precision floating-point values and saves them to output_data.

Parameters
generator- Generator to use
output_data- Pointer to memory to store generated numbers
n- Number of doubles to generate
mean- Mean value of log normal distribution
stddev- Standard deviation value of log normal distribution
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed
  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator
  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

◆ rocrand_generate_log_normal_half()

rocrand_status ROCRANDAPI rocrand_generate_log_normal_half ( rocrand_generator  generator,
half *  output_data,
size_t  n,
half  mean,
half  stddev 
)

Generates log-normally distributed half values.

Generates n log-normally distributed 16-bit half-precision floating-point values and saves them to output_data.

Parameters
generator- Generator to use
output_data- Pointer to memory to store generated numbers
n- Number of halfs to generate
mean- Mean value of log normal distribution
stddev- Standard deviation value of log normal distribution
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed
  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator
  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

◆ rocrand_generate_normal()

rocrand_status ROCRANDAPI rocrand_generate_normal ( rocrand_generator  generator,
float *  output_data,
size_t  n,
float  mean,
float  stddev 
)

Generates normally distributed float values.

Generates n normally distributed distributed 32-bit floating-point values and saves them to output_data.

Parameters
generator- Generator to use
output_data- Pointer to memory to store generated numbers
n- Number of floats to generate
mean- Mean value of normal distribution
stddev- Standard deviation value of normal distribution
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed
  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator
  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

◆ rocrand_generate_normal_double()

rocrand_status ROCRANDAPI rocrand_generate_normal_double ( rocrand_generator  generator,
double *  output_data,
size_t  n,
double  mean,
double  stddev 
)

Generates normally distributed double values.

Generates n normally distributed 64-bit double-precision floating-point numbers and saves them to output_data.

Parameters
generator- Generator to use
output_data- Pointer to memory to store generated numbers
n- Number of doubles to generate
mean- Mean value of normal distribution
stddev- Standard deviation value of normal distribution
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed
  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator
  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

◆ rocrand_generate_normal_half()

rocrand_status ROCRANDAPI rocrand_generate_normal_half ( rocrand_generator  generator,
half *  output_data,
size_t  n,
half  mean,
half  stddev 
)

Generates normally distributed half values.

Generates n normally distributed 16-bit half-precision floating-point numbers and saves them to output_data.

Parameters
generator- Generator to use
output_data- Pointer to memory to store generated numbers
n- Number of halfs to generate
mean- Mean value of normal distribution
stddev- Standard deviation value of normal distribution
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed
  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator
  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

◆ rocrand_generate_poisson()

rocrand_status ROCRANDAPI rocrand_generate_poisson ( rocrand_generator  generator,
unsigned int *  output_data,
size_t  n,
double  lambda 
)

Generates Poisson-distributed 32-bit unsigned integers.

Generates n Poisson-distributed 32-bit unsigned integers and saves them to output_data.

Parameters
generator- Generator to use
output_data- Pointer to memory to store generated numbers
n- Number of 32-bit unsigned integers to generate
lambda- lambda for the Poisson distribution
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed
  • ROCRAND_STATUS_OUT_OF_RANGE if lambda is non-positive
  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator
  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

◆ rocrand_generate_short()

rocrand_status ROCRANDAPI rocrand_generate_short ( rocrand_generator  generator,
unsigned short *  output_data,
size_t  n 
)

Generates uniformly distributed 16-bit unsigned integers.

Generates n uniformly distributed 16-bit unsigned integers and saves them to output_data.

Generated numbers are between 0 and 2^16, including 0 and excluding 2^16.

Parameters
generator- Generator to use
output_data- Pointer to memory to store generated numbers
n- Number of 16-bit unsigned integers to generate
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed
  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator
  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

◆ rocrand_generate_uniform()

rocrand_status ROCRANDAPI rocrand_generate_uniform ( rocrand_generator  generator,
float *  output_data,
size_t  n 
)

Generates uniformly distributed float values.

Generates n uniformly distributed 32-bit floating-point values and saves them to output_data.

Generated numbers are between 0.0f and 1.0f, excluding 0.0f and including 1.0f.

Parameters
generator- Generator to use
output_data- Pointer to memory to store generated numbers
n- Number of floats to generate
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed
  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator
  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

◆ rocrand_generate_uniform_double()

rocrand_status ROCRANDAPI rocrand_generate_uniform_double ( rocrand_generator  generator,
double *  output_data,
size_t  n 
)

Generates uniformly distributed double-precision floating-point values.

Generates n uniformly distributed 64-bit double-precision floating-point values and saves them to output_data.

Generated numbers are between 0.0 and 1.0, excluding 0.0 and including 1.0.

Parameters
generator- Generator to use
output_data- Pointer to memory to store generated numbers
n- Number of doubles to generate
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed
  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator
  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

◆ rocrand_generate_uniform_half()

rocrand_status ROCRANDAPI rocrand_generate_uniform_half ( rocrand_generator  generator,
half *  output_data,
size_t  n 
)

Generates uniformly distributed half-precision floating-point values.

Generates n uniformly distributed 16-bit half-precision floating-point values and saves them to output_data.

Generated numbers are between 0.0 and 1.0, excluding 0.0 and including 1.0.

Parameters
generator- Generator to use
output_data- Pointer to memory to store generated numbers
n- Number of halfs to generate
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed
  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator
  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

◆ rocrand_get_version()

rocrand_status ROCRANDAPI rocrand_get_version ( int *  version)

Returns the version number of the library.

Returns in version the version number of the dynamically linked rocRAND library.

Parameters
version- Version of the library
Returns
  • ROCRAND_STATUS_OUT_OF_RANGE if version is NULL
  • ROCRAND_STATUS_SUCCESS if the version number was successfully returned

◆ rocrand_initialize_generator()

rocrand_status ROCRANDAPI rocrand_initialize_generator ( rocrand_generator  generator)

Initializes the generator's state on GPU or host.

Initializes the generator's state on GPU or host. User it not required to call this function before using a generator.

If rocrand_initialize() was not called for a generator, it will be automatically called by functions which generates random numbers like rocrand_generate(), rocrang_generate_uniform() etc.

Parameters
generator- Generator to initialize
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed
  • ROCRAND_STATUS_SUCCESS if the seeds were generated successfully

◆ rocrand_set_offset()

rocrand_status ROCRANDAPI rocrand_set_offset ( rocrand_generator  generator,
unsigned long long  offset 
)

Sets the offset of a random number generator.

Sets the absolute offset of the random number generator.

  • This operation resets the generator's internal state.
  • This operation does not change the generator's seed.

Absolute offset cannot be set if generator's type is ROCRAND_RNG_PSEUDO_MTGP32.

Parameters
generator- Random number generator
offset- New absolute offset
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_SUCCESS if offset was successfully set
  • ROCRAND_STATUS_TYPE_ERROR if generator's type is ROCRAND_RNG_PSEUDO_MTGP32

◆ rocrand_set_quasi_random_generator_dimensions()

rocrand_status ROCRANDAPI rocrand_set_quasi_random_generator_dimensions ( rocrand_generator  generator,
unsigned int  dimensions 
)

Set the number of dimensions of a quasi-random number generator.

Set the number of dimensions of a quasi-random number generator. Supported values of dimensions are 1 to 20000.

  • This operation resets the generator's internal state.
  • This operation does not change the generator's offset.
Parameters
generator- Quasi-random number generator
dimensions- Number of dimensions
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_TYPE_ERROR if the generator is not a quasi-random number generator
  • ROCRAND_STATUS_OUT_OF_RANGE if dimensions is out of range
  • ROCRAND_STATUS_SUCCESS if the number of dimensions was set successfully

◆ rocrand_set_seed()

rocrand_status ROCRANDAPI rocrand_set_seed ( rocrand_generator  generator,
unsigned long long  seed 
)

Sets the seed of a pseudo-random number generator.

Sets the seed of the pseudo-random number generator.

  • This operation resets the generator's internal state.
  • This operation does not change the generator's offset.

For a MRG32K3a generator seed value can't be zero. If seed is equal zero and generator's type is ROCRAND_RNG_PSEUDO_MRG32K3A, value 12345 is used as a seed instead.

Parameters
generator- Pseudo-random number generator
seed- New seed value
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_TYPE_ERROR if the generator is a quasi-random number generator
  • ROCRAND_STATUS_SUCCESS if seed was set successfully

◆ rocrand_set_stream()

rocrand_status ROCRANDAPI rocrand_set_stream ( rocrand_generator  generator,
hipStream_t  stream 
)

Sets the current stream for kernel launches.

Sets the current stream for all kernel launches of the generator. All functions will use this stream.

Parameters
generator- Generator to modify
stream- Stream to use or NULL for default stream
Returns
  • ROCRAND_STATUS_NOT_CREATED if the generator wasn't created
  • ROCRAND_STATUS_SUCCESS if stream was set successfully