Open mipals opened 3 days ago
We don't have GPU routines specialized for symmetric matrices. The sparse matrix is just unwrapped from Symmetric
or Hermitian
.
Yeah, I followed the multiplication and found that a _unwrap(A)
is what is causing this. I might be wrong, but I do not think the current behaviour is user-friendly.
I've looked a little into the cuSPARSE documentation, and it does seem like a symmetric type is available and even part of CUSPARSE through CUSPARSE.CUSPARSE_MATRIX_TYPE_SYMMETRIC
? In the documentation they do write that it is not very efficient to use the symmetry in mat-vecs but in the case of just using the mat-vec for iterative refinement after having solved a linear system using cuDSS (where only a single side of the matrix is required) it is probably ok/negligible?
I agree that it's not optimal but it is not supported by any GPU library (to the best of my knowledge).
I never wanted to add methods with Symmetric
because of that for CUSPARSE, but some users wanted this behavior instead of an error.
Also Symmetric
is not officially a specific storage, it's only used for dispatch in many cases. If we store both triangles, we still need to decide between uplo=:L
and uplo=:U
.
I checked your type in the CUDA documentation (https://docs.nvidia.com/cuda/cusparse/index.html?highlight=CUSPARSE_MATRIX_TYPE_SYMMETRIC#cusparsematrixtype-t), it part of the legacy API that we removed since a long time here. I will investigate if we can do that with the generic API but I'm not optimistic because even with the legacy API, this format was not supported by many routines.
@mipals I confirm that it is not supported by the new API and it was also not supported for sparse matrix-vector and matrix-matrix products with the legacy API:
Ahh, I did not realize that it was only part of the legacy API - and that it was not even supported then. Thats a shame. Thanks for investigating!
I guess I can do it "manually" then as the mat-vecs for both the matrix the transpose is supported. In this case I would need to remove one of the diagonals, however it seems as the standard Diagonal(Tgpu)
throws an ERROR: Scalar indexing is disallowed.
. What is the best way to get around this?
We never implemented a kernel for Diagonal(Tgpu)
if Tgpu
is a sparse matrix on GPU. We should add one.
Describe the bug
Multiplication with a symmetrically wrapped CuSparseMatrix outputs the multiplication with the CuSparseMatrix itself and not the symmetric matrix.
To reproduce
The Minimal Working Example (MWE) for this bug:
Manifest.toml
``` Paste your Manifest.toml here, or accurately describe which version of CUDA.jl and its dependencies (GPUArrays.jl, GPUCompiler.jl, LLVM.jl) you are using. ```
Expected behavior
I expected the behaviour to be similar to the CPU version.
Version info
Details on Julia:
Details on CUDA: