Skip to content

Conversation

jClugstor
Copy link
Member

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context


using CommonSolve: CommonSolve
using DiffEqBase: DiffEqBase # Needed for `init` / `solve` dispatches
#using DiffEqBase: DiffEqBase # Needed for `init` / `solve` dispatches
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a comment, just delete.

@@ -1,3 +1,449 @@
const allowedkeywords = (:dense,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The utilities at the top here are reused by DiffEqBase, NonlinearSolveBase, OptimizationBase (in the near future), etc. Let's move these to SciMLBase and share them across the different repos.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The allowedkwargs handling, the special error types, etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought so too, but I figured it might be nice for each to have a separate list of acceptable keywords, so if you tried to pass e.g. dtmin in to a NonlinearSolve it would give a nice error. Also the messages right now are specific to DiffEqs, they point to the DiffEq docs. I made it so that if there's a mismatch kwarg for a nonlinear solve it points to the NonlinearSolve docs.

But yeah if these are better in SciMLBase I can just put them there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also a lot of small utility functions that live in DiffEqBase right now, e.g.
get_concrete_problem, extract_alg, promote_u0, anyeltypedual etc. that get used in the solve functions. I'm thinking those should also be moved to SciMLBase?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list of acceptable kwargs, yes that one should be problem specific, that would be a nice improvement.

But the others yes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the definitions for functions like promote_u0 and anyeltypedual etc. are in different extensions in DiffEqBase. I'm thinking I should create corresponding extensions in SciMLBase for those packages and move the functions to those. But I'll keep the parts of the extensions specific to DiffEqs in the extensions in DiffEqBase.

@jClugstor jClugstor force-pushed the solve_dispatches branch 5 times, most recently from 0983668 to 3978e7e Compare September 4, 2025 14:20
@jClugstor jClugstor marked this pull request as ready for review September 5, 2025 21:20
@jClugstor jClugstor marked this pull request as draft September 5, 2025 21:37
@jClugstor jClugstor marked this pull request as ready for review September 5, 2025 22:44
@jClugstor
Copy link
Member Author

@ChrisRackauckas
A few things:
CI is still using the solve in DiffEqBase, since it's loaded for tests. In DiffEqBase it has solve(prob::NonlinearProblem, which I changed to solve(prob::AbstractNonlinearProblem here, but the first is more specific so it goes through the DiffEqBase. So in order to fully test everything it needs a version of DiffEqBase without the solve dispatches for NonlinearProblem. I'm wondering what the best way to do that is since we can't just release a DiffEqBase without solve for NonlinearProblems.

I've tested this locally with a branch of DiffEqBase with the NonlinearSolve stuff removed and it works going through the new solve dispatches.

I also added simple adjoint tests to make sure that the new extensions work. Those use SciMLSensitivity, Enzyme, and Mooncake so I put those in nopre.

@ChrisRackauckas
Copy link
Member

sources should handle that on v1

@jClugstor
Copy link
Member Author

@ChrisRackauckas The tests for 1.11 are all using a branch of DiffEqBase without solve for NonlinearProblems (https://github.com/jClugstor/DiffEqBase.jl/tree/remove_nonlinear), so they should be going through the correct code path.

The downgrade errors are weird, is it just trying to get a version of NonlinearSolveBase that doesn't exist in the registry yet, since I bumped the version of NonlinearSolveBase and it's compat bounds for the other subpackages?

Other than that all of the core and downstream tests appear to be good. Integration tests appear to be unrelated, the MTK initialization one makes me nervous, but it looks like it has something to do with the DEOptions.

Project.toml Outdated
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed in tests?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, it's not used anywhere in the tests, so not needed anymore.

)
Aqua.test_stale_deps(NonlinearSolveBase; ignore = [:TimerOutputs])
Aqua.test_piracies(NonlinearSolveBase)
#ENSEMBLE PROBLEM SHOULD BE REMOVED, THIS IS TEMPORARY FOR TESTS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@ChrisRackauckas
Copy link
Member

Just a few small comments.

@jClugstor
Copy link
Member Author

Alright, there is now absolutely zero dependency on DiffEqBase.

@ChrisRackauckas ChrisRackauckas merged commit 10b9d30 into SciML:master Sep 12, 2025
76 of 98 checks passed
@ChrisRackauckas
Copy link
Member

Now give a pull request that sets up all of the version bumps that are required for this.

@ChrisRackauckas
Copy link
Member

Actually I got this

ChrisRackauckas-Claude pushed a commit to ChrisRackauckas-Claude/NonlinearSolve.jl that referenced this pull request Sep 12, 2025
Following the merge of PR SciML#669 which migrated solve dispatches from
DiffEqBase to NonlinearSolveBase and updated NonlinearSolveBase to v1.15.0,
this PR bumps the minor versions of all dependent packages that had their
compat requirements updated to require NonlinearSolveBase v1.15:

- NonlinearSolve: 4.10.1 → 4.11.0
- BracketingNonlinearSolve: 1.3.1 → 1.4.0
- SimpleNonlinearSolve: 2.7.1 → 2.8.0
- NonlinearSolveFirstOrder: 1.8.1 → 1.9.0
- NonlinearSolveQuasiNewton: 1.8.1 → 1.9.0
- NonlinearSolveSpectralMethods: 1.3.1 → 1.4.0
- NonlinearSolveHomotopyContinuation: 0.1.6 → 0.2.0
- NonlinearSolveSciPy: 1.0.1 → 1.1.0
- SCCNonlinearSolve: 1.4.1 → 1.5.0

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
ChrisRackauckas added a commit that referenced this pull request Sep 12, 2025
Following the merge of PR #669 which migrated solve dispatches from
DiffEqBase to NonlinearSolveBase and updated NonlinearSolveBase to v1.15.0,
this PR bumps the minor versions of all dependent packages that had their
compat requirements updated to require NonlinearSolveBase v1.15:

- NonlinearSolve: 4.10.1 → 4.11.0
- BracketingNonlinearSolve: 1.3.1 → 1.4.0
- SimpleNonlinearSolve: 2.7.1 → 2.8.0
- NonlinearSolveFirstOrder: 1.8.1 → 1.9.0
- NonlinearSolveQuasiNewton: 1.8.1 → 1.9.0
- NonlinearSolveSpectralMethods: 1.3.1 → 1.4.0
- NonlinearSolveHomotopyContinuation: 0.1.6 → 0.2.0
- NonlinearSolveSciPy: 1.0.1 → 1.1.0
- SCCNonlinearSolve: 1.4.1 → 1.5.0

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
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.

2 participants