Skip to content

Commit

Permalink
working 3rd part solvers
Browse files Browse the repository at this point in the history
  • Loading branch information
goulart-paul committed May 17, 2024
1 parent 51120f6 commit 49eb7d0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
28 changes: 14 additions & 14 deletions src/kktsolvers/direct-ldl/directldl_pardiso.jl
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
using AMD, Pardiso
import Pardiso

abstract type AbstractPardisoDirectLDLSolver{T} <: AbstractDirectLDLSolver{T} end

# MKL Pardiso variant
struct MKLPardisoDirectLDLSolver{T} <: AbstractPardisoDirectLDLSolver{T}
ps::MKLPardisoSolver
ps::Pardiso.MKLPardisoSolver

function MKLPardisoDirectLDLSolver{T}(KKT::SparseMatrixCSC{T},Dsigns,settings) where {T}
Pardiso.mkl_is_available() || error("MKL Pardiso is not available")
ps = MKLPardisoSolver()
pardiso_init(ps,KKT)
ps = Pardiso.MKLPardisoSolver()
pardiso_init(ps,KKT,Dsigns,settings)
return new(ps)
end
end

# Panua Pardiso variant
struct PanuaPardisoDirectLDLSolver{T} <: AbstractPardisoDirectLDLSolver{T}
ps::PardisoSolver
ps::Pardiso.PardisoSolver

function PanuaPardisoDirectLDLSolver{T}(KKT::SparseMatrixCSC{T},Dsigns,settings) where {T}

Pardiso.panua_is_available() || error("Panua Pardiso is not available")
ps = PardisoSolver()
pardiso_init(ps,KKT)
ps = Pardiso.PardisoSolver()
pardiso_init(ps,KKT,Dsigns,settings)
ps.iparm[8]=-99 # No IR
return new(ps)
end
end

function pardiso_init(ps,KKT)
function pardiso_init(ps,KKT,Dsigns,settings)

#NB: ignore Dsigns here because pardiso doesn't
#use information about the expected signs
Expand All @@ -37,12 +37,12 @@ function pardiso_init(ps,KKT)
perm = amd(KKT)

#perform logical factor
set_matrixtype!(ps, Pardiso.REAL_SYM_INDEF)
pardisoinit(ps)
fix_iparm!(ps, :N)
set_phase!(ps, Pardiso.ANALYSIS)
set_perm!(ps, perm)
pardiso(ps, KKT, [1.]) #RHS irrelevant for ANALYSIS
Pardiso.set_matrixtype!(ps, Pardiso.REAL_SYM_INDEF)
Pardiso.pardisoinit(ps)
Pardiso.fix_iparm!(ps, :N)
Pardiso.set_phase!(ps, Pardiso.ANALYSIS)
Pardiso. set_perm!(ps, perm)
Pardiso.pardiso(ps, KKT, [1.]) #RHS irrelevant for ANALYSIS
end


Expand Down
2 changes: 1 addition & 1 deletion src/settings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ min\\_terminate\\_step\\_length | 1e-4 | minimum step size allowed
||
__Linear Solver Settings__||
direct\\_kkt\\_solver | true | use a direct linear solver method (required true)
direct\\_solve\\_method | :qdldl | direct linear solver (:qdldl, :mkl or :cholmod)
direct\\_solve\\_method | :qdldl | direct linear solver (e.g. :qdldl, :mkl, :panua, :ma57, :cholmod, :faer)
static\\_regularization\\_enable | true | enable KKT static regularization
static\\_regularization\\_eps | 1e-7 | KKT static regularization parameter
static\\_regularization\\_proportional | eps(T)^2 | additional regularization parameter w.r.t. the maximum abs diagonal term
Expand Down

0 comments on commit 49eb7d0

Please sign in to comment.