Sparse Tensor Support in MatX #912
Replies: 1 comment
-
|
MatX now also support the DIA format through the UST type. For an m x n matrix, this format uses a linearized storage where each nonzero diagonal has n entries, padded with zeros on the right for the lower triangular part and padded with zeros on the left for the upper triagonal part. An example follows: Currently, the only supported operation is SpMV.
Since the format is not supported by cuSPARSE, this operation is implemented with a hand-written kernel. For matrices with only a few nonzero diagonals that are close to the main diagonal, this format is much more compact than either COO or CSR. Furthermore, for such cases, the hand-written kernel performs much better than using cuSPARSE SpMV with either the COO or CSR format. Give it a try and let us know what you think! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
MatX is in the process of adding experimental support for sparse tensors. The implementation is based on the Universal Sparse Tensor (UST) type that uses a tensor format DSL (Domain Specific Language) to describe a vast space of storage formats. Although the UST type can easily define many common storage formats (such as dense vectors and matrices, sparse vectors, sparse matrices in COO, CSR, CSC, DCSR, DCSC, or BSR format, with generalizations for sparse tensors), it can also define many less common storage formats.
Despite the forward-looking design of using the UST type inside MatX, the current experimental supported API is limited to sparse matrices in COO, CSR, or CSC format. Such sparse matrices can be constructed using "make" methods on the constituent buffers (similar constructors can be found in e.g. SciPy or CuPy or torch sparse):
Alternatively, sparse matrices can be constructed from dense matrices as follows.
Other supported operations include conversions back to dense matrices, Sparse-Matrix times Vector (SpMV), Sparse-Matrix times Matrix (SpMM), and solving a sparse system of linear equations.
More details can be found in the Sparse Tensor Type Section of the MatX documentation.
Give it a try and let us know what you think! Given sufficient interest, the assortment of supported formats and operations is expected to grow!
Beta Was this translation helpful? Give feedback.
All reactions