cuSPARSE Generic APIs

The cuSPARSE Generic APIs allow computing the most common sparse linear algebra operations, such as sparse matrix-vector (SpMV) and sparse matrix-matrix multiplication (SpMM), in a flexible way. The new APIs have the following capabilities and features:

  • Set matrix data layouts, number of batches, and storage formats (for example, CSR, COO, and so on).

  • Set input/output/compute data types. This also allows mixed data-type computation.

  • Set types of sparse vector/matrix indices (e.g. 32-bit, 64-bit).

  • Choose the algorithm for the computation.

  • Guarantee external device memory for internal operations.

  • Provide extensive consistency checks across input matrices and vectors. This includes the validation of sizes, data types, layout, allowed operations, etc.

  • Provide constant descriptors for vector and matrix inputs to support const-safe interface and guarantee that the APIs do not modify their inputs.

Generic Types Reference

The cuSPARSE generic type references are described in this section.

cusparseFormat_t

This type indicates the format of the sparse matrix. See cuSPARSE Storage Format for their description.

Value

Meaning

CUSPARSE_FORMAT_COO

The matrix is stored in Coordinate (COO) format organized in Structure of Arrays (SoA) layout

CUSPARSE_FORMAT_CSR

The matrix is stored in Compressed Sparse Row (CSR) format

CUSPARSE_FORMAT_CSC

The matrix is stored in Compressed Sparse Column (CSC) format

CUSPARSE_FORMAT_BLOCKED_ELL

The matrix is stored in Blocked-Ellpack (Blocked-ELL) format

CUSPARSE_FORMAT_SLICED_ELL

The matrix is stored in Sliced-Ellpack (Sliced-ELL) format

CUSPARSE_FORMAT_BSR

The matrix is stored in Block Sparse Row (BSR) format


cusparseOrder_t

This type indicates the memory layout of a dense matrix.

Value

Meaning

CUSPARSE_ORDER_ROW

The matrix is stored in row-major

CUSPARSE_ORDER_COL

The matrix is stored in column-major


cusparseIndexType_t

This type indicates the index type for representing the sparse matrix indices.

Value

Meaning

CUSPARSE_INDEX_32I

32-bit signed integer [1, 2^31 - 1]

CUSPARSE_INDEX_64I

64-bit signed integer [1, 2^63 - 1]