Skip to content

Commit

Permalink
[MadNLPGPU] Upgrade CUDSS -- support iterative refinement and hybrid …
Browse files Browse the repository at this point in the history
…mode (#329)
  • Loading branch information
amontoison authored Jul 15, 2024
1 parent faa17a8 commit dbfc0fc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/MadNLPGPU/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
[compat]
AMD = "0.5"
CUDA = "5"
CUDSS = "0.1"
CUDSS = "0.3.1"
CUSOLVERRF = "0.2"
KernelAbstractions = "0.9"
MadNLP = "0.7, 0.8"
Expand Down
4 changes: 4 additions & 0 deletions lib/MadNLPGPU/src/LinearSolvers/cudss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import CUDSS
cudss_algorithm::MadNLP.LinearFactorization = MadNLP.LDL
ordering::ORDERING = DEFAULT_ORDERING
perm::Vector{Cint} = Cint[]
ir::Int = 0
hybrid::Bool = false
end

mutable struct CUDSSSolver{T} <: MadNLP.AbstractLinearSolver{T}
Expand Down Expand Up @@ -61,6 +63,8 @@ function CUDSSSolver(
end
CUDSS.cudss_set(solver, "user_perm", opt.perm)
end
(opt.ir > 0) && CUDSS.cudss_set(solver, "ir_n_steps", opt.ir)
opt.hybrid && CUDSS.cudss_set(solver, "hybrid_mode", 1)

x_gpu = CUDA.zeros(T, n)
b_gpu = CUDA.zeros(T, n)
Expand Down
10 changes: 10 additions & 0 deletions lib/MadNLPGPU/test/madnlpgpu_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ testset = [
),
[],
],
[
"CUDSS-HYBRID",
()->MadNLP.Optimizer(
linear_solver=MadNLPGPU.CUDSSSolver,
print_level=MadNLP.ERROR,
hybrid=true,
ir=1,
),
[],
],
[
"CUSOLVERRF",
()->MadNLP.Optimizer(
Expand Down

0 comments on commit dbfc0fc

Please sign in to comment.