Fix GPU CI: propagate modeler backend option to test-problem builders#175
Merged
Conversation
`OptimizationProblem`'s `build_model` methods only forwarded `base_type`
(Exa) or nothing (ADNLP) to the wrapped builder closures, silently
dropping every other modeler option, including `:backend`. As a result,
GPU-strategy tests kept building CPU-resident ExaModels even when
`Modelers.Exa{GPU}` correctly resolved a CUDA backend, which then
crashed MadNLP's KKT construction once the self-hosted GPU runner
started actually exercising these tests (MethodError on
MadNLPGPU.CUDSSSolver with a CPU SparseMatrixCSC).
Restore full option forwarding via `Strategies.options_dict`, matching
the behavior of the pre-refactor callable-modeler pattern (v0.4.17).
Also align the one remaining GPU testset in test_madnlp_extension.jl to
use explicit `{Strategies.GPU}` constructors, like the rest of the
suite.
Add a contract-level regression test (test_problem_definition.jl) that
catches this bug class on CPU-only CI by intercepting the builder
closure's kwargs instead of requiring real GPU hardware.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The self-hosted GPU runner (
kkt) is now functional in CI, and it surfaces 13 testerrors across
test_madncl_extension.jlandtest_madnlp_extension.jl's GPUtestsets — testsets that were always silently skipped before (
is_cuda_on() == false), so this was the first time they actually ran:Root cause:
OptimizationProblem'sOptimization.build_modelmethods intest/problems/problems_definition.jlonly forwardedmodeler[:base_type](Exa) ornothing at all (ADNLP) to the wrapped
build_*_modelclosures, silently droppingevery other modeler option — including
:backend. So aGPU-strategyExamodeler still built a CPU-resident
ExaModels.ExaModel, which then crashed whenhanded to the GPU-only
MadNLPGPU.CUDSSSolver.Confirmed this is a regression (not a pre-existing test bug) against tag
v0.4.17:back then
Modelers.Exa/Modelers.ADNLPwere callable functors that forwardedall options via
Strategies.options_dict(modeler). Commit5d01d1d("test: update suite to the dispatch-based DOCP contract") replaced that pattern
with today's
Optimization.build_modeldispatch but dropped the general optionforwarding in the process.
Also checked CTDirect.jl's
refactor/docp-dispatchbranch for the sameregression in the real DOCP path: it already forwards options correctly
(
Strategies.options_dict(modeler)/modeler[:backend]), so this fix isconfined to CTSolvers' own test harness — no CTDirect change needed.
Changes
test/problems/problems_definition.jl:build_modelforModelers.ADNLP/Modelers.Exanow forwards the fullStrategies.options_dict(modeler)to thebuilder closure instead of dropping options.
test/suite/extensions/test_madnlp_extension.jl: the one remaining GPU testsetusing parameter-less (CPU-defaulting)
Modelers.Exa(...)/Solvers.MadNLP(...)constructors now uses explicit{Strategies.GPU},matching every other GPU testset in the suite.
test/suite/optimization/test_problem_definition.jl(new): contract-levelregression test that catches this bug class on CPU-only CI, without needing
real GPU hardware — it intercepts the builder closure's kwargs with fakes
instead of building a real NLP model. Verified it fails against the pre-fix
code and passes against the fix.
No
src/orext/changes — the strategy/backend metadata and defaulting logicwere already correct; only the test harness failed to use them.
Test plan
regression test.
pass against the fix.
test-gpu-kkt, gated by therun ci gpulabel) — this is thereal verification of the
CUDSSSolver/GPU-array path; no CUDA hardwareavailable locally.
🤖 Generated with Claude Code