Skip to content

Fix GPU CI: propagate modeler backend option to test-problem builders#175

Merged
ocots merged 2 commits into
mainfrom
fix/gpu-exa-backend-propagation
Jul 15, 2026
Merged

Fix GPU CI: propagate modeler backend option to test-problem builders#175
ocots merged 2 commits into
mainfrom
fix/gpu-exa-backend-propagation

Conversation

@ocots

@ocots ocots commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

The self-hosted GPU runner (kkt) is now functional in CI, and it surfaces 13 test
errors across test_madncl_extension.jl and test_madnlp_extension.jl's GPU
testsets — testsets that were always silently skipped before (is_cuda_on() == false), so this was the first time they actually ran:

MethodError: no method matching MadNLPGPU.CUDSSSolver(::SparseMatrixCSC{Float64, Int32}; opt::MadNLPGPU.CudssSolverOptions)

Root cause: OptimizationProblem's Optimization.build_model methods in
test/problems/problems_definition.jl only forwarded modeler[:base_type] (Exa) or
nothing at all (ADNLP) to the wrapped build_*_model closures, silently dropping
every other modeler option — including :backend. So a GPU-strategy Exa
modeler still built a CPU-resident ExaModels.ExaModel, which then crashed when
handed 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.ADNLP were callable functors that forwarded
all options via Strategies.options_dict(modeler). Commit 5d01d1d
("test: update suite to the dispatch-based DOCP contract") replaced that pattern
with today's Optimization.build_model dispatch but dropped the general option
forwarding in the process.

Also checked CTDirect.jl's refactor/docp-dispatch branch for the same
regression in the real DOCP path: it already forwards options correctly
(Strategies.options_dict(modeler) / modeler[:backend]), so this fix is
confined to CTSolvers' own test harness — no CTDirect change needed.

Changes

  • test/problems/problems_definition.jl: build_model for Modelers.ADNLP /
    Modelers.Exa now forwards the full Strategies.options_dict(modeler) to the
    builder closure instead of dropping options.
  • test/suite/extensions/test_madnlp_extension.jl: the one remaining GPU testset
    using 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-level
    regression 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/ or ext/ changes — the strategy/backend metadata and defaulting logic
were already correct; only the test harness failed to use them.

Test plan

  • Full CPU test suite green locally (2587/2587 passed), including the new
    regression test.
  • New regression test manually verified to fail against the pre-fix code and
    pass against the fix.
  • GPU CI job (test-gpu-kkt, gated by the run ci gpu label) — this is the
    real verification of the CUDSSSolver/GPU-array path; no CUDA hardware
    available locally.

🤖 Generated with Claude Code

`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>
@ocots ocots added run ci gpu Trigget CI on GPU run ci cpu Trigget CI on CPU labels Jul 15, 2026
@ocots ocots removed run ci cpu Trigget CI on CPU run ci gpu Trigget CI on GPU labels Jul 15, 2026
@ocots ocots merged commit add2b80 into main Jul 15, 2026
8 checks passed
@ocots ocots deleted the fix/gpu-exa-backend-propagation branch July 15, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant