Skip to content

When I use your example to test the GPU support, I found some bugs. #435

Answered by amontoison
liaoweiyang2017 asked this question in Q&A
Discussion options

You must be logged in to vote

@liaoweiyang2017
The matrix of your example wasn't hermitian.
I fixed it and with the release 0.8 I was able to solve this complex linear system on GPU.

using CUDA, Krylov, LinearOperators, BenchmarkTools
using CUDA.CUSPARSE, SparseArrays, LinearAlgebra

function symmetric_definite(n :: Int=10)
  A = spdiagm(-5 => (1 + im) * ones(n-5), 0 => 4*ones(n), 5 => (1 - im) * ones(n-5)) 
  b = A * [1:n;]
  return A, b
end

# CPU Arrays
n = 20000
A_cpu, b_cpu = symmetric_definite(n)

# GPU Arrays
A_gpu = CuSparseMatrixCSC(A_cpu)
b_gpu = CuVector(b_cpu)

# LLᵀ ≈ A for CuSparseMatrixCSC matrices
P = ic02(A_gpu, 'O')

# Solve Py = x
function ldiv!(y, P, x)
  copyto!(y, x)                        # Vari…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by amontoison
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants