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

GPU Documention Broken #257

Closed
zjwegert opened this issue Jan 8, 2021 · 3 comments
Closed

GPU Documention Broken #257

zjwegert opened this issue Jan 8, 2021 · 3 comments

Comments

@zjwegert
Copy link

zjwegert commented Jan 8, 2021

Hi, the GPU example for a general square system appears to be broken.

using CUDA, Krylov
using CUDA.CUSPARSE, SparseArrays

# LU ≈ A for CuSparseMatrixCSC matrices
P = ilu02(A_gpu, 'O')

# Solve Py = x
function ldiv!(y, P, x)
  copyto!(y, x)                        
  sv2!('N', 'L', 'N', 1.0, P, y, 'O')     # <---- 3rd entry (`N`) not recognized 
  sv2!('N', 'U', 'U', 1.0, P, y, 'O')    # <---- 3rd entry (`U`) not recognized 
  return y
end

# Operator that model P⁻¹
y = similar(b_gpu); n = length(b_gpu); T = eltype(b_gpu)
opM = LinearOperator(T, n, n, false, false, x -> ldiv!(y, P, x))

# Solve an unsymmetric system with an incomplete LU preconditioner on GPU
(x, stats) = bicgstab(A_gpu, b_gpu, M=opM)

The arrowed lines appear to be the issue. Is this equivalent to sv2!('N', 'L', 1.0, P, y, 'O') and sv2!('N', 'U', 1.0, P, y, 'O') respectively?

@amontoison
Copy link
Member

amontoison commented Jan 9, 2021

It seems that the problem comes from CUDA.jl.
I don't understand why we have the old behavior of the sv2! function with the last release 2.4.0.
The 3rd entry U (or N) means that the triangular has a unit diagonal (or not).
With the old syntax, you need to use the keyword argument unit_diag = true or unit_diag = false.

@Omega-xyZac can you the test the code in the commit 87c21a9 ?
I updated the documentation recently (#247).

@zjwegert
Copy link
Author

zjwegert commented Jan 9, 2021

Replied on haampie/IncompleteLU.jl#18.

@amontoison
Copy link
Member

With the last releases of CUDA.jl, the code in the documentation is working fine.

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

No branches or pull requests

2 participants