feat(integrators): parameterize SciML{P<:Union{CPU,GPU}} for GPU support#178
Merged
Conversation
Make the SciML ODE integrator a device-parameterized strategy along the
Exa/MadNLP pattern (GPU roadmap phase 1 / D1). SciML() ≡ SciML{CPU}, so every
existing call site is unaffected. Adds per-parameter metadata seam, the
__consistent_initial_condition device validator (CUDA extension), and Family-A
parameter tests.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… registry back-compat A consumer that registers SciML without a device parameter (e.g. CTFlows' flow registry) queries parameter on the bare SciML type. The parameterization dropped the bare method, and AbstractIntegrator has no family-level fallback (unlike CTBase's AbstractADBackend), so bare parameter(SciML) threw NotImplemented, breaking every current CTFlows flow-construction path. Restore the bare method (nothing) alongside the parameterized one (P); add a regression guard test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ocots
added a commit
that referenced
this pull request
Jul 19, 2026
Bump version to 0.4.30-beta and update CHANGELOG.md / BREAKING.md
for the SciML{P<:Union{CPU,GPU}} integrator parameterization (PR #178).
No breaking changes: SciML() ≡ SciML{CPU}.
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.
What & why
Parameterize the SciML ODE integrator on the execution device,
SciML{P<:Union{CPU,GPU}}, exactly along the existingModelers.Exa{P}/Solvers.MadNLP{P}pattern. This is phase 1 of the CTFlows GPU roadmap (roadmap-v4 §5, decision D1): it makes(:sciml, :gpu)reachable in registries/descriptions so downstream packages (CTFlows) can resolve aGPUintegrator through the existing strategy machinery.SciML() ≡ SciML{CPU}— zero breakage for every current caller.Changes
src/Integrators/sciml.jl— struct gains a leading device parameterSciML{P<:Union{CPU,GPU},O,OP,OT};parameterextractsP;default_parameter = CPU; parameterizedSciML{P}(...)constructor + bareSciML(...)delegating throughdefault_parameter;build_sciml_integratorstub takesP; baremetadata(SciML)back-compat delegation (moved to core, mirroringExa);__consistent_initial_conditionstub.ext/CTSolversSciMLIntegrator.jl—metadata(SciML{P})(option set currently identical for both devices —Pmarks the seam where GPU-specific defaults/validators land later);build_sciml_integrator(SciMLTag, P; …)buildsSciML{P,…}.ext/CTSolversCUDA.jl— device-aware__consistent_initial_conditionmethods: aCuArrayu0is inconsistent withSciML{CPU}, a hostArrayu0inconsistent withSciML{GPU}. Defined here (reusing the existing CUDA extension) so the consuming package can call it without adding its own CUDA extension; its call site lands in CTFlows, where a concreteu0exists (problem construction / solve).test/suite/integrators/test_sciml_parameter.jl(new) — Family-A contract tests:parameter/default_parameter/id, per-parametermetadata+ bare delegation, per-device construction, registry[CPU, GPU]+extract_global_parameter_from_method, and the__consistent_initial_conditionvalidator.test/suite/integrators/test_integrator_stubs.jl— updated the stub calls to the newbuild_sciml_integrator(tag, P)signature.Tests
Run locally via
ct-dev-mcp/Pkg.test:suite/integrators— 179 passedsuite/strategies— 391 passedNotes
build_integrator(; kwargs...) = SciML(; kwargs...)is unchanged; its use is retired later in CTFlows phase 2.alg/option defaults; surfacing__consistent_initial_conditionat a realu0call site (CTFlows); AMDGPU/Metal.🤖 Generated with Claude Code