I encounter a problem using LinearSolve
to solve a sparse linear system with PardisoJL()
:
The test case, test_PardisoJL.jl
:
using Pkg
Pkg.activate(; temp=true)
Pkg.add("LinearSolve")
Pkg.add("Pardiso")
using LinearAlgebra
using LinearSolve
using Random
using SparseArrays
import Pardiso
include("A.jl")
A = makeA()
b = ones(size(A, 1))
linprob = LinearProblem(A, b)
x1 = LinearSolve.solve(linprob, PardisoJL())
x2 = A\b
@show norm(x1 - x2)
the result is clearly wrong. Matrix A
is a 60x60 SparseMatrixCSC
constructed in A.jl
test_pardiso.jl
show that using Pardiso
directly works fine:
using Pkg
Pkg.activate(; temp=true)
Pkg.add("MKL")
Pkg.add("Pardiso")
using LinearAlgebra
using MKL
using Random
using SparseArrays
using Pardiso
include("A.jl")
A = makeA()
b = ones(size(A, 1))
ps = MKLPardisoSolver()
x1 = similar(b)
Pardiso.solve!(ps, x1, A, b)
x2 = A\b
@show norm(x1 - x2)
test_PardisoJL.jl (321 Bytes)
test_pardiso.jl (300 Bytes)
A.jl (4.2 KB)