@@ -15,24 +15,34 @@ Base.@kwdef struct PardisoJL <: SciMLLinearSolveAlgorithm
15
15
dparm:: Union{Vector{Tuple{Int,Int}}, Nothing} = nothing
16
16
end
17
17
18
- PardisoJLFactorize (;kwargs... ) = PardisoJL (;solver_type= 0 , kwargs... )
19
- PardisoJLIterate (;kwargs... ) = PardisoJL (;solver_type= 1 , kwargs... )
18
+ PardisoJLFactorize (;kwargs... ) = PardisoJL (;solver_type= 0 ,
19
+ solve_phase= Pardiso. NUM_FACT,
20
+ kwargs... )
21
+ PardisoJLIterate (;kwargs... ) = PardisoJL (;solver_type= 1 ,
22
+ solve_phase= Pardiso. SOLVE_ITERATIVE_REFINE,
23
+ kwargs... )
20
24
21
25
# TODO schur complement functionality
22
26
23
27
function init_cacheval (alg:: PardisoJL , cache:: LinearCache )
24
28
@unpack nprocs, solver_type, matrix_type, iparm, dparm = alg
25
29
26
- solver = Pardiso. PARDISO_LOADED[] ? Pardiso. PardisoSolver () : Pardiso. MKLPardisoSolver ()
30
+ solver =
31
+ if Pardiso. PARDISO_LOADED[]
32
+ Pardiso. PardisoSolver ()
33
+ solver_type != = nothing && Pardiso. set_solver! (solver, solver_type)
34
+ else
35
+ Pardiso. MKLPardisoSolver ()
36
+ nprocs != = nothing && Pardiso. set_nprocs! (solver, nprocs)
37
+ end
27
38
28
39
Pardiso. pardisoinit (solver) # default initialization
29
40
30
- nprocs != = nothing && Pardiso. set_nprocs! (ps, nprocs)
31
- solver_type != = nothing && Pardiso. set_solver! (solver, key)
41
+ @show solver
32
42
matrix_type != = nothing && Pardiso. set_matrixtype! (solver, matrix_type)
33
43
cache. verbose && Pardiso. set_msglvl! (solver, Pardiso. MESSAGE_LEVEL_ON)
34
44
35
- if iparm != = nothing # pass in vector of tuples like [(iparm, key)]
45
+ if iparm != = nothing # pass in vector of tuples like [(iparm, key) ... ]
36
46
for i in length (iparm)
37
47
Pardiso. set_iparm! (solver, iparm[i]. .. )
38
48
end
@@ -44,6 +54,8 @@ function init_cacheval(alg::PardisoJL, cache::LinearCache)
44
54
end
45
55
end
46
56
57
+ Pardiso. set_phase! (cacheval, Pardiso. ANALYSIS)
58
+
47
59
return solver
48
60
end
49
61
@@ -62,13 +74,9 @@ function SciMLBase.solve(cache::LinearCache, alg::PardisoJL; kwargs...)
62
74
reltol = cache. reltol
63
75
kwargs = (abstol= abstol, reltol= reltol)
64
76
65
- """
66
- figure out whatever phase is. should set_phase call be in init_cacheval?
67
- can we use phase to store factorization in cache?
68
- """
69
77
alg. solve_phase != = nothing && Pardiso. set_phase! (cacheval, alg. solve_phase)
70
78
Pardiso. pardiso (cache. cacheval, u, A, b)
71
- alg. release_phase != = nothing && Pardiso. set_phase! (cacheval, alg. release_phase) # is this necessary?
79
+ alg. release_phase != = nothing && Pardiso. set_phase! (cacheval, alg. release_phase)
72
80
73
81
return cache. u
74
82
end
0 commit comments