#cuda #nvidia #driver #run-time #gpu #nvidia-gpu

baracuda-cusparse

Safe Rust wrappers for NVIDIA cuSPARSE (generic-API SpMV at v0.1)

7 releases

Uses new Rust 2024

new 0.0.1-alpha.13 May 11, 2026
0.0.1-alpha.7 May 7, 2026
0.0.1-alpha.5 Apr 29, 2026
0.0.1-alpha.2 Apr 24, 2026

#2898 in Hardware support


Used in baracuda

MIT/Apache

1MB
24K SLoC

baracuda-cusparse

Safe Rust wrappers for NVIDIA cuSPARSE — sparse linear algebra on the GPU through the modern generic API.

Generic over scalar type (f32 / f64 / Complex32 / Complex64) where the math allows.

Coverage

  • All sparse formats: CSR, CSC, COO, BSR, with typed descriptor builders (SparseMatrixCsr::new, etc.).
  • Dense descriptors: DnVec, DnMat.
  • Generic sparse-matrix ops (modern, post cuSPARSE 11):
    • SpMV (sparse matrix × dense vector)
    • SpMM (sparse × dense)
    • SpGEMM (sparse × sparse) — three-phase: workspace estimate, workspace fill, compute.
    • SpSV / SpSM (triangular solve).
    • SDDMM (sampled dense-dense matmul).
  • Conversions: sparse↔dense, CSR↔CSC.
  • Sparse-BLAS-1: axpby, gather, scatter, rot.

Workspace handling

The generic API requires the caller to provide scratch device memory sized via a query call (e.g. SpMV_bufferSize). baracuda-cusparse takes this through &mut DeviceBuffer<u8> arguments — explicit and allocation-free at op time.

Pairs with baracuda-cusparse-sys for the raw FFI surface.

Part of the baracuda workspace.

License

Dual MIT / Apache-2.0.

Dependencies

~225–590KB
~13K SLoC