Sparse Linear Algebra#
See the latest specification for the sparse domain here.
This page documents implementation specific or backend specific details of the sparse domain.
OneMKL Intel CPU and GPU backends#
Currently known limitations:
All operations’ algorithms except
no_optimize_algmap to the default algorithm.The required external workspace size is always 0 bytes.
oneapi::math::sparse::set_csr_dataandoneapi::math::sparse::set_coo_datafunctions cannot be used on a handle that has already been used for an operation or its optimize function. Doing so will throw aoneapi::math::unimplementedexception.Using
spsvwith theoneapi::math::sparse::spsv_alg::no_optimize_algand a sparse matrix that does not have theoneapi::math::sparse::matrix_property::sortedproperty will throw aoneapi::math::unimplementedexception.Using
spmmon Intel GPU with a sparse matrix that isoneapi::math::transpose::conjtransand has theoneapi::math::sparse::matrix_property::symmetricproperty will throw aoneapi::math::unimplementedexception.Using
spmvwith a sparse matrix that isoneapi::math::transpose::conjtranswith atype_viewmatrix_descr::symmetricormatrix_descr::hermitianwill throw aoneapi::math::unimplementedexception.Using
spsvon Intel GPU with a sparse matrix that isoneapi::math::transpose::conjtransand will throw aoneapi::math::unimplementedexception.Scalar parameters
alphaandbetashould be host pointers to prevent synchronizations and copies to the host.
cuSPARSE backend#
Currently known limitations:
The COO format requires the indices to be sorted by row. See the cuSPARSE documentation. Sparse operations using matrices with the COO format without the property
matrix_property::sorted_by_rowsormatrix_property::sortedwill throw aoneapi::math::unimplementedexception.Using
spmmwith the algorithmspmm_alg::csr_alg3and anopAother thantranspose::nontransor anopBtranspose::conjtranswill throw aoneapi::math::unimplementedexception.Using
spmmwith the algorithmspmm_alg::csr_alg3,opB=transpose::transand real fp64 precision will throw aoneapi::math::unimplementedexception. This configuration can fail as of CUDA 12.6.2, see the related issue `here<https://forums.developer.nvidia.com/t/cusparse-spmm-sample-failing-with-misaligned-address/311022>`_.Using
spmvwith atype_viewother thanmatrix_descr::generalwill throw aoneapi::math::unimplementedexception.Using
spsvwith the algorithmspsv_alg::no_optimize_algmay still perform some mandatory preprocessing.oneMath does not provide a way to use non-default algorithms without calling preprocess functions such as
cusparseSpMM_preprocessorcusparseSpMV_preprocess. Feel free to create an issue if this is needed.
rocSPARSE backend#
Currently known limitations:
Using
spmvwith atype_viewother thanmatrix_descr::generalwill throw aoneapi::math::unimplementedexception.The COO format requires the indices to be sorted by row then by column. See the rocSPARSE COO documentation. Sparse operations using matrices with the COO format without the property
matrix_property::sortedwill throw aoneapi::math::unimplementedexception.The CSR format requires the column indices to be sorted within each row. See the rocSPARSE CSR documentation. Sparse operations using matrices with the CSR format without the property
matrix_property::sortedwill throw aoneapi::math::unimplementedexception.The same sparse matrix handle cannot be reused for multiple operations
spmm,spmv, orspsv. Doing so will throw aoneapi::math::unimplementedexception. See #332.
Operation algorithms mapping#
The following tables describe how a oneMath algorithm maps to the backend’s algorithms. Refer to the backend’s documentation for a more detailed explanation of the algorithms.
Backends with no equivalent algorithms will fallback to the backend’s default behavior.