nvmath-python Device APIs#
Overview#
The device module of nvmath-python nvmath.
offers integration with NVIDIA’s high-performance computing libraries through device APIs for cuFFTDx, cuBLASDx, and cuRAND.
Detailed documentation for these libraries can be found at cuFFTDx, cuBLASDx, and
cuRAND device APIs respectively.
Users may take advantage of the device module via the two approaches below:
Numba Extensions: Users can access these device APIs via Numba by utilizing specific extensions that simplify the process of defining functions, querying device traits, and calling device functions.
Third-party JIT Compilers: The APIs are also available through low-level interfaces in other JIT compilers, allowing advanced users to work directly with the raw device code.
Note
The fft
and matmul
device APIs in module nvmath.
currently supports cuFFTDx 1.2.0 and cuBLASDx 0.1.1, also available as part of MathDx 24.04.
All functionalities from the C++ libraries are supported with the exception of cuFFTDx C++ APIs with a workspace argument, which are currently not available in nvmath-python.
API Reference#
Utility APIs (nvmath. device
)#
A helper function to get the default code type for link time optimization (LTO) on the current device. |
|
|
Create a Numba compliant vector object for float16 with vector length 2. |
|
Create a Numba compliant vector object for float16 with vector length 4. |
|
Create a Numba compliant vector object for float32 with vector length 2. |
|
Create a Numba compliant vector object for float64 with vector length 2. |
A Numba compliant vector type object for float16 with vector length 2 |
|
A Numba compliant vector type object for float16 with vector length 4 |
|
A Numba compliant vector type object for float32 with vector length 2 |
|
A Numba compliant vector type object for float64 with vector length 2 |
|
|
A namedtuple class that encapsulates the code version. |
|
A namedtuple class that encapsulates code type, version, and buffer. |
|
A namedtuple class that encapsulates code kind and compute capability. |
|
A namedtuple class that encapsulates the major and minor compute capability. |
|
A namedtuple class that encapsulates code kind and compute capability. |
|
A namedtuple class that encapsulates a device function symbol and which API it maps to. |
|
A namedtuple class that encapsulates the dimensions for grids and blocks. |
cuBLASDx APIs (nvmath. device
)#
|
Create an |
|
A class that encapsulates a partial BLAS device function. |
|
A namedtuple class that encapsulates the three leading dimensions in matrix multiplication \(C = \alpha Op(A) Op(B) + \beta C\). |
|
A namedtuple class that encapsulates the transpose mode for input matrices |
cuFFTDx APIs (nvmath. device
)#
|
Create an |
|
A class that encapsulates a partial FFT device function. |
cuRAND Device APIs (nvmath. device. random
)#
|
Compile the random device APIs with the specified compute capability. |
Bit Generator and State APIs (nvmath. device. random
)#
|
Initialize the RNG state. |
|
Generate 32 or 64 bits of randomness depending on the provided bit generator. |
|
Generate a 4-tuple of 32-bits of randomness from a Philox4_32_10 generator. |
States of MRG32k3a bit generator. |
|
States of Philox4_32_10 bit generator. |
|
States of Sobol32 bit generator. |
|
States of Sobol64 bit generator. |
|
States of ScrambledSobol32 bit generator. |
|
States of ScrambledSobol64 bit generator. |
|
|
States of XORWOW bit generator. |
Distribution Sampling APIs (nvmath. device. random
)#
|
Sample a float from normal distribution using the specified bit generator state. |
|
Sample a double from normal distribution using the specified bit generator state. |
|
Sample two floats from normal distribution using the specified bit generator state. |
|
Sample two doubles from normal distribution using the specified bit generator state. |
|
Sample four floats from normal distribution using the specified bit generator state. |
|
Sample a float from log-normal distribution using the specified bit generator state. |
|
Sample a double from log-normal distribution using the specified bit generator state. |
|
Sample two floats from log-normal distribution using the specified bit generator state. |
|
Sample two doubles from log-normal distribution using the specified bit generator state. |
|
Sample four floats from log-normal distribution using the specified bit generator state. |
|
Sample a uint from Poisson distribution using the specified bit generator state. |
|
Sample four uints from Poisson distribution using the specified bit generator state. |
|
Sample a float from uniform distribution using the specified bit generator state. |
|
Sample a double from uniform distribution using the specified bit generator state. |
|
Sample two doubles from uniform distribution using the specified bit generator state. |
|
Sample four floats from uniform distribution using the specified bit generator state. |
Skip Ahead APIs (nvmath. device. random
)#
|
Update the bit generator state to skip ahead |
|
Update the bit generator state to skip ahead |
|
Update the bit generator state to skip ahead |
Helper Host APIs (nvmath. device. random_helpers
)#
|
Get direction vectors for 32-bit quasirandom number generation. |
|
Get direction vectors for 64-bit quasirandom number generation. |
|
Get scramble constants for 32-bit scrambled Sobol' . |
|
Get scramble constants for 64-bit scrambled Sobol' . |
|
See |