rocm.bindings.hiprand#
2026-09-24
26 min read time
Advanced Micro Devices, Inc.
Attributes#
Classes#
(No short description) |
|
Represents a discrete probability distribution |
|
(No short description) |
|
rocRAND function call status type |
|
rocRAND generator type |
|
rocRAND generator ordering |
|
rocRAND vector set |
|
hipRAND function call status type |
|
hipRAND generator type |
|
hipRAND generator ordering |
|
hipRAND vector set for quasirandom generators. |
Functions#
|
|
|
Creates a new random number generator. |
|
Creates a new random number generator on host. |
|
Destroys random number generator. |
|
Generates uniformly distributed 32-bit unsigned integers. |
|
Generates uniformly distributed 8-bit unsigned integers. |
|
Generates uniformly distributed 16-bit unsigned integers. |
|
Generates uniformly distributed 64-bit unsigned integers. |
|
Generates uniformly distributed floats. |
|
Generates uniformly distributed double-precision floating-point values. |
|
Generates uniformly distributed half-precision floating-point values. |
|
Generates normally distributed floats. |
|
Generates normally distributed doubles. |
|
Generates normally distributed halfs. |
|
Generates log-normally distributed floats. |
|
Generates log-normally distributed doubles. |
|
Generates log-normally distributed halfs. |
|
Generates Poisson-distributed 32-bit unsigned integers. |
|
Initializes the generator's state on GPU or host. |
|
Sets the current stream for kernel launches. |
|
Sets the seed of a pseudo-random number generator. |
|
Sets the offset of a random number generator. |
|
Sets the ordering of a random number generator. |
|
Set the number of dimensions of a quasi-random number generator. |
Returns the version number of the cuRAND or rocRAND library. |
|
|
Construct the histogram for a Poisson distribution. |
|
Destroy the histogram array for a discrete distribution. |
|
Retrieves the Sobol 32 direction vector array specified by |
|
Retrieves the Sobol 64 direction vector array specified by |
|
Retrieves the scramble constants for 32-bit scrambled Sobol generation. |
|
Retrieves the scramble constants for 64-bit scrambled Sobol generation. |
Module Contents#
- rocm.bindings.hiprand.HIPRAND_VERSION: Any#
- rocm.bindings.hiprand.HIPRAND_DEFAULT_MAX_BLOCK_SIZE: Any#
- rocm.bindings.hiprand.HIPRAND_DEFAULT_MIN_WARPS_PER_EU: Any#
- class rocm.bindings.hiprand.uint4(*args, **kwargs)#
Bases:
rocm.bindings.util.types.Pointer(No short description)
- x: Any#
- y: Any#
- z: Any#
- w: Any#
- static fromObj(pyobj) Any#
- as_c_void_p() Any#
- class rocm.bindings.hiprand.rocrand_discrete_distribution_st(*args, **kwargs)#
Bases:
rocm.bindings.util.types.PointerRepresents a discrete probability distribution
- size: Any#
- offset: Any#
- alias: Any#
- probability: Any#
- cdf: Any#
- static fromObj(pyobj) Any#
- as_c_void_p() Any#
- rocm.bindings.hiprand.rocrand_discrete_distribution#
- class rocm.bindings.hiprand.rocrand_generator_base_type(*args, **kwargs)#
Bases:
rocm.bindings.util.types.Pointer(No short description)
- rocm.bindings.hiprand.rocrand_generator#
- class rocm.bindings.hiprand.rocrand_status#
Bases:
enum.IntEnumrocRAND function call status type
- class rocm.bindings.hiprand.rocrand_rng_type#
Bases:
enum.IntEnumrocRAND generator type
- class rocm.bindings.hiprand.rocrand_ordering#
Bases:
enum.IntEnumrocRAND generator ordering
- class rocm.bindings.hiprand.rocrand_direction_vector_set#
Bases:
enum.IntEnumrocRAND vector set
- rocm.bindings.hiprand.hiprandGenerator_st#
- rocm.bindings.hiprand.hiprandDiscreteDistribution_st#
- rocm.bindings.hiprand.hiprandGenerator_t#
- rocm.bindings.hiprand.hiprandDiscreteDistribution_t#
- class rocm.bindings.hiprand.hiprandStatus#
Bases:
enum.IntEnumhipRAND function call status type
- rocm.bindings.hiprand.hiprandStatus_t#
- class rocm.bindings.hiprand.hiprandRngType#
Bases:
enum.IntEnumhipRAND generator type
- rocm.bindings.hiprand.hiprandRngType_t#
- class rocm.bindings.hiprand.hiprandOrdering#
Bases:
enum.IntEnumhipRAND generator ordering
- rocm.bindings.hiprand.hiprandOrdering_t#
- class rocm.bindings.hiprand.hiprandDirectionVectorSet#
Bases:
enum.IntEnumhipRAND vector set for quasirandom generators.
- rocm.bindings.hiprand.hiprandDirectionVectorSet_t#
- rocm.bindings.hiprand.hiprandCreateGenerator(rng_type)#
Creates a new random number generator.
Creates a new random number generator of type
rng_type,and returns it ingenerator.That generator will use GPU to create random numbers.Values for
rng_typeare: - HIPRAND_RNG_PSEUDO_DEFAULT - HIPRAND_RNG_PSEUDO_XORWOW - HIPRAND_RNG_PSEUDO_MRG32K3A - HIPRAND_RNG_PSEUDO_MTGP32 - HIPRAND_RNG_PSEUDO_MT19937 - HIPRAND_RNG_PSEUDO_PHILOX4_32_10 - HIPRAND_RNG_QUASI_DEFAULT - HIPRAND_RNG_QUASI_SOBOL32 - HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL32 - HIPRAND_RNG_QUASI_SOBOL64 - HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL64- Args:
- rng_type (
hiprandRngType): Type of random number generator to create
- rng_type (
- Returns:
A
tupleof size 2 that contains (in that order):hiprandStatus: HIPRAND_STATUS_ALLOCATION_FAILED, if memory allocation failedHIPRAND_STATUS_INITIALIZATION_FAILED if there was a problem setting up the GPU
HIPRAND_STATUS_VERSION_MISMATCH if the header file version does not match the dynamically linked library version
HIPRAND_STATUS_TYPE_ERROR if the value for
rng_typeis invalidHIPRAND_STATUS_NOT_IMPLEMENTED if generator of type
rng_typeis not implemented yetHIPRAND_STATUS_SUCCESS if generator was created successfully
rocrand_generator_base_type:Pointer to generator
C signature
hiprandStatus_t hiprandCreateGenerator(hiprandGenerator_t * generator, hiprandRngType_t rng_type)
- rocm.bindings.hiprand.hiprandCreateGeneratorHost(rng_type)#
Creates a new random number generator on host.
Creates a new host random number generator of type
rng_typeand returns it ingenerator.Created generator will use host CPU to generate random numbers.Values for
rng_typeare: - HIPRAND_RNG_PSEUDO_DEFAULT - HIPRAND_RNG_PSEUDO_XORWOW - HIPRAND_RNG_PSEUDO_MRG32K3A - HIPRAND_RNG_PSEUDO_MTGP32 - HIPRAND_RNG_PSEUDO_MT19937 - HIPRAND_RNG_PSEUDO_PHILOX4_32_10 - HIPRAND_RNG_QUASI_DEFAULT - HIPRAND_RNG_QUASI_SOBOL32 - HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL32 - HIPRAND_RNG_QUASI_SOBOL64 - HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL64- Args:
- rng_type (
hiprandRngType): Type of random number generator to create
- rng_type (
- Returns:
A
tupleof size 2 that contains (in that order):hiprandStatus: HIPRAND_STATUS_ALLOCATION_FAILED, if memory allocation failedHIPRAND_STATUS_VERSION_MISMATCH if the header file version does not match the dynamically linked library version
HIPRAND_STATUS_TYPE_ERROR if the value for
rng_typeis invalidHIPRAND_STATUS_NOT_IMPLEMENTED if host generator of type
rng_typeis not implemented yetHIPRAND_STATUS_SUCCESS if generator was created successfully
rocrand_generator_base_type:Pointer to generator
C signature
hiprandStatus_t hiprandCreateGeneratorHost(hiprandGenerator_t * generator, hiprandRngType_t rng_type)
- rocm.bindings.hiprand.hiprandDestroyGenerator(generator)#
Destroys random number generator.
Destroys random number generator and frees related memory.
- Args:
- generator (
rocrand_generator_base_type/object): Generator to be destroyed
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_SUCCESS if generator was destroyed successfully
C signature
hiprandStatus_t hiprandDestroyGenerator(hiprandGenerator_t generator)
- rocm.bindings.hiprand.hiprandGenerate(generator, output_data, n)#
Generates uniformly distributed 32-bit unsigned integers.
Generates
nuniformly distributed 32-bit unsigned integers and saves them tooutput_data.Generated numbers are between
0and2^32,including0and excluding2^32.Note:
generatormust be not be of typeHIPRAND_RNG_QUASI_SOBOL64orHIPRAND_RNG_QUASI_SCRAMBLED_SOBOL64.- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
PointerToUnsigned/object): Pointer to memory to store generated numbers
- n (
int): Number of 32-bit unsigned integers to generate
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_SUCCESS if random numbers were successfully generated
C signature
hiprandStatus_t hiprandGenerate(hiprandGenerator_t generator, unsigned int * output_data, size_t n)
- rocm.bindings.hiprand.hiprandGenerateChar(generator, output_data, n)#
Generates uniformly distributed 8-bit unsigned integers.
Generates
nuniformly distributed 8-bit unsigned integers and saves them tooutput_data.Generated numbers are between
0and2^8,including0and excluding2^8.- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
Pointer/object): Pointer to memory to store generated numbers
- n (
int): Number of 8-bit unsigned integers to generate
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_SUCCESS if random numbers were successfully generated
C signature
hiprandStatus_t hiprandGenerateChar(hiprandGenerator_t generator, unsigned char * output_data, size_t n)
- rocm.bindings.hiprand.hiprandGenerateShort(generator, output_data, n)#
Generates uniformly distributed 16-bit unsigned integers.
Generates
nuniformly distributed 16-bit unsigned integers and saves them tooutput_data.Generated numbers are between
0and2^16,including0and excluding2^16.- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
Pointer/object): Pointer to memory to store generated numbers
- n (
int): Number of 16-bit unsigned integers to generate
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_SUCCESS if random numbers were successfully generated
C signature
hiprandStatus_t hiprandGenerateShort(hiprandGenerator_t generator, unsigned short * output_data, size_t n)
- rocm.bindings.hiprand.hiprandGenerateLongLong(generator, output_data, n)#
Generates uniformly distributed 64-bit unsigned integers.
Generates
nuniformly distributed 64-bit unsigned integers and saves them tooutput_data.Generated numbers are between
0and2^64,including0and excluding2^64.Note:
generatormust be of typeHIPRAND_RNG_QUASI_SOBOL64orHIPRAND_RNG_QUASI_SCRAMBLED_SOBOL64.- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
Pointer/object): Pointer to memory to store generated numbers
- n (
int): Number of 64-bit unsigned integers to generate
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_SUCCESS if random numbers were successfully generated
C signature
hiprandStatus_t hiprandGenerateLongLong(hiprandGenerator_t generator, unsigned long long * output_data, size_t n)
- rocm.bindings.hiprand.hiprandGenerateUniform(generator, output_data, n)#
Generates uniformly distributed floats.
Generates
nuniformly distributed 32-bit floating-point values and saves them tooutput_data.Generated numbers are between
0.0fand1.0f,excluding0.0fand including1.0f.- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
Pointer/object): Pointer to memory to store generated numbers
- n (
int): Number of floats to generate
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not a multiple of the dimension
of used quasi-random generator
HIPRAND_STATUS_SUCCESS if random numbers were successfully generated
C signature
hiprandStatus_t hiprandGenerateUniform(hiprandGenerator_t generator, float * output_data, size_t n)
- rocm.bindings.hiprand.hiprandGenerateUniformDouble(generator, output_data, n)#
Generates uniformly distributed double-precision floating-point values.
Generates
nuniformly distributed 64-bit double-precision floating-point values and saves them tooutput_data.Generated numbers are between
0.0and1.0,excluding0.0and including1.0.Note: When
generatoris of type:HIPRAND_RNG_PSEUDO_MRG32K3A,HIPRAND_RNG_PSEUDO_MTGP32,HIPRAND_RNG_QUASI_SOBOL32,orHIPRAND_RNG_QUASI_SCRAMBLED_SOBOL32then the returneddoublevalues are generated from only 32 random bits each (oneunsigned intvalue per one generateddouble).- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
Pointer/object): Pointer to memory to store generated numbers
- n (
int): Number of floats to generate
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not a multiple of the dimension
of used quasi-random generator
HIPRAND_STATUS_SUCCESS if random numbers were successfully generated
C signature
hiprandStatus_t hiprandGenerateUniformDouble(hiprandGenerator_t generator, double * output_data, size_t n)
- rocm.bindings.hiprand.hiprandGenerateUniformHalf(generator, output_data, n)#
Generates uniformly distributed half-precision floating-point values.
Generates
nuniformly distributed 16-bit half-precision floating-point values and saves them tooutput_data.Generated numbers are between
0.0and1.0,excluding0.0and including1.0.- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
Pointer/object): Pointer to memory to store generated numbers
- n (
int): Number of halfs to generate
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not a multiple of the dimension
of used quasi-random generator
HIPRAND_STATUS_SUCCESS if random numbers were successfully generated
C signature
hiprandStatus_t hiprandGenerateUniformHalf(hiprandGenerator_t generator, half * output_data, size_t n)
- rocm.bindings.hiprand.hiprandGenerateNormal(generator, output_data, n, mean, stddev)#
Generates normally distributed floats.
Generates
nnormally distributed 32-bit floating-point values and saves them tooutput_data.- Args:
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not even,output_datais not
aligned to
sizeof(float2)bytes, ornis not a multiple of the dimension of used quasi-random generatorHIPRAND_STATUS_SUCCESS if random numbers were successfully generated
C signature
hiprandStatus_t hiprandGenerateNormal(hiprandGenerator_t generator, float * output_data, size_t n, float mean, float stddev)
- rocm.bindings.hiprand.hiprandGenerateNormalDouble(generator, output_data, n, mean, stddev)#
Generates normally distributed doubles.
Generates
nnormally distributed 64-bit double-precision floating-point numbers and saves them tooutput_data.- Args:
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not even,output_datais not
aligned to
sizeof(double2)bytes, ornis not a multiple of the dimension of used quasi-random generatorHIPRAND_STATUS_SUCCESS if random numbers were successfully generated
C signature
hiprandStatus_t hiprandGenerateNormalDouble(hiprandGenerator_t generator, double * output_data, size_t n, double mean, double stddev)
- rocm.bindings.hiprand.hiprandGenerateNormalHalf(generator, output_data, n, mean, stddev)#
Generates normally distributed halfs.
Generates
nnormally distributed 16-bit half-precision floating-point numbers and saves them tooutput_data.- Args:
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not even,output_datais not
aligned to
sizeof(half2)bytes, ornis not a multiple of the dimension of used quasi-random generatorHIPRAND_STATUS_SUCCESS if random numbers were successfully generated
C signature
hiprandStatus_t hiprandGenerateNormalHalf(hiprandGenerator_t generator, half * output_data, size_t n, half mean, half stddev)
- rocm.bindings.hiprand.hiprandGenerateLogNormal(generator, output_data, n, mean, stddev)#
Generates log-normally distributed floats.
Generates
nlog-normally distributed 32-bit floating-point values and saves them tooutput_data.- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
Pointer/object): Pointer to memory to store generated numbers
- n (
int): Number of floats to generate
- mean (
float/int): Mean value of log normal distribution
- stddev (
float/int): Standard deviation value of log normal distribution
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not even,output_datais not
aligned to
sizeof(float2)bytes, ornis not a multiple of the dimension of used quasi-random generatorHIPRAND_STATUS_SUCCESS if random numbers were successfully generated
C signature
hiprandStatus_t hiprandGenerateLogNormal(hiprandGenerator_t generator, float * output_data, size_t n, float mean, float stddev)
- rocm.bindings.hiprand.hiprandGenerateLogNormalDouble(generator, output_data, n, mean, stddev)#
Generates log-normally distributed doubles.
Generates
nlog-normally distributed 64-bit double-precision floating-point values and saves them tooutput_data.- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
Pointer/object): Pointer to memory to store generated numbers
- n (
int): Number of doubles to generate
- mean (
float/int): Mean value of log normal distribution
- stddev (
float/int): Standard deviation value of log normal distribution
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not even,output_datais not
aligned to
sizeof(double2)bytes, ornis not a multiple of the dimension of used quasi-random generatorHIPRAND_STATUS_SUCCESS if random numbers were successfully generated
C signature
hiprandStatus_t hiprandGenerateLogNormalDouble(hiprandGenerator_t generator, double * output_data, size_t n, double mean, double stddev)
- rocm.bindings.hiprand.hiprandGenerateLogNormalHalf(generator, output_data, n, mean, stddev)#
Generates log-normally distributed halfs.
Generates
nlog-normally distributed 16-bit half-precision floating-point values and saves them tooutput_data.- Args:
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not even,output_datais not
aligned to
sizeof(half2)bytes, ornis not a multiple of the dimension of used quasi-random generatorHIPRAND_STATUS_SUCCESS if random numbers were successfully generated
C signature
hiprandStatus_t hiprandGenerateLogNormalHalf(hiprandGenerator_t generator, half * output_data, size_t n, half mean, half stddev)
- rocm.bindings.hiprand.hiprandGeneratePoisson(generator, output_data, n, lambda_)#
Generates Poisson-distributed 32-bit unsigned integers.
Generates
nPoisson-distributed 32-bit unsigned integers and saves them tooutput_data.- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
PointerToUnsigned/object): Pointer to memory to store generated numbers
- n (
int): Number of 32-bit unsigned integers to generate
- lambda (
float/int): lambda for the Poisson distribution
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_OUT_OF_RANGE if lambda is non-positive
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not a multiple of the dimension
of used quasi-random generator
HIPRAND_STATUS_SUCCESS if random numbers were successfully generated
C signature
hiprandStatus_t hiprandGeneratePoisson(hiprandGenerator_t generator, unsigned int * output_data, size_t n, double lambda)
- rocm.bindings.hiprand.hiprandGenerateSeeds(generator)#
Initializes the generator’s state on GPU or host.
Initializes the generator’s state on GPU or host.
If hiprandGenerateSeeds() was not called for a generator, it will be automatically called by functions which generates random numbers like hiprandGenerate(), hiprandGenerateUniform(), hiprandGenerateNormal() etc.
- Args:
- generator (
rocrand_generator_base_type/object): Generator to initialize
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was never createdHIPRAND_STATUS_PREEXISTING_FAILURE if there was an existing error from a previous kernel launch
HIPRAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason
HIPRAND_STATUS_SUCCESS if the seeds were generated successfully
C signature
hiprandStatus_t hiprandGenerateSeeds(hiprandGenerator_t generator)
- rocm.bindings.hiprand.hiprandSetStream(generator, 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.
- Args:
- generator (
rocrand_generator_base_type/object): Generator to modify
- stream (
Pointer/object): Stream to use or NULL for default stream
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_SUCCESS if stream was set successfully
C signature
hiprandStatus_t hiprandSetStream(hiprandGenerator_t generator, hipStream_t stream)
- rocm.bindings.hiprand.hiprandSetPseudoRandomGeneratorSeed(generator, 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.
- Args:
- generator (
rocrand_generator_base_type/object): Pseudo-random number generator
- seed (
int): New seed value
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_TYPE_ERROR if the generator is a quasi random number generator
HIPRAND_STATUS_SUCCESS if seed was set successfully
C signature
hiprandStatus_t hiprandSetPseudoRandomGeneratorSeed(hiprandGenerator_t generator, unsigned long long seed)
- rocm.bindings.hiprand.hiprandSetGeneratorOffset(generator, 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 HIPRAND_RNG_PSEUDO_MTGP32 or HIPRAND_RNG_PSEUDO_MT19937.
- Args:
- generator (
rocrand_generator_base_type/object): Random number generator
- offset (
int): New absolute offset
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_SUCCESS if offset was successfully set
HIPRAND_STATUS_TYPE_ERROR if generator’s type is HIPRAND_RNG_PSEUDO_MTGP32
or HIPRAND_RNG_PSEUDO_MT19937
C signature
hiprandStatus_t hiprandSetGeneratorOffset(hiprandGenerator_t generator, unsigned long long offset)
- rocm.bindings.hiprand.hiprandSetGeneratorOrdering(generator, order)#
Sets the ordering of a random number generator.
Sets the ordering of the results of a random number generator.
This operation resets the generator’s internal state.
This operation does not change the generator’s seed.
The ordering choices for pseudorandom sequences are HIPRAND_ORDERING_PSEUDO_DEFAULT and HIPRAND_ORDERING_PSEUDO_LEGACY. The default ordering is HIPRAND_ORDERING_PSEUDO_DEFAULT, which is equal to HIPRAND_ORDERING_PSEUDO_LEGACY for now.
For quasirandom sequences there is only one ordering, HIPRAND_ORDERING_QUASI_DEFAULT.
- Args:
- generator (
rocrand_generator_base_type/object): Random number generator
- order (
hiprandOrdering): New ordering of results
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_OUT_OF_RANGE if the ordering is not valid
HIPRAND_STATUS_SUCCESS if the ordering was successfully set
HIPRAND_STATUS_TYPE_ERROR if generator’s type is not valid
C signature
hiprandStatus_t hiprandSetGeneratorOrdering(hiprandGenerator_t generator, hiprandOrdering_t order)
- rocm.bindings.hiprand.hiprandSetQuasiRandomGeneratorDimensions(generator, 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
dimensionsare 1 to 20000.This operation resets the generator’s internal state.
This operation does not change the generator’s offset.
- Args:
- generator (
rocrand_generator_base_type/object): Quasi-random number generator
- dimensions (
int): Number of dimensions
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_CREATED if the generator wasn’t createdHIPRAND_STATUS_TYPE_ERROR if the generator is not a quasi-random number generator
HIPRAND_STATUS_OUT_OF_RANGE if
dimensionsis out of rangeHIPRAND_STATUS_SUCCESS if the number of dimensions was set successfully
C signature
hiprandStatus_t hiprandSetQuasiRandomGeneratorDimensions(hiprandGenerator_t generator, unsigned int dimensions)
- rocm.bindings.hiprand.hiprandGetVersion()#
Returns the version number of the cuRAND or rocRAND library.
Returns in
versionthe version number of the underlying cuRAND or rocRAND library.- Returns:
A
tupleof size 2 that contains (in that order):hiprandStatus: HIPRAND_STATUS_OUT_OF_RANGE ifversionis NULLHIPRAND_STATUS_SUCCESS if the version number was successfully returned
int:Version of the library
C signature
hiprandStatus_t hiprandGetVersion(int * version)
- rocm.bindings.hiprand.hiprandCreatePoissonDistribution(lambda_)#
Construct the histogram for a Poisson distribution.
Construct the histogram for the Poisson distribution with lambda
lambda.- Args:
- Returns:
A
tupleof size 2 that contains (in that order):hiprandStatus: HIPRAND_STATUS_ALLOCATION_FAILED if memory could not be allocatedHIPRAND_STATUS_OUT_OF_RANGE if
discrete_distributionpointer was nullHIPRAND_STATUS_OUT_OF_RANGE if lambda is non-positive
HIPRAND_STATUS_SUCCESS if the histogram was constructed successfully
rocrand_discrete_distribution_st:pointer to the histogram in device memory
C signature
hiprandStatus_t hiprandCreatePoissonDistribution(double lambda, hiprandDiscreteDistribution_t * discrete_distribution)
- rocm.bindings.hiprand.hiprandDestroyDistribution(discrete_distribution)#
Destroy the histogram array for a discrete distribution.
Destroy the histogram array for a discrete distribution created by hiprandCreatePoissonDistribution.
- Args:
- discrete_distribution (
rocrand_discrete_distribution_st/object): pointer to the histogram in device memory
- discrete_distribution (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_OUT_OF_RANGE ifdiscrete_distributionwas nullHIPRAND_STATUS_SUCCESS if the histogram was destroyed successfully
C signature
hiprandStatus_t hiprandDestroyDistribution(hiprandDiscreteDistribution_t discrete_distribution)
- rocm.bindings.hiprand.hiprandGetDirectionVectors32(vectors, set)#
Retrieves the Sobol 32 direction vector array specified by
set.- Args:
- vectors (
Pointer/object): Pointer to the Sobol 32 direction vector array.
- set (
hiprandDirectionVectorSet): Specifies which hipRAND vector set for quasirandom generators to retrieve.
- vectors (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_OUT_OF_RANGE ifsetis invalidHIPRAND_STATUS_SUCCESS if
vectorswas set successfully
C signature
hiprandStatus_t hiprandGetDirectionVectors32(hiprandDirectionVectors32_t ** vectors, hiprandDirectionVectorSet_t set)
- rocm.bindings.hiprand.hiprandGetDirectionVectors64(vectors, set)#
Retrieves the Sobol 64 direction vector array specified by
set.- Args:
- vectors (
Pointer/object): Pointer to the Sobol 64 direction vector array.
- set (
hiprandDirectionVectorSet): Specifies which hipRAND vector set for quasirandom generators to retrieve.
- vectors (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_OUT_OF_RANGE ifsetis invalidHIPRAND_STATUS_SUCCESS if
vectorswas set successfully
C signature
hiprandStatus_t hiprandGetDirectionVectors64(hiprandDirectionVectors64_t ** vectors, hiprandDirectionVectorSet_t set)
- rocm.bindings.hiprand.hiprandGetScrambleConstants32(constants)#
Retrieves the scramble constants for 32-bit scrambled Sobol generation.
- Args:
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_SUCCESS if the pointer was set successfully
C signature
hiprandStatus_t hiprandGetScrambleConstants32(const unsigned int ** constants)
- rocm.bindings.hiprand.hiprandGetScrambleConstants64(constants)#
Retrieves the scramble constants for 64-bit scrambled Sobol generation.
- Args:
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_SUCCESS if the pointer was set successfully
C signature
hiprandStatus_t hiprandGetScrambleConstants64(const unsigned long long ** constants)