Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CUSOLVER] Interface sparse Cholesky and QR factorizations #2121

Merged
merged 2 commits into from
Oct 30, 2023

Conversation

amontoison
Copy link
Member

@amontoison amontoison commented Oct 21, 2023

CUSOLVER has sparse Cholesky and QR factorizations but the API is not documented...
Performing these factorizations on GPU is something that many Julia users want.

@amontoison amontoison force-pushed the cusolver_sparse_factorizations branch from 1340b3f to 76e0504 Compare October 28, 2023 23:25
@amontoison amontoison marked this pull request as ready for review October 29, 2023 00:18
@maleadt maleadt merged commit 689f5b6 into JuliaGPU:master Oct 30, 2023
1 check passed
@amontoison amontoison deleted the cusolver_sparse_factorizations branch October 30, 2023 08:46
@maleadt
Copy link
Member

maleadt commented Oct 30, 2023

As seen on CI: https://buildkite.com/julialang/cuda-dot-jl/builds/4483#018b7ff0-eaf5-41cb-8e60-a5f7e112a3cc

Worker 3 failed running test libraries/cusolver/sparse_factorizations:
Some tests did not pass: 0 passed, 0 failed, 8 errored, 0 broken.
libraries/cusolver/sparse_factorizations: Error During Test at /var/lib/buildkite-agent/builds/gpuci-13/julialang/cuda-dot-jl/test/libraries/cusolver/sparse_factorizations.jl:7
  Got exception outside of a @test
  UndefVarError: `sprand` not defined

@maleadt
Copy link
Member

maleadt commented Oct 30, 2023

Ah, I guess CI didn't fully run on here because you marked it as 'ready' only after pushing. I'll push a fix.

@shakedregev
Copy link

Very nice! One comment that I have is that the functions use British English (as opposed to American English) spelling for words such as analyze/analyse and factorize/factorise. This is sure to spark a heated debate, though I am not sure what currently the default is in Julia. Maybe it would be better to stay away from words that have these differences in function names.

@ytdHuang
Copy link

Would it be possible to support the type of CuSparseMatrixCSC ?

@amontoison
Copy link
Member Author

amontoison commented Oct 31, 2023

@shakedregev
What I can do is to definite both analyse/analyze and factorise/factorize.
No need to start an heated debate if we have both versions :)

@ytdHuang
It is only possible for the Cholesky decomposition.
The CuSparseMatrixCSC should be identical to the CuSparseMatrixCSR because the matrix is symmetric in the real case. If the matrix is complex Hermitian, we can do the same trick if we conjugate the non-zeros with conj(A.nzVal).

@ytdHuang
Copy link

ytdHuang commented Oct 31, 2023

@amontoison
Thank you for the information.
But the problem I would like to solve is complex non-Hermitian, so I have to use QR algorithm.

@amontoison
Copy link
Member Author

amontoison commented Oct 31, 2023

I suggest to try a Krylov solver with an incomplete ILU(0) preconditioner in that case.
You can find how to do that here.

You can also solve A'Ax = Ab to recover a complex Hermitian problem.
The product A' * A will return a CuSparseMatrixCSC but the matrix will be more ill-conditioned and will have more non-zeros.

@ytdHuang
Copy link

@amontoison
Thank you again for the information~
Due to some reason, the problem I'm solving doesn't satisfy A'Ax = A'b.

@amontoison
Copy link
Member Author

What is the problem that you want to solve?
A'Ax = A'b is an optimality condition for least-squares problems.

@ytdHuang
Copy link

Kinda hard to explain ...
But this is our package https://github.com/NCKU-QFort/HierarchicalEOM.jl
We tried this before A'Ax = A'b, but it never gives us correct answers.

@ChrisRackauckas
Copy link
Member

Why is this not for example overloading qr(A:: CuSparseMatrixCSC) to do the right thing and instead defining things that are not in the standard linear algebra API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants