cuSPARSE Types Reference
cudaDataType_t
The section describes the types shared by multiple CUDA Libraries and defined in the header file library_types.h
. The cudaDataType
type is an enumerator to specify the data precision. It is used when the data reference does not carry the type itself (e.g. void*
). For example, it is used in the routine cusparseSpMM()
.
Value |
Meaning |
Data Type |
Header |
---|---|---|---|
|
The data type is 16-bit IEEE-754 floating-point |
|
cuda_fp16.h |
|
The data type is 16-bit complex IEEE-754 floating-point |
|
cuda_fp16.h |
|
The data type is 16-bit bfloat floating-point |
|
cuda_bf16.h |
|
The data type is 16-bit complex bfloat floating-point |
|
cuda_bf16.h |
|
The data type is 32-bit IEEE-754 floating-point |
|
|
|
The data type is 32-bit complex IEEE-754 floating-point |
|
cuComplex.h |
|
The data type is 64-bit IEEE-754 floating-point |
|
|
|
The data type is 64-bit complex IEEE-754 floating-point |
|
cuComplex.h |
|
The data type is 8-bit integer |
|
stdint.h |
|
The data type is 32-bit integer |
|
stdint.h |
IMPORTANT: The Generic API routines allow all data types reported in the respective section of the documentation only on GPU architectures with native support for them. If a specific GPU model does not provide native support for a given data type, the routine returns CUSPARSE_STATUS_ARCH_MISMATCH
error.
Unsupported data types and Compute Capability (CC):
__half
on GPUs withCC < 53
(e.g. Kepler)__nv_bfloat16
on GPUs withCC < 80
(e.g. Kepler, Maxwell, Pascal, Volta, Turing)
see https://developer.nvidia.com/cuda-gpus
cusparseStatus_t
This data type represents the status returned by the library functions and it can have the following values
Value |
Description |
---|---|
|
The operation completed successfully |
|
The cuSPARSE library was not initialized. This is usually caused by the lack of a prior call, an error in the CUDA Runtime API called by the cuSPARSE routine, or an error in the hardware setup To correct: call The error also applies to generic APIs ( Generic APIs reference) for indicating a matrix/vector descriptor not initialized |
|
Resource allocation failed inside the cuSPARSE library. This is usually caused by a device memory allocation ( To correct: prior to the function call, deallocate previously allocated memory as much as possible |
|
An unsupported value or parameter was passed to the function (a negative vector size, for example) To correct: ensure that all the parameters being passed have valid values |
|
The function requires a feature absent from the device architecture To correct: compile and run the application on a device with appropriate compute capability |
|
The GPU program failed to execute. This is often caused by a launch failure of the kernel on the GPU, which can be caused by multiple reasons To correct: check that the hardware, an appropriate version of the driver, and the cuSPARSE library are correctly installed |
|
An internal cuSPARSE operation failed To correct: check that the hardware, an appropriate version of the driver, and the cuSPARSE library are correctly installed. Also, check that the memory passed as a parameter to the routine is not being deallocated prior to the routine completion |
|
The matrix type is not supported by this function. This is usually caused by passing an invalid matrix descriptor to the function To correct: check that the fields in |
|
The operation or data type combination is currently not supported by the function |
|
The resources for the computation, such as GPU global or shared memory, are not sufficient to complete the operation. The error can also indicate that the current computation mode (e.g. bit size of sparse matrix indices) does not allow to handle the given input |
cusparseHandle_t
This is a pointer type to an opaque cuSPARSE context, which the user must initialize by calling prior to calling cusparseCreate()
any other library function. The handle created and returned by cusparseCreate()
must be passed to every cuSPARSE function.
cusparsePointerMode_t
This type indicates whether the scalar values are passed by reference on the host or device. It is important to point out that if several scalar values are passed by reference in the function call, all of them will conform to the same single pointer mode. The pointer mode can be set and retrieved using cusparseSetPointerMode()
and cusparseGetPointerMode()
routines, respectively.
Value |
Meaning |
---|---|
|
The scalars are passed by reference on the host. |
|
The scalars are passed by reference on the device. |
cusparseOperation_t
This type indicates which operations is applied to the related input (e.g. sparse matrix, or vector).
Value |
Meaning |
---|---|
|
The non-transpose operation is selected. |
|
The transpose operation is selected. |
|
The conjugate transpose operation is selected. |
cusparseDiagType_t
This type indicates if the matrix diagonal entries are unity. The diagonal elements are always assumed to be present, but if CUSPARSE_DIAG_TYPE_UNIT
is passed to an API routine, then the routine assumes that all diagonal entries are unity and will not read or modify those entries. Note that in this case the routine assumes the diagonal entries are equal to one, regardless of what those entries are actually set to in memory.
Value |
Meaning |
---|---|
|
The matrix diagonal has non-unit elements. |
|
The matrix diagonal has unit elements. |
cusparseFillMode_t
This type indicates if the lower or upper part of a matrix is stored in sparse storage.
Value |
Meaning |
---|---|
|
The lower triangular part is stored. |
|
The upper triangular part is stored. |
cusparseIndexBase_t
This type indicates if the base of the matrix indices is zero or one.
Value |
Meaning |
---|---|
|
The base index is zero (C compatibility). |
|
The base index is one (Fortran compatibility). |
cusparseDirection_t
This type indicates whether the elements of a dense matrix should be parsed by rows or by columns (assuming column-major storage in memory of the dense matrix) in function cusparse[S|D|C|Z]nnz. Besides storage format of blocks in BSR format is also controlled by this type.
Value |
Meaning |
---|---|
|
The matrix should be parsed by rows. |
|
The matrix should be parsed by columns. |