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

LDL' factorizations are failing with complex Hermitian matrices #2

Closed
amontoison opened this issue Dec 3, 2023 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@amontoison
Copy link
Member

amontoison commented Dec 3, 2023

using Test
using CUDA, CUDA.CUSPARSE
using CUDSS
using SparseArrays
using LinearAlgebra

using Random
Random.seed!(1)

n = 100
p = 5
T = ComplexF64
R = real(T)
A_cpu = sprand(T, n, n, 0.01) + I
A_cpu = A_cpu + A_cpu'
X_cpu = zeros(T, n, p)
B_cpu = rand(T, n, p)

A_gpu = CuSparseMatrixCSR(A_cpu)
X_gpu = CuMatrix(X_cpu)
B_gpu = CuMatrix(B_cpu)

matrix = CudssMatrix(A_gpu, "H", 'F', index='O')
config = CudssConfig()
data = CudssData()
solver = CudssSolver(matrix, config, data)

cudss("analysis", solver, X_gpu, B_gpu)
cudss("factorization", solver, X_gpu, B_gpu)

nnz_decomposition = cudss_get(solver, "lu_nnz")
inertia = cudss_get(solver, "inertia")

cudss("solve", solver, X_gpu, B_gpu)

R_gpu = B_gpu - CuSparseMatrixCSR(A_cpu) * X_gpu
@test norm(R_gpu)  eps(R)

Y_cpu = zeros(T, n, n)
Y_gpu = CuMatrix(Y_cpu)
C_cpu = Matrix{T}(I, n, n)
C_gpu = CuMatrix(C_cpu)

cudss("solve", solver, Y_gpu, C_gpu)

RR_gpu = C_gpu - CuSparseMatrixCSR(A_cpu) * Y_gpu
@test norm(RR_gpu)  eps(R)
using MatrixMarket

MatrixMarket.mmwrite("cudss_A.mtx", A_gpu |> SparseMatrixCSC)
MatrixMarket.mmwrite("cudss_B.mtx", B_gpu |> Matrix |> sparse)
MatrixMarket.mmwrite("cudss_X.mtx", X_gpu |> Matrix |> sparse)
MatrixMarket.mmwrite("cudss_Y.mtx", Y_gpu |> Matrix |> sparse)
@amontoison amontoison added the bug Something isn't working label Dec 3, 2023
@amontoison amontoison mentioned this issue Dec 4, 2023
@amontoison
Copy link
Member Author

amontoison commented Dec 8, 2023

It works if we remove the pivoting with

cudss_set(solver, "pivot_type", 'N')

This issue will be fixed in the next release.

@amontoison
Copy link
Member Author

Fixed by #17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant