Skip to content

Commit 5d3b79b

Browse files
committed
add functionality. tests failing
1 parent 5b2bf57 commit 5d3b79b

File tree

1 file changed

+31
-15
lines changed

1 file changed

+31
-15
lines changed

src/wrappers.jl

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -300,39 +300,50 @@ end
300300

301301
## Paradiso
302302

303-
struct PardisoJL{F,S,P,A,K} <: SciMLLinearSolveAlgorithm
304-
alg_selector::F
305-
schur::S
306-
parallel::P
303+
struct PardisoJL{F,A,K} <: SciMLLinearSolveAlgorithm
304+
which_paradiso::F
305+
matrix_type::Union{Int, Nothing}
306+
nthreads::Union{Int, Nothing}
307+
solver_type::Union{Int, Nothing}
308+
solve_phase::Union{Int, Nothing}
309+
release_phase::Union{Int, Nothing}
310+
ipram::Union{Int, Nothing}
311+
dpram::Union{Int, Nothing}
307312
args::A
308313
kwargs::K
309314
end
310315

311-
function PardisoJL(args...; alg_selector=:default_alg,
312-
schur=:smart,
313-
parallel=:fancy,
316+
function PardisoJL(args...; which_pardiso=MKLPardisoSolver,
314317
kwargs...)
315318

316-
return PardisoJL(alg_selector, schur, parallel,
319+
return PardisoJL(which_pardiso,
317320
args, kwargs)
318321
end
319322

323+
# some standard implementation - maybe SPD, or
320324
PardisoJL_Default(args...; kwargs...) = PardisoJL(args...;
321-
alg_selector=:this_one,
325+
which_pardiso=:this_one,
322326
kwargs...)
323327

324328
function init_cacheval(alg::PardisoJL, cache::LinearCache)
329+
@unpack verbose, matrix_type
325330

326-
solver =
327-
if alg.alg_selector == :default_alg
328-
MKLPardisoSolver()
329-
elseif alg_selector == :this_one
331+
solver = """ is alg.which_pardiso necessary? """
332+
if Pardiso.PARDISO_LOADED[]
330333
PardisoSolver()
331334
else
332-
PardisoSolver()
335+
MKLPardisoSolver()
333336
end
334337

335-
alg.verbose && set_msglvl!(solver, Pardiso.MESSAGE_LEVEL_ON)
338+
verbose && Pardiso.set_msglvl!(solver, Pardiso.MESSAGE_LEVEL_ON)
339+
matrix_type !== nothing && Pardiso.set_matrixtype!(solver, matrix_type)
340+
nthreads !== nothing && set_nprocs!(ps, nthreads)
341+
# set_iparm!(solver, 5, 13.37)
342+
# set_dparm!(solver, 5, 13.37)
343+
# set_solver!(solver, key)
344+
345+
# inject user code for additional setup stuff
346+
# solver_setup!(solver)
336347

337348
return solver
338349
end
@@ -352,8 +363,13 @@ function SciMLBase.solve(cache::LinearCache, alg::PardisoJL; kwargs...)
352363
kwargs = (abstol=abstol, reltol=reltol,
353364
alg.kwargs...)
354365

366+
Pardiso.set_phase!(ps, alg.phase)
367+
355368
Pardiso.solve!(cacheval, u, A, b)
356369

370+
# is this necessary?
371+
Pardiso.set_phase!(ps, Pardiso.RELEASE_ALL)
372+
357373
return cache.u
358374
end
359375

0 commit comments

Comments
 (0)