GPU sparse operations package (SpMV, gather, scatter, sparse formats).
pip install . --no-deps --no-build-isolationUse --no-build-isolation to avoid downloading build deps when offline.
Runtime dependencies (install when needed):
pip install torch triton cupy-cuda12xsrc/flagsparse/— core package (sparse_operations/is emitted as several.pymodules from string literals inflagsparse.py)tests/— pytest testsbenchmark/— performance benchmarks
Run from project root, or cd tests then run scripts (paths like ../matrix for .mtx dir).
test_spmv.py — CSR SpMV (SuiteSparse .mtx, synthetic, or CSR CSV export):
python tests/test_spmv.py <dir_or_file.mtx> # batch run, default float32
python tests/test_spmv.py <dir/> --dtype float64 # optional: --index-dtype int32|int64, --warmup, --iters, --no-cusparse
python tests/test_spmv.py --synthetic # synthetic benchmark
python tests/test_spmv.py <dir/> --csv-csr results.csv # all value×index dtypes → one CSV (per-matrix lines while running)test_spmv_coo.py — COO SpMV (requires --synthetic or --csv-coo; no standalone .mtx batch):
python tests/test_spmv_coo.py --synthetic
python tests/test_spmv_coo.py <dir/> --csv-coo out.csvtest_spmv_opt.py — SpMV baseline vs optimised A/B (float32 / float64 only):
python tests/test_spmv_opt.py <dir_or_file.mtx> [...]
python tests/test_spmv_opt.py <dir/> --csv out.csvtest_spmm.py — CSR SpMM (.mtx batch, synthetic, or --csv):
python tests/test_spmm.py <dir_or_file.mtx>
python tests/test_spmm.py --synthetic # optional: --skip-api-checks, --skip-alg1-coverage
python tests/test_spmm.py <dir/> --csv results.csv # float32/float64 + int32 in CSV; per-matrix console output
# common options: --dtype, --index-dtype, --dense-cols, --block-n, --block-nnz, --max-segments, --warmup, --iters, --no-cusparsetest_spmm_coo.py — native COO SpMM:
python tests/test_spmm_coo.py <dir_or_file.mtx>
python tests/test_spmm_coo.py --synthetic # optional: --route rowrun|atomic|compare, --skip-api-checks, --skip-coo-coverage
python tests/test_spmm_coo.py <dir/> --csv out.csv # only --route rowrun or atomic (not compare)
# same tuning flags as CSR SpMM where applicable: --dense-cols, --block-n, --block-nnz, --warmup, --iters, --no-cusparsetest_spsv.py — SpSV (triangular solve; square matrices only). CSR and COO share this script; there is no test_spsv_coo.py.
python tests/test_spsv.py --synthetic
python tests/test_spsv.py <dir/> --csv-csr spsv.csv
python tests/test_spsv.py <dir/> --csv-coo out.csv # same CSV columns as CSR; optional --coo-mode auto|direct|csr (default auto)test_gather.py / test_scatter.py — gather/scatter benchmarks (pytest or python tests/test_gather.py).