Skip to content

Commit

Permalink
Merge pull request #367 from BeatHubmann/main
Browse files Browse the repository at this point in the history
Fix setting of Pardiso iparm and dparm parameters
  • Loading branch information
ChrisRackauckas authored Aug 24, 2023
2 parents f531dd0 + 14ed061 commit 7c9141f
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ext/LinearSolvePardisoExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ function LinearSolve.init_cacheval(alg::PardisoJL,

# pass in vector of tuples like [(iparm::Int, key::Int) ...]
if iparm !== nothing
for i in length(iparm)
Pardiso.set_iparm!(solver, iparm[i]...)
for i in iparm
Pardiso.set_iparm!(solver, i...)
end
end

if dparm !== nothing
for i in length(dparm)
Pardiso.set_dparm!(solver, dparm[i]...)
for d in dparm
Pardiso.set_dparm!(solver, d...)
end
end

Expand Down
77 changes: 77 additions & 0 deletions test/pardiso/pardiso.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,80 @@ sol33 = solve(linsolve)
@test sol11.u sol31.u
@test sol12.u sol32.u
@test sol13.u sol33.u

# Testing and demonstrating Pardiso.set_iparm! for MKLPardisoSolver
solver = Pardiso.MKLPardisoSolver()
iparm = [
(1, 1),
(2, 2),
(3, 0),
(4, 0),
(5, 0),
(6, 0),
(7, 0),
(8, 20),
(9, 0),
(10, 13),
(11, 1),
(12, 1),
(13, 1),
(14, 0),
(15, 0),
(16, 0),
(17, 0),
(18, -1),
(19, -1),
(20, 0),
(21, 0),
(22, 0),
(23, 0),
(24, 10),
(25, 0),
(26, 0),
(27, 1),
(28, 0),
(29, 0),
(30, 0),
(31, 0),
(32, 0),
(33, 0),
(34, 0),
(35, 0),
(36, 0),
(37, 0),
(38, 0),
(39, 0),
(40, 0),
(41, 0),
(42, 0),
(43, 0),
(44, 0),
(45, 0),
(46, 0),
(47, 0),
(48, 0),
(49, 0),
(50, 0),
(51, 0),
(52, 0),
(53, 0),
(54, 0),
(55, 0),
(56, 0),
(57, 0),
(58, 0),
(59, 0),
(60, 0),
(61, 0),
(62, 0),
(63, 0),
(64, 0),
]

for i in iparm
Pardiso.set_iparm!(solver, i...)
end

for i in Base.OneTo(length(iparm))
@test Pardiso.get_iparm(solver, i) == iparm[i][2]
end

0 comments on commit 7c9141f

Please sign in to comment.