Expand description
Safe Rust wrappers for NVIDIA cuSPARSE.
Covers the modern generic-API surface: Handle, SpMat (CSR/CSC/COO/BSR),
DnMat, DnVec, and the family of op algorithms — SpMV, SpMM, SpGEMM,
SpSV, SpSM, SDDMM — plus CSR↔CSC and sparse↔dense conversions, and the
sparse BLAS-1 helpers (axpby, gather, scatter, rot).
All matrix/vector descriptors borrow the underlying DeviceBuffers and
tie their lifetime to them so the buffers can’t be freed while cuSPARSE
is still holding references.
Structs§
- DnMat
- DnVec
- Handle
- Owned cuSPARSE handle.
- SpGEMM
Plan - Per-plan handle for a 3-phase SpGEMM computation.
- SpMat
- A sparse-matrix descriptor (CSR / CSC / COO / BSR). The descriptor keeps pointers to externally-owned device buffers; the lifetime parameter ties those buffers to the descriptor.
- SpSM
Plan - SpSV
Plan
Enums§
- Csr2
CscAlg - Diag
- Fill
- Index
Base - Op
- Transpose / conjugate-transpose selector.
- Order
- Dense-matrix storage order.
- SDDMM
Alg - SpGEMM
Alg - SpMMAlg
- SpMVAlg
- SpSMAlg
- SpSVAlg
Traits§
- Sparse
Scalar - Types that cuSPARSE’s generic API accepts as element / compute type.
Functions§
- axpby
- csr2csc_
ex2 - Convert a CSR matrix to CSC format using the modern Ex2 entry point —
supports algorithm selection (
alg) and arbitrary value types. - csr2csc_
ex2_ buffer_ size - Workspace size in bytes for
csr2csc_ex2. - dense_
to_ sparse_ analysis - dense_
to_ sparse_ buffer_ size - dense_
to_ sparse_ convert - gather
- rot
- scatter
- sddmm
- sddmm_
buffer_ size - sddmm_
preprocess - One-time preprocessing before
sddmm. Seespmm_preprocessfor the rationale. - sparse_
to_ dense - sparse_
to_ dense_ buffer_ size - spgemm_
compute ⚠ - Phase 2: compute. Same two-step pattern for
buffer2. - spgemm_
copy - Phase 3: write output arrays into the pre-populated output
SpMat. - spgemm_
work_ ⚠estimation - Phase 1: work-estimation. The caller provides
buffer1whose size is returned insize1; passnullthe first time, then allocate & re-call. - spmm
- spmm_
buffer_ size - Query buffer-size for
C = alpha * op(A) * op(B) + beta * C,Asparse. - spmm_
preprocess - One-time preprocessing before
spmm. Pre-computes algorithm-specific state intoworkspaceso subsequentspmmcalls (with the same A sparsity pattern + dimensions) are faster. Use this when the same matrix is multiplied many times. - spmv
y = alpha * op(A) * x + beta * y.- spmv_
buffer_ size - Query buffer-size for
y = alpha * op(A) * x + beta * y. - spsm_
analysis - spsm_
buffer_ size - spsm_
solve - spsv_
analysis - spsv_
buffer_ size - spsv_
solve
Type Aliases§
- CsrMatrix
- Legacy alias kept for callers from v0.1 — prefer
SpMat::csr. - Dense
Vector - Legacy alias — prefer
DnVec. - Error
- Error type for cuSPARSE operations.
- Result
- Result alias.