|
cuPHY
0.1
CUDA PHY Layer Acceration Library
|
This section describes the functions for populating cuPHY tensors with random data. More...
Typedefs | |
| typedef struct cuphyRNG * | cuphyRNG_t |
Functions | |
| cuphyStatus_t | cuphyCreateRandomNumberGenerator (cuphyRNG_t *pRNG, unsigned long long seed, unsigned int flags, cudaStream_t strm) |
| Allocates and initializes a cuPHY random number generator. More... | |
| cuphyStatus_t | cuphyDestroyRandomNumberGenerator (cuphyRNG_t rng) |
| Destroys a cuPHY random number generator. More... | |
| cuphyStatus_t | cuphyRandomNormal (cuphyRNG_t rng, cuphyTensorDescriptor_t tDst, void *pDst, const cuphyVariant_t *mean, const cuphyVariant_t *stddev, cudaStream_t strm) |
| Populate a cuPHY tensor with random data with a normal distribution. More... | |
| cuphyStatus_t | cuphyRandomUniform (cuphyRNG_t rng, cuphyTensorDescriptor_t tDst, void *pDst, const cuphyVariant_t *minValue, const cuphyVariant_t *maxValue, cudaStream_t strm) |
| Populate a cuPHY tensor with uniformly distributed random data. More... | |
| typedef struct cuphyRNG* cuphyRNG_t |
cuPHY random number generator handle
| cuphyStatus_t cuphyCreateRandomNumberGenerator | ( | cuphyRNG_t * | pRNG, |
| unsigned long long | seed, | ||
| unsigned int | flags, | ||
| cudaStream_t | strm | ||
| ) |
Allocates a cuPHY random number generator and returns a handle in the address provided by the caller.
Returns CUPHY_STATUS_INVALID_ARGUMENT if pRNG is NULL.
Returns CUPHY_STATUS_ALLOC_FAILED if a context cannot be allocated on the host.
Returns CUPHY_STATUS_SUCCESS if allocation and initialization were successful.
| pRNG | - Address to return the new cuphyRNG_t instance |
| seed | - Random number generator seed |
| flags | - Creation flags (currently unused) |
| strm | - CUDA stream for initialization |
| cuphyStatus_t cuphyDestroyRandomNumberGenerator | ( | cuphyRNG_t | rng | ) |
Destroys a previously created cuPHY random number generator instance
Returns CUPHY_STATUS_INVALID_ARGUMENT if rng is NULL.
Returns CUPHY_STATUS_SUCCESS if destruction was successful.
| rng | - Existing cuphyRNG_t instance |
| cuphyStatus_t cuphyRandomNormal | ( | cuphyRNG_t | rng, |
| cuphyTensorDescriptor_t | tDst, | ||
| void * | pDst, | ||
| const cuphyVariant_t * | mean, | ||
| const cuphyVariant_t * | stddev, | ||
| cudaStream_t | strm | ||
| ) |
Populates a cuPHY tensor with random data that has a normal (Gaussian) distribution
Returns CUPHY_STATUS_INVALID_ARGUMENT if rng is NULL.
Returns CUPHY_STATUS_SUCCESS if kernel launch was successful.
| rng | - Existing cuphyRNG_t instance |
| tDst | - Descriptor for output tensor |
| pDst | - Address of output tensor |
| mean | - Mean value |
| stddev | - Standard deviation |
| strm | - CUDA stream for kernel launch |
| cuphyStatus_t cuphyRandomUniform | ( | cuphyRNG_t | rng, |
| cuphyTensorDescriptor_t | tDst, | ||
| void * | pDst, | ||
| const cuphyVariant_t * | minValue, | ||
| const cuphyVariant_t * | maxValue, | ||
| cudaStream_t | strm | ||
| ) |
Populates a cuPHY tensor with random data that has a uniform distribution, using the given min/max range. The minimum and maximum values are ignored for tensors of type CUPHY_BIT. For CUPHY_BIT tensors with a first dimension that is not a multiple of 32, high-order bits in the end of the last word will be set to zero.
Returns CUPHY_STATUS_INVALID_ARGUMENT if rng is NULL. Returns CUPHY_STATUS_UNSUPPORTED_TYPE if the type of the input tensor is complex.
Returns CUPHY_STATUS_SUCCESS if kernel launch was successful.
| rng | - Existing cuphyRNG_t instance |
| tDst | - Descriptor for output tensor |
| pDst | - Address of output tensor |
| minValue | - Minimum value |
| maxValue | - Maximum value |
| strm | - CUDA stream for kernel launch |
1.8.17