|
rocRAND
|
Macros | |
| #define | ROCRAND_DEFAULT_MAX_BLOCK_SIZE 256 |
| The default maximum number of threads per block. | |
Typedefs | |
| typedef enum rocrand_status | rocrand_status |
| rocRAND function call status type | |
| typedef enum rocrand_rng_type | rocrand_rng_type |
| rocRAND generator type | |
| typedef enum rocrand_ordering | rocrand_ordering |
| rocRAND generator ordering | |
| typedef enum rocrand_direction_vector_set | rocrand_direction_vector_set |
| rocRAND vector set | |
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_long_long (rocrand_generator generator, unsigned long long int *output_data, size_t n) |
| Generates uniformly distributed 64-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_seed_uint4 (rocrand_generator generator, uint4 seed) |
| Sets the seeds 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_ordering (rocrand_generator generator, rocrand_ordering order) |
| Sets the ordering 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... | |
| rocrand_status ROCRANDAPI | rocrand_get_direction_vectors32 (const unsigned int **vectors, rocrand_direction_vector_set set) |
| Get the vector for 32-bit (scrambled-)sobol generation. More... | |
| rocrand_status ROCRANDAPI | rocrand_get_direction_vectors64 (const unsigned long long **vectors, rocrand_direction_vector_set set) |
| Get the vector for 64-bit (scrambled-)sobol generation. More... | |
| rocrand_status ROCRANDAPI | rocrand_get_scramble_constants32 (const unsigned int **constants) |
| Get the scramble constants for 32-bit scrambled sobol generation. More... | |
| rocrand_status ROCRANDAPI | rocrand_get_scramble_constants64 (const unsigned long long **constants) |
| Get the scramble constants for 64-bit scrambled sobol generation. More... | |
| enum rocrand_ordering |
rocRAND generator ordering
| enum rocrand_rng_type |
rocRAND generator type
| enum 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. |
| 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.
| 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 |
discrete_distribution pointer was null size was zero | 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:
| generator | - Pointer to generator |
| rng_type | - Type of generator to create |
rng_type is invalid | 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.
| lambda | - lambda for the Poisson distribution |
| discrete_distribution | - pointer to the histogram in device memory |
discrete_distribution pointer was null | 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.
| discrete_distribution | - pointer to the histogram in device memory |
discrete_distribution was null | rocrand_status ROCRANDAPI rocrand_destroy_generator | ( | rocrand_generator | generator | ) |
Destroys random number generator.
Destroys random number generator and frees related memory.
| generator | - Generator to be destroyed |
| 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.
| generator | - Generator to use |
| output_data | - Pointer to memory to store generated numbers |
| n | - Number of 32-bit unsigned integers to generate |
n is not a multiple of the dimension of used quasi-random generator | 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.
| generator | - Generator to use |
| output_data | - Pointer to memory to store generated numbers |
| n | - Number of 8-bit unsigned integers to generate |
n is not a multiple of the dimension of used quasi-random generator | 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.
| 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 |
n is not a multiple of the dimension of used quasi-random generator | 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.
| 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 |
n is not a multiple of the dimension of used quasi-random generator | 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.
| 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 |
n is not a multiple of the dimension of used quasi-random generator | rocrand_status ROCRANDAPI rocrand_generate_long_long | ( | rocrand_generator | generator, |
| unsigned long long int * | output_data, | ||
| size_t | n | ||
| ) |
Generates uniformly distributed 64-bit unsigned integers.
Generates n uniformly distributed 64-bit unsigned integers and saves them to output_data.
Generated numbers are between 0 and 2^64, including 0 and excluding 2^64.
| generator | - Generator to use |
| output_data | - Pointer to memory to store generated numbers |
| n | - Number of 64-bit unsigned integers to generate |
n is not a multiple of the dimension of used quasi-random generator | 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.
| 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 |
n is not a multiple of the dimension of used quasi-random generator | 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.
| 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 |
n is not a multiple of the dimension of used quasi-random generator | 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.
| 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 |
n is not a multiple of the dimension of used quasi-random generator | 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.
| 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 |
n is not a multiple of the dimension of used quasi-random generator | 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.
| generator | - Generator to use |
| output_data | - Pointer to memory to store generated numbers |
| n | - Number of 16-bit unsigned integers to generate |
n is not a multiple of the dimension of used quasi-random generator | 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.
| generator | - Generator to use |
| output_data | - Pointer to memory to store generated numbers |
| n | - Number of floats to generate |
n is not a multiple of the dimension of used quasi-random generator | 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.
| generator | - Generator to use |
| output_data | - Pointer to memory to store generated numbers |
| n | - Number of doubles to generate |
n is not a multiple of the dimension of used quasi-random generator | 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.
| generator | - Generator to use |
| output_data | - Pointer to memory to store generated numbers |
| n | - Number of halfs to generate |
n is not a multiple of the dimension of used quasi-random generator | rocrand_status ROCRANDAPI rocrand_get_direction_vectors32 | ( | const unsigned int ** | vectors, |
| rocrand_direction_vector_set | set | ||
| ) |
Get the vector for 32-bit (scrambled-)sobol generation.
| vectors | - location where to write the vector pointer to |
| set | - which direction vector set to use |
set was invalid for this method | rocrand_status ROCRANDAPI rocrand_get_direction_vectors64 | ( | const unsigned long long ** | vectors, |
| rocrand_direction_vector_set | set | ||
| ) |
Get the vector for 64-bit (scrambled-)sobol generation.
| vectors | - location where to write the vector pointer to |
| set | - which direction vector set to use |
set was invalid for this method | rocrand_status ROCRANDAPI rocrand_get_scramble_constants32 | ( | const unsigned int ** | constants | ) |
Get the scramble constants for 32-bit scrambled sobol generation.
| constants | - location where to write the constants pointer to |
| rocrand_status ROCRANDAPI rocrand_get_scramble_constants64 | ( | const unsigned long long ** | constants | ) |
Get the scramble constants for 64-bit scrambled sobol generation.
| constants | - location where to write the constants pointer to |
| 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.
| version | - Version of the library |
version is NULL | 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(), rocrand_generate_uniform() etc.
| generator | - Generator to initialize |
| 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.
Absolute offset cannot be set if generator's type is ROCRAND_RNG_PSEUDO_MTGP32 or ROCRAND_RNG_PSEUDO_LFSR113.
| generator | - Random number generator |
| offset | - New absolute offset |
| rocrand_status ROCRANDAPI rocrand_set_ordering | ( | rocrand_generator | generator, |
| rocrand_ordering | order | ||
| ) |
Sets the ordering of a random number generator.
Sets the ordering of the results of a random number generator.
| generator | - Random number generator |
| order | - New ordering of results |
The ordering choices for pseudorandom sequences are ROCRAND_ORDERING_PSEUDO_DEFAULT and ROCRAND_ORDERING_PSEUDO_LEGACY. The default ordering is ROCRAND_ORDERING_PSEUDO_DEFAULT, which is equal to ROCRAND_ORDERING_PSEUDO_LEGACY for now.
For quasirandom sequences there is only one ordering, ROCRAND_ORDERING_QUASI_DEFAULT.
| 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.
| generator | - Quasi-random number generator |
| dimensions | - Number of dimensions |
dimensions is out of range | 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.
For an MRG32K3a or MRG31K3p generator the seed value can't be zero. If seed is equal to zero and generator's type is ROCRAND_RNG_PSEUDO_MRG32K3A or ROCRAND_RNG_PSEUDO_MRG31K3P, value 12345 is used as seed instead.
For a LFSR113 generator seed values must be larger than 1, 7, 15,
seed upper and lower 32 bits used as first and second seed value. If those values smaller than 2 and/or 8, those are increased with 1 and/or 7.| generator | - Pseudo-random number generator |
| seed | - New seed value |
| rocrand_status ROCRANDAPI rocrand_set_seed_uint4 | ( | rocrand_generator | generator, |
| uint4 | seed | ||
| ) |
Sets the seeds of a pseudo-random number generator.
Sets the seed of the pseudo-random number generator. Currently only for LFSR113
Only usable for LFSR113.
For a LFSR113 generator seed values must be bigger than 1, 7, 15,
| generator | - Pseudo-random number generator |
| seed | - New seed value |
| 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.
| generator | - Generator to modify |
| stream | - Stream to use or NULL for default stream |
1.8.13