@@ -25,15 +25,18 @@ function LinearSolve.init_cacheval(alg::PardisoJL,
25
25
@unpack nprocs, solver_type, matrix_type, cache_analysis, iparm, dparm = alg
26
26
A = convert (AbstractMatrix, A)
27
27
28
- solver = if Pardiso. PARDISO_LOADED[]
28
+ transposed_iparm = 1
29
+ solver = if false && Pardiso. PARDISO_LOADED[]
29
30
solver = Pardiso. PardisoSolver ()
30
31
solver_type != = nothing && Pardiso. set_solver! (solver, solver_type)
31
32
32
33
solver
33
34
else
34
35
solver = Pardiso. MKLPardisoSolver ()
35
36
nprocs != = nothing && Pardiso. set_nprocs! (solver, nprocs)
36
-
37
+ # for mkl 1 means conjugated an 2 means transposed.
38
+ # https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2024-0/pardiso-iparm-parameter.html#IPARM37
39
+ transposed_iparm = 2
37
40
solver
38
41
end
39
42
@@ -73,7 +76,8 @@ function LinearSolve.init_cacheval(alg::PardisoJL,
73
76
# applies these exact factors L and U for the next steps in a
74
77
# preconditioned Krylov-Subspace iteration. If the iteration does not
75
78
# converge, the solver will automatically switch back to the numerical factorization.
76
- Pardiso. set_iparm! (solver, 3 , round (Int, abs (log10 (reltol)), RoundDown) * 10 + 1 )
79
+ # Be aware that in the intel docs, iparm indexes are one lower.
80
+ Pardiso. set_iparm! (solver, 4 , round (Int, abs (log10 (reltol)), RoundDown) * 10 + 1 )
77
81
end
78
82
79
83
# pass in vector of tuples like [(iparm::Int, key::Int) ...]
@@ -91,7 +95,7 @@ function LinearSolve.init_cacheval(alg::PardisoJL,
91
95
92
96
# Make sure to say it's transposed because its CSC not CSR
93
97
# This is also the only value which should not be overwritten by users
94
- Pardiso. set_iparm! (solver, 12 , 1 )
98
+ Pardiso. set_iparm! (solver, 12 , transposed_iparm )
95
99
96
100
if cache_analysis
97
101
Pardiso. set_phase! (solver, Pardiso. ANALYSIS)
0 commit comments