muRAND API Reference
1 Introduction
The muRAND library provides functions mainly used to generate high-quality pseudo-random and quasi-random numbers. On top of Moore Threads® MUSA® runtime, this library provides access to parallel computational resources of Moore Threads Graphics Processing Unit (GPU) in a simple and efficient way.
The muRAND consists of random generation functions on the host and device sides. These functions can be called on either hosts or devices, but the random number generation is produced on devices only. In addition, the device side functions offer flexibility to self-define states of random-number generators.
The supported random number generators are listed as follows.
- XORWOW
- MRG32k3a
- MTGP
- Philox_4_32_
- Sobol
- Sobol
- Scrambled Sobol
- Scrambled Sobol
In this version, muRAND supports both single and double precision data types.
2 Module Index
2.1 Modules
Here is a list of all modules:
- Host API
- Device API
3 Module Documentation
3.1 Host API
Macros
- #define MURAND_DEFAULT_MAX_BLOCK_SIZE 256
Typedefs
- typedef enum murandStatus murandStatus_t Returns status codes.
- typedef enum murandRngType murandRngType_t Random number generators are created by calling murandCreateGenerator(). These generators can divided into two groups as follows.
- typedef enum murandOrdering murandOrdering_t The ordering of muRAND generators.
Enumerations
- enum murandStatus {
MURAND_STATUS_SUCCESS = 0 ,
MURAND_STATUS_VERSION_MISMATCH = 100 ,
MURAND_STATUS_NOT_CREATED = 101 ,
MURAND_STATUS_ALLOCATION_FAILED = 102 ,
MURAND_STATUS_TYPE_ERROR = 103 ,
MURAND_STATUS_OUT_OF_RANGE = 104 ,
MURAND_STATUS_LENGTH_NOT_MULTIPLE ,
MURAND_STATUS_DOUBLE_PRECISION_REQUIRED = 106 ,
MURAND_STATUS_LAUNCH_FAILURE = 107 ,
MURAND_STATUS_INTERNAL_ERROR = 108 ,
MURAND_STATUS_NOT_IMPLEMENTED = 1000 }
Returns status codes.
- enum murandRngType {
MURAND_RNG_PSEUDO_DEFAULT = 400 ,
MURAND_RNG_PSEUDO_XORWOW = 401 ,
MURAND_RNG_PSEUDO_MRG32K3A = 402 ,
MURAND_RNG_PSEUDO_MTGP32 = 403 ,
MURAND_RNG_PSEUDO_PHILOX4_32_10 = 404 ,
MURAND_RNG_QUASI_DEFAULT = 500 ,
MURAND_RNG_QUASI_SOBOL32 = 501 ,
MURAND_RNG_QUASI_SCRAMBLED_SOBOL32 = 502 ,
MURAND_RNG_QUASI_SOBOL64 = 504 ,
MURAND_RNG_QUASI_SCRAMBLED_SOBOL64 = 505 }
Random number generators are created by calling murandCreateGenerator(). These generators can divided into two groups as follows.
- enum murandOrdering {
MURAND_ORDERING_PSEUDO_BEST = 100 ,
MURAND_ORDERING_PSEUDO_DEFAULT = 101 ,
MURAND_ORDERING_PSEUDO_SEEDED = 102 ,
MURAND_ORDERING_PSEUDO_LEGACY = 103 ,
MURAND_ORDERING_PSEUDO_DYNAMIC = 104 ,
MURAND_ORDERING_QUASI_DEFAULT = 201 }
The ordering of muRAND generators.
- enum murandDirectionVectorSet {
MURAND_DIRECTION_VECTORS_32_JOEKUO6 ,
MURAND_SCRAMBLED_DIRECTION_VECTORS_32_JOEKUO6 ,
MURAND_DIRECTION_VECTORS_64_JOEKUO6 ,
MURAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO6 }
Functions
-
murandStatus_t MURANDAPI murandCreateGenerator (murandGenerator_t ∗generator, murandRngType_t rng_type)
Creates a new random number generator.
-
murandStatus_t MURANDAPI murandDestroyGenerator (murandGenerator_t generator)
Destroys the specified generator.
-
murandStatus_t MURANDAPI murandGenerate (murandGenerator_t generator, unsigned int ∗output_data, size_t n)
Generates uniformly distributed 32-bit unsigned integers.
-
murandStatus_t MURANDAPI murandGenerateLongLong (murandGenerator_t generator, unsigned long long int ∗output_data, size_t n)
Generates uniformly distributed 64-bit unsigned integers.
-
murandStatus_t MURANDAPI murandGenerateUniform (murandGenerator_t generator, float ∗output_data, size_t n)
Generates uniformly distributed
floatvalues. -
murandStatus_t MURANDAPI murandGenerateUniformDouble (murandGenerator_t generator, double ∗output_data, size_t n)
Generates uniformly distributed double-precision floating-point values.
-
murandStatus_t MURANDAPI murandGenerateNormal (murandGenerator_t generator, float ∗output_data, size_t n, float mean, float stddev)
Generates normally distributed
floatvalues. -
murandStatus_t MURANDAPI murandGenerateNormalDouble (murandGenerator_t generator, double ∗output_data, size_t n, double mean, double stddev)
Generates normally distributed
doublevalues. -
murandStatus_t MURANDAPI murandGenerateLogNormal (murandGenerator_t generator, float ∗output_ data, size_t n, float mean, float stddev)
Generates log-normally distributed
floatvalues. -
murandStatus_t MURANDAPI murandGenerateLogNormalDouble (murandGenerator_t generator, double ∗output_data, size_t n, double mean, double stddev)
Generates log-normally distributed
doublevalues. -
murandStatus_t MURANDAPI murandGeneratePoisson (murandGenerator_t generator, unsigned int ∗output_data, size_t n, double lambda)
Generates Poisson-distributed 32-bit unsigned integers.
-
murandStatus_t MURANDAPI murandGenerateSeeds (murandGenerator_t generator)
Setup starting states.
-
murandStatus_t MURANDAPI murandSetStream (murandGenerator_t generator, MUstream stream)
Sets the current stream for kernel launches.
-
murandStatus_t MURANDAPI murandSetPseudoRandomGeneratorSeed (murandGenerator_t generator, unsigned long long seed)
Sets the seed of the pseudo-random number generator.
-
murandStatus_t MURANDAPI murandSetGeneratorOffset (murandGenerator_t generator, unsigned long long offset)
Sets the offset of the random number generator.
-
murandStatus_t MURANDAPI murandSetGeneratorOrdering (murandGenerator_t generator, murandOrdering_t order)
Sets the order of the random number generator.
-
murandStatus_t MURANDAPI murandSetQuasiRandomGeneratorDimensions (murandGenerator_t genera tor, unsigned int dimensions)
Sets the number of dimensions of a quasi-random number generator.
-
murandStatus_t MURANDAPI murandGetVersion (int ∗version)
Returns the version of the library.
-
murandStatus_t MURANDAPI murandCreatePoissonDistribution (double lambda, murandDiscrete Distribution_t ∗discrete_distribution)
Constructs the histogram of the Poisson distribution.
-
murandStatus_t MURANDAPI murandDestroyDistribution (murandDiscreteDistribution_t discrete_ distribution)
Destroys the histogram array for the discrete distribution.
-
murandStatus_t MURANDAPI murandGetDirectionVectors32 (murandDirectionVectors32_t ∗vectors[ ], murandDirectionVectorSet_t set)
Gets the direction vector used to generate a 32-bit quasi-random number.
-
murandStatus_t MURANDAPI murandGetScrambleConstants32 (unsigned int ∗∗constants)
Gets scramble constants for 32-bit scrambled Sobol'.
-
murandStatus_t MURANDAPI murandGetDirectionVectors64 (murandDirectionVectors64_t ∗vectors[ ], murandDirectionVectorSet_t set)
Gets direction vectors for 64-bit quasirandom number generation.
-
murandStatus_t MURANDAPI murandGetScrambleConstants64 (unsigned long long∗∗constants)
Gets scramble constants for 64-bit scrambled Sobol'.
3.1.1 Detailed Description
This section describes muRAND host API.
3.1.2 Enumeration Type Documentation
3.1.2.1 murandDirectionVectorSet
enum murandDirectionVectorSet
MURAND array of 32-bit direction vectors. MURAND array of 64-bit direction vectors. MURAND choice of direction vector set.
Enumerator
MURAND_DIRECTION_VECTORS_32_JOEKUO6
The specific set of 32-bit direction vectors generated from polynomials, up to 20,000 dimensions.
MURAND_SCRAMBLED_DIRECTION_VECTORS_32_JOEKUO
The specific set of 32-bit direction vectors generated from polynomials, up to 20,000 dimensions, and scrambled.
MURAND_DIRECTION_VECTORS_64_JOEKUO6
The specific set of 64-bit direction vectors generated from polynomials, up to 20,000 dimensions.
MURAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO
The specific set of 64-bit direction vectors generated from polynomials, up to 20,000 dimensions, and scrambled.
3.1.2.2 murandOrdering
enum murandOrdering
The ordering of muRAND generators.
Enumerator
MURAND_ORDERING_PSEUDO_BEST
Optimal ordering of pseudorandom results.
MURAND_ORDERING_PSEUDO_DEFAULT
Default ordering of pseudorandom results.
MURAND_ORDERING_PSEUDO_SEEDED
Fast, lowe-quality pseudorandom results.
MURAND_ORDERING_PSEUDO_LEGACY
Legacy ordering of pseudorandom results.
MURAND_ORDERING_PSEUDO_DYNAMIC
Adjust the device executing the generator.
MURAND_ORDERING_QUASI_DEFAULT
n-dimensional ordering of quasirandom results.
3.1.2.3 murandRngType
enum murandRngType
Random number generators are created by calling murandCreateGenerator(). These generators can divided into two groups as follows.
Enumerator
MURAND_RNG_PSEUDO_DEFAULT
Default pseudorandom generator.
MURAND_RNG_PSEUDO_XORWOW
XORWOW pseudorandom generator.
MURAND_RNG_PSEUDO_MRG32K3A
MRG32k3a pseudorandom generator.
MURAND_RNG_PSEUDO_MTGP32
Mersenne Twister MTGP32 pseudorandom generator.
MURAND_RNG_PSEUDO_PHILOX4_32_10
PHILOX-4x32-10 pseudorandom generator.
MURAND_RNG_QUASI_DEFAULT
Default quasirandom generator.
MURAND_RNG_QUASI_SOBOL32
Sobol32 quasirandom generator.
MURAND_RNG_QUASI_SCRAMBLED_SOBOL32
Scrambled Sobol32 quasirandom generator.
MURAND_RNG_QUASI_SOBOL64
Sobol64 quasirandom generator.
MURAND_RNG_QUASI_SCRAMBLED_SOBOL64
Scrambled Sobol64 quasirandom generator.
3.1.2.4 murandStatus
enum murandStatus
Returns status codes.
Enumerator
MURAND_STATUS_SUCCESS
The muRAND operation was successful.
MURAND_STATUS_VERSION_MISMATCH
Unmatched header file and linked library version.
MURAND_STATUS_NOT_CREATED
The generator was not created by murandCreateGenerator().
MURAND_STATUS_ALLOCATION_FAILED
Failed to allocate memory.
MURAND_STATUS_TYPE_ERROR
Generator type error.
MURAND_STATUS_OUT_OF_RANGE
The passed argument is out of range.
MURAND_STATUS_LENGTH_NOT_MULTIPLE
Requested size is not a multiple of quasirandom generator's dimension, or requested size is not even (see murandGenerateNormal()), or pointer is misaligned (see murandGenerateNormal())
MURAND_STATUS_DOUBLE_PRECISION_ REQUIRED
Double precision is not supported on GPUs.
MURAND_STATUS_LAUNCH_FAILURE
Failed to kernel launch.
MURAND_STATUS_INTERNAL_ERROR
Internal library error.
MURAND_STATUS_NOT_IMPLEMENTED
The function is not implemented yet.
3.1.3 Function Documentation
3.1.3.1 murandCreateGenerator()
murandStatus_t MURANDAPI murandCreateGenerator (
murandGenerator_t ∗generator,
murandRngType_trng_type)
Creates a new random number generator.
Creates a new random number generator of typerng_typeand returns it ingenerator.
Supportedrng_typeas follows:
- MURAND_RNG_PSEUDO_XORWOW
- MURAND_RNG_PSEUDO_MRG32K3A
- MURAND_RNG_PSEUDO_MTGP
- MURAND_RNG_PSEUDO_PHILOX4_32_
- MURAND_RNG_QUASI_SOBOL
- MURAND_RNG_QUASI_SCRAMBLED_SOBOL
- MURAND_RNG_QUASI_SOBOL
- MURAND_RNG_QUASI_SCRAMBLED_SOBOL
Parameters generator Pointer to generator. rng_type Type of generator to create.
Return values MURAND_STATUS_SUCCESS muRAND successfully created the generator. MURAND_STATUS_ALLOCATION_FAILED Failed to allocate memory. MURAND_STATUS_VERSION_MISMATCH The header file version and the dynamically linked library version are not match. MURAND_STATUS_TYPE_ERROR The value ofrng_typeis invalid.
3.1.3.2 murandCreatePoissonDistribution()
murandStatus_t MURANDAPI murandCreatePoissonDistribution (
double lambda,
murandDiscreteDistribution_t ∗discrete_distribution)
Constructs the histogram of the Poisson distribution.
Constructs the histogram of the Poisson distribution with lambdalambda.
Parameters
lambda - lambda for the Poisson distribution.
discrete_distribution - Pointer to the histogram in device memory.
Return values
MURAND_STATUS_SUCCESS - If the histogram was constructed successfully.
MURAND_STATUS_ALLOCATION_FAILED - If memory could not be allocated.
MURAND_STATUS_OUT_OF_RANGE - If discrete_distribution pointer was null.
MURAND_STATUS_OUT_OF_RANGE - If lambda is non-positive.
3.1.3.3 murandDestroyDistribution()
murandStatus_t MURANDAPI murandDestroyDistribution (
murandDiscreteDistribution_tdiscrete_distribution)
Destroys the histogram array for the discrete distribution.
Destroys the histogram array for the discrete distribution created by murandCreatePoissonDistribution().
Parameters
discrete_distribution - Pointer to the histogram in device memory.
Return values
MURAND_STATUS_OUT_OF_RANGE - Ifdiscrete_distributionwas null.
MURAND_STATUS_SUCCESS - If the histogram was destroyed successfully.
3.1.3.4 murandDestroyGenerator()
murandStatus_t MURANDAPI murandDestroyGenerator (
murandGenerator_tgenerator)
Destroys the specified generator.
Destroys a random number generator and frees related memory.
Parameters
generator - Generator to be destroyed.
Return values
MURAND_STATUS_SUCCESS muRAND successfully destroyed the generator.
MURAND_STATUS_NOT_CREATED The generator was not created.
3.1.3.5 murandGenerate()
murandStatus_t MURANDAPI murandGenerate (
murandGenerator_tgenerator,
unsigned int ∗output_data,
size_tn)
Generates uniformly distributed 32-bit unsigned integers.
Generatesnuniformly distributed 32-bit unsigned integers and saves them tooutput_data.
The numbers are between 0 and 2 ∧ 32 , including 0 and excluding 2 ∧ 32.
Parameters
generator - Generator to use.
output_data - Pointer to memory that stores generated numbers.
n - Number of 32-bit unsigned integers to generate.
Return values
MURAND_STATUS_SUCCESS - If random numbers were successfully generated.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
Return values
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
MURAND_STATUS_LENGTH_NOT_MULTIPLE - If n is not a multiple of the dimension of the used
quasi-random generator.
3.1.3.6 murandGenerateLogNormal()
murandStatus_t MURANDAPI murandGenerateLogNormal (
murandGenerator_tgenerator,
float ∗output_data,
size_tn,
float mean,
float stddev)
Generates log-normally distributed float values.
Generatesnlog-normally distributed 32-bit floating-point values and saves them tooutput_data.
Parameters
generator - Generator to use.
output_data - Pointer to memory that stores generated numbers.
n - Number of floats to generate.
mean - The mean value of log-normal distribution.
stddev - The standard deviation value of log-normal distribution.
Return values
MURAND_STATUS_SUCCESS - If random numbers were successfully generated.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
MURAND_STATUS_LENGTH_NOT_MULTIPLE - If n is not a multiple of the dimension of used quasi-random generator.
3.1.3.7 murandGenerateLogNormalDouble()
murandStatus_t MURANDAPI murandGenerateLogNormalDouble (
murandGenerator_t 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 that stores generated numbers.
n - Number of doubles to generate.
mean - The mean value of log-normal distribution.
stddev - The standard deviation value of log-normal distribution.
Return values
MURAND_STATUS_SUCCESS - If random numbers were successfully generated.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
MURAND_STATUS_LENGTH_NOT_FAILURE - If n is not a multiple of the dimension of the used quasi-random generator.
3.1.3.8 murandGenerateLongLong()
murandStatus_t MURANDAPI murandGenerateLongLong (
murandGenerator_t 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.
The numbers are between 0 and 2 ∧ 64 , including 0 and excluding 2 ∧ 64.
Parameters
generator - Generator to use.
output_data - Pointer to memory that stores generated numbers.
n - Number of 64-bit unsigned integers to generate.
Return values
MURAND_STATUS_SUCCESS - If random numbers were successfully generated.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
MURAND_STATUS_LENGTH_NOT_FAILURE - If n is not a multiple of the dimension of the used quasi-random generator.
MURAND_TYPE_ERROR - If the generator cannot generate 64-bit random numbers locally.
3.1.3.9 murandGenerateNormal()
murandStatus_t MURANDAPI murandGenerateNormal (
murandGenerator_t 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 that stores generated numbers.
n - Number of floats to generate.
mean - The mean value of the normal distribution.
stddev - The standard deviation value of the normal distribution.
Return values
MURAND_STATUS_SUCCESS - If random numbers were successfully generated.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
MURAND_STATUS_LENGTH_NOT_MULTIPLE - If n is not a multiple of the dimension of the used quasi-random generator.
3.1.3.10 murandGenerateNormalDouble()
murandStatus_t MURANDAPI murandGenerateNormalDouble (
murandGenerator_t 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 that stores generated numbers.
n - Number of doubles to generate.
mean - The mean value of the normal distribution.
stddev - The standard deviation value of the normal distribution.
Return values
MURAND_STATUS_SUCCESS - If random numbers were successfully generated.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
MURAND_STATUS_LENGTH_NOT_MULTIPLE - If n is not a multiple of the dimension of the used
quasi-random generator.
3.1.3.11 murandGeneratePoisson()
murandStatus_t MURANDAPI murandGeneratePoisson (
murandGenerator_t 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 that stores generated numbers.
n - Number of 32-bit unsigned integers to generate.
lambda - The lambda of the Poisson distribution.
Return values
MURAND_STATUS_SUCCESS - If random numbers were successfully generated.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
MURAND_STATUS_OUT_OF_RANGE - If lambda is non-positive.
MURAND_STATUS_LENGTH_NOT_FAILURE - If n is not a multiple of the dimension of the used quasi-random generator.
3.1.3.12 murandGenerateSeeds()
murandStatus_t MURANDAPI murandGenerateSeeds (
murandGenerator_t generator)
Setup starting states.
Initializes the state of the generator on GPU or host. Users do not need to call this function before using a generator.
If murand_initialize() was not called for a generator, it will be automatically called by a function that generates random numbers (such as murandGenerate(), etc.).
Parameters
generator - Generator to initialize.
Return values
MURAND_STATUS_SUCCESS - If the seeds were generated successfully.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
3.1.3.13 murandGenerateUniform()
murandStatus_t MURANDAPI murandGenerateUniform (
murandGenerator_t 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.
The 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 that stores generated numbers.
n - Number of floats to generate.
Return values
MURAND_STATUS_SUCCESS - If random numbers were successfully generated.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
MURAND_STATUS_LENGTH_NOT_FAILURE - If n is not a multiple of the dimension of the used quasi-random generator.
3.1.3.14 murandGenerateUniformDouble()
murandStatus_t MURANDAPI murandGenerateUniformDouble (
murandGenerator_t 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.
The 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 that stores generated numbers.
n - Number of doubles to generate.
Return values
MURAND_STATUS_SUCCESS - If random numbers were successfully generated.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
MURAND_STATUS_LENGTH_NOT_FAILURE - If n is not a multiple of the dimension of the used quasi-random generator.
3.1.3.15 murandGetDirectionVectors32()
murandStatus_t MURANDAPI murandGetDirectionVectors32 (
murandDirectionVectors32_t ∗vectors[],
murandDirectionVectorSet_t set )
Gets the direction vector used to generate a 32-bit quasi-random number.
Gets a pointer to an array of direction vectors that can be used to generate quasirandom number. The resulting pointer will reference an array of direction vectors in host memory.
The array contains vectors with multiple dimensions. Each dimension has 32 vectors. Each vector is an unsigned int.
Supported values of set as follows:
- MURAND_DIRECTION_VECTORS_32_JOEKUO6 (20,000 dimensions).
- MURAND_SCRAMBLED_DIRECTION_VECTORS_32_JOEKUO6 (20,000 dimensions).
Parameters
vectors - Address of pointer in which to return direction vectors.
set - Set of direction vectors to use.
Return values
MURAND_STATUS_SUCCESS - If the pointer was set successfully.
MURAND_STATUS_OUT_OF_RANGE - If the choice of set is invalid.
3.1.3.16 murandGetDirectionVectors64()
murandStatus_t MURANDAPI murandGetDirectionVectors64 (
murandDirectionVectors64_t ∗vectors[],
murandDirectionVectorSet_tset )
Gets direction vectors for 64-bit quasirandom number generation.
Gets a pointer to an array of direction vectors that can be used to generate quasirandom number. The resulting pointer will reference an array of direction vectors in host memory.
The array contains vectors with multiple dimensions. Each dimension has 64 vectors. Each individual vector is an unsigned long long.
Supported values of set as follows:
- MURAND_DIRECTION_VECTORS_64_JOEKUO6 (20,000 dimensions).
- MURAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO6 (20,000 dimensions).
Parameters
vectors - Address of pointer in which to return direction vectors.
set - Set of direction vectors to use.
Return values
MURAND_STATUS_OUT_OF_RANGE - If the choice of set is invalid.
MURAND_STATUS_SUCCESS - If the pointer was set successfully.
3.1.3.17 murandGetScrambleConstants32()
murandStatus_t MURANDAPI murandGetScrambleConstants32 (
unsigned int ∗∗constants)
Gets scramble constants for 32-bit scrambled Sobol'.
Gets a pointer to an array of scramble constants that can be used to generate quasirandom number. The resulting pointer will reference an array of unsinged ints in host memory.
The array contains vectors with multiple dimensions. Each dimension has a single unsigned int constant.
Parameters
constants - Address of pointer in which to return scramble constants.
Return values
MURAND_STATUS_SUCCESS - If the pointer was set successfully.
3.1.3.18 murandGetScrambleConstants64()
murandStatus_t MURANDAPI murandGetScrambleConstants64 (
unsigned long long∗∗constants)
Gets scramble constants for 64-bit scrambled Sobol'.
Gets a pointer to an array of scramble constants that can be used to generate quasirandom number. The resulting pointer will reference an array of unsinged long longs in host memory.
The array contains constants with multiple dimensions. Each dimension has a single unsigned long long constant.
Parameters
constants - Address of pointer in which to return scramble constants.
Return values
MURAND_STATUS_SUCCESS - If the pointer was set successfully.
3.1.3.19 murandGetVersion()
murandStatus_t MURANDAPI murandGetVersion (
int ∗version )
Returns the version of the library.
Returns in version the version of the dynamically linked muRAND library.
Parameters
version - The version of the library.
Return values
MURAND_STATUS_OUT_OF_RANGE - If version is NULL. MURAND_STATUS_SUCCESS - If the version was returned successfully.
3.1.3.20 murandSetGeneratorOffset()
murandStatus_t MURANDAPI murandSetGeneratorOffset (
murandGenerator_t generator,
unsigned long long offset)
Sets the offset of the random number generator. Sets the absolute offset of the random number generator. This function will reset the internal state of the generator, but will not change the seed of the generator. Note that the absolute offset cannot be set if the type of generator is MURAND_RNG_PSEUDO_MTGP32.
Parameters
generator - Random number generator.
offset - New absolute offset.
Return values
MURAND_STATUS_SUCCESS - If offset was set successfully.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_TYPE_ERROR - If the generator's type is MURAND_RNG_PSEUDO_MTGP32.
3.1.3.21 murandSetGeneratorOrdering()
murandStatus_t MURANDAPI murandSetGeneratorOrdering (
murandGenerator_t generator,
murandOrdering_t order)
Sets the order of the random number generator.
Sets the ordering of random number generator results. This function will reset the internal state of the generator, but will not change the seed of the generator.
Parameters
generator - Random number generator.
order - New ordering of results.
The ordering choices for pseudorandom sequences are MURAND_ORDERING_PSEUDO_DEFAULT and MURAND_ORDERING_PSEUDO_LEGACY. The default ordering is MURAND_ORDERING_PSEUDO_DEFAULT, which is currently equal to MURAND_ORDERING_PSEUDO_LEGACY.
For quasirandom sequences, there is only one ordering MURAND_ORDERING_QUASI_DEFAULT.
Return values
MURAND_STATUS_SUCCESS - If the ordering was set successfully.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_OUT_OF_RANGE - If the ordering is not valid.
MURAND_STATUS_TYPE_ERROR - If the type of generator is not valid.
3.1.3.22 murandSetPseudoRandomGeneratorSeed()
murandStatus_t MURANDAPI murandSetPseudoRandomGeneratorSeed (
murandGenerator_t generator,
unsigned long long seed)
Sets the seed of the pseudo-random number generator.
This function will reset the internal state of the generator, but will not change the offset of the generator.
For the MRG32K3a generator, the seed value cannot be zero. If seed is equal to zero and the typr of the generator
is MURAND_RNG_PSEUDO_MRG32K3A, then 12345 will be used as the seed value.
Parameters
generator - Pseudo-random number generator.
seed - The value of seed.
Return values
MURAND_STATUS_SUCCESS - If seed was set successfully.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_TYPE_ERROR - If the generator is a quasi-random number generator.
3.1.3.23 murandSetQuasiRandomGeneratorDimensions()
murandStatus_t MURANDAPI murandSetQuasiRandomGeneratorDimensions (
murandGenerator_t generator,
unsigned int dimensions)
Sets the number of dimensions of a quasi-random number generator.
Sets the number of dimensions of a quasi-random number generator. Supported values of dimensions are 1 to
20000.
This function will reset the internal state of the generator, but will not change the offset of the generator.
Parameters
generator - Quasi-random number generator.
dimensions - Number of dimensions.
Return values
MURAND_STATUS_SUCCESS - If the number of dimensions was set successfully.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_TYPE_ERROR - If the generator is not a quasi-random number generator.
MURAND_STATUS_OUT_OF_RANGE - If dimensions is out of range.
3.1.3.24 murandSetStream()
murandStatus_t MURANDAPI murandSetStream (
murandGenerator_t generator,
MUstream 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 until set again.
Parameters
generator - Generator to modify.
stream - Stream to use or NULL for default stream.
Return values
MURAND_STATUS_SUCCESS - If stream was set successfully.
MURAND_STATUS_NOT_CREATED - If the generator was not created.