Skip to content

Commit 92e3128

Browse files
Merge pull request #74 from harmoniqs/feat/madnlp-gpu-passthroughs
Add MadNLP pass-through fields (linear_solver, array_type, etc.)
2 parents c876f23 + 83da076 commit 92e3128

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

ext/MadNLPSolverExt/solver.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,12 @@ function DirectTrajOpt.set_options!(optimizer::AbstractOptimizer, options::MadNL
208208
if name in ignored_options
209209
continue
210210
end
211-
# TODO: allow internal defaults, i.e. do not set the internal options dict unless the user actually specified the associated opt
211+
# `nothing` means "use MadNLP's own default" — don't overwrite the optimizer's
212+
# internal dict in that case. Applies to the pass-through fields
213+
# (linear_solver, array_type, kkt_system, cudss_ordering).
214+
if value === nothing
215+
continue
216+
end
212217
if name == :print_level
213218
optimizer.options[name] = MadNLP.LogLevels(value)
214219
elseif name == :hessian_approximation

src/solvers/madnlp_solver/options.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ export MadNLPOptions
77
print_level::Int = 3 # (MadNLP.TRACE::MadNLP.LogLevels = 1, ..., MadNLP.ERROR::MadNLP.LogLevels = 6)
88
hessian_approximation::String = "exact" # (exact = MadNLP.ExactHessian, compact_lbfgs = MadNLP.CompactLBFGS) # no other QN methods supported in conjunction with MadNLP.SparseCallback
99

10+
# Pass-throughs consumed by MadNLP's MOI layer (not by MadNLP itself);
11+
# leave as `nothing` to use MadNLP defaults. Only forwarded when non-nothing.
12+
linear_solver::Any = nothing # e.g. MadNLPGPU.CUDSSSolver, MadNLP.LapackCPUSolver
13+
array_type::Any = nothing # e.g. CUDA.CuArray for GPU
14+
kkt_system::Any = nothing # e.g. MadNLP.SparseUnreducedKKTSystem
15+
cudss_ordering::Any = nothing # e.g. MadNLPGPU.AMD_ORDERING
16+
1017
# # Only supported by DirectTrajOpt._solve, as an optional kwarg override of `hessian_approximation`;
1118
# # `hessian_approximation = eval_hessian ? "exact" : "compact_lbfgs"`
1219
# eval_hessian::Bool = true

0 commit comments

Comments
 (0)