oxicuda_sparse/lib.rs
1//! # OxiCUDA Sparse -- GPU-Accelerated Sparse Matrix Operations
2//!
3//! This crate provides GPU-accelerated sparse matrix operations,
4//! serving as a pure Rust equivalent to NVIDIA's cuSPARSE library.
5//!
6//! ## Sparse formats
7//!
8//! Multiple storage formats are supported via the [`mod@format`] module:
9//! - [`CsrMatrix`] -- Compressed Sparse Row (primary format)
10//! - [`CscMatrix`] -- Compressed Sparse Column
11//! - [`CooMatrix`] -- Coordinate (triplet)
12//! - [`BsrMatrix`] -- Block Sparse Row
13//! - [`EllMatrix`] -- ELLPACK
14//! - [`HybMatrix`] -- HYB (Hybrid ELL+COO)
15//!
16//! ## Operations
17//!
18//! - [`fn@ops::spmv`] -- Sparse matrix-vector multiply (`y = alpha*A*x + beta*y`)
19//! - [`fn@ops::spmm`] -- Sparse-dense matrix multiply (`C = alpha*A*B + beta*C`)
20//! - [`ops::spgemm`] -- Sparse-sparse matrix multiply (`C = A*B`)
21//! - [`fn@ops::sptrsv`] -- Sparse triangular solve (`L*x = b` or `U*x = b`)
22//! - [`fn@ops::sddmm`] -- Sampled Dense-Dense Matrix Multiply
23//!
24//! ## Preconditioners
25//!
26//! - [`fn@preconditioner::ilu0`] -- Incomplete LU(0) for general systems
27//! - [`fn@preconditioner::ic0`] -- Incomplete Cholesky(0) for SPD systems
28//!
29//! ## Example
30//!
31//! ```rust,no_run
32//! use oxicuda_sparse::prelude::*;
33//! ```
34
35#![warn(clippy::all)]
36#![warn(missing_docs)]
37
38pub mod error;
39pub mod format;
40pub mod handle;
41pub mod ops;
42pub mod preconditioner;
43pub(crate) mod ptx_helpers;
44
45pub use error::{SparseError, SparseResult};
46pub use format::{
47 BsrMatrix, CooMatrix, CscMatrix, Csr5Matrix, CsrMatrix, EllMatrix, HybMatrix, HybPartition,
48 HybStatistics,
49};
50pub use handle::SparseHandle;
51
52/// Prelude for convenient imports.
53pub mod prelude {
54 pub use crate::error::{SparseError, SparseResult};
55 pub use crate::format::{
56 BsrMatrix, CooMatrix, CscMatrix, Csr5Matrix, CsrMatrix, EllMatrix, HybMatrix, HybPartition,
57 HybStatistics, amd_ordering, inverse_permutation, permute_csr, rcm_ordering,
58 };
59 pub use crate::handle::SparseHandle;
60 pub use crate::ops::{
61 BatchScheduler, BatchedSpGEMM, BatchedSpMV, BatchedSpMVPlan, BatchedTriSolve,
62 RecommendedFormat, SpMVAlgo, SpMatFormat, Strategy, UniformBatchedSpMV, analyze_sparsity,
63 auto_spmv, batched_spmv_cpu, csr5_spmv, generate_batched_spmv_ptx,
64 mixed_precision_spmv_cpu, recommend_format, select_format, spgemm_merge, spmm, spmv,
65 spmv_bsr, spmv_ell,
66 };
67 pub use crate::ops::{
68 EdgeFeatures, GnnSparseConfig, MessagePassingOp, add_self_loops, compute_degree_matrix,
69 gather, scatter_reduce, sparse_attention_message, sparse_message_passing,
70 sparse_row_softmax, symmetric_normalize,
71 };
72 pub use crate::preconditioner::{IlukConfig, IlukFactorization};
73}