Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split SciMLBase from DiffEqBase #1

Merged
merged 16 commits into from
Jan 27, 2021
Merged

Split SciMLBase from DiffEqBase #1

merged 16 commits into from
Jan 27, 2021

Conversation

ChrisRackauckas
Copy link
Member

@ChrisRackauckas ChrisRackauckas commented Jan 26, 2021

There are many reasons for this.

  1. DiffEqBase.jl has grown to be a base between the differential equation solvers, with common tools for nonlinear solvers and callbacks adding a ton of dependencies. Users like @mauro3 noticed this in DiffEqBase is not "lightweight" DiffEqBase.jl#618
  2. A lot of DiffEqBase was becoming unrelated to differential equations. OptimizationProblem, NonlinearProblem, all of those functions, etc. It's a full interface for SciML, not DiffEq which is by now a subset of the full ecosystem. But it needed to play the Base role, which meant that nonlinear problems were defined in the repo carrying all of the dependencies for the ODE solver's callback system.
  3. It started inviting circular dependencies. Some of these problems are pervasive. We need to get the simplest form to GalacticOptim.jl, Quadrature.jl, NonlinearSolve.jl, etc. which are becoming the DiffEq's of their respective regimes (though there's not as much to do in those areas). But this meant NonlinearSolve.jl needed NonlinearProblem, but NonlinearSolve.jl was used in the callbacks, so... it had its own problem type. This gives an issue to a system like MTK which then has no unique type to target.
  4. There's a lot of churn on the DiffEq solver portions of DiffEqBase, but relatively little on the actual interface portions. So it makes sense to let them be more stable.
  5. There's a ton of packages which are @requires in DiffEqBase, which adds to the compile time. This was done because the library was supposed to avoid dependencies, but as the central piece of the differential equation solvers it really couldn't, and so it used required to fake lower dependencies but some of those like ForwardDiff.jl should really be promoted to being a real dependency now that it doesn't have the "idea" of being no-dependency.

For backwards compatibility, DiffEqBase reexports SciMLBase and imports a ton of the abstract types it used to have. This should allow for the migration to take place over time, while still fixing some of the MTK and NonlinearSolve issues that need a fix ASAP.

DiffEqBase will have a companion PR to match it.

There are some remaining issues here though:

  1. I would like to get rid of the LabelledArrays dependency. Is there a good generic to use for the names? nameof?
  2. Is the split at the right level?
  3. I want to drop the Queryverse stuff like TableTraits and IteratorInterfaceExtensions since we have Tables.jl
  4. What should we do about our linear solver interface? Is there a way to fold it into these other problems? I think not, but there's a few things to think about.

Downstream changes to setup:

  • GalacticOptim should use SciMLBase
  • NonlinearSolve should use SciMLBase
  • ModelingToolkit should use SciMLBase
  • Quadrature should use SciMLBase

There are many reasons for this. 

1. DiffEqBase.jl has grown to be a base between the differential equation solvers, with common tools for nonlinear solvers and callbacks adding a ton of dependencies. Users like @mauro3 noticed this in SciML/DiffEqBase.jl#618

2. A lot of DiffEqBase was becoming unrelated to differential equations. OptimizationProblem, NonlinearProblem, all of those functions, etc. It's a full interface for SciML, not DiffEq which is by now a subset of the full ecosystem. But it needed to play the Base role, which meant that nonlinear problems were defined in the repo carrying all of the dependencies for the ODE solver's callback system.

3. It started inviting circular dependencies. Some of these problems are pervasive. We need to get the simplest form to GalacticOptim.jl, Quadrature.jl, NonlinearSolve.jl, etc. which are becoming the DiffEq's of their respective regimes (though there's not as much to do in those areas). But this meant NonlinearSolve.jl needed NonlinearProblem, but NonlinearSolve.jl was used in the callbacks, so... it had its own problem type. This gives an issue to a system like MTK which then has no unique type to target.

4. There's a lot of churn on the DiffEq solver portions of DiffEqBase, but relatively little on the actual interface portions. So it makes sense to let them be more stable.

5. There's a ton of packages which are @requires in DiffEqBase, which adds to the compile time. This was done because the library was supposed to avoid dependencies, but as the central piece of the differential equation solvers it really couldn't, and so it used required to fake lower dependencies but some of those like ForwardDiff.jl should really be promoted to being a real dependency now that it doesn't have the "idea" of being no-dependency.

For backwards compatibility, DiffEqBase reexports SciMLBase and imports a ton of the abstract types it used to have. This should allow for the migration to take place over time, while still fixing some of the MTK and NonlinearSolve issues that need a fix ASAP.

DiffEqBase will have a companion PR to match it.

There are some remaining issues here though:

1. I would like to get rid of the LabelledArrays dependency. Is there a good generic to use for the names? `nameof`? 

2. Is the split at the right level?

3. I want to drop the Queryverse stuff like TableTraits and IteratorInterfaceExtensions since we have Tables.jl
@ChrisRackauckas
Copy link
Member Author

Tested SciML/NonlinearSolve.jl#25 works.

Copy link
Member

@YingboMa YingboMa left a comment

Choose a reason for hiding this comment

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

Could you move the some of the DiffEqBase tests here, too? It's probably pretty tricky to do, though.

@ChrisRackauckas
Copy link
Member Author

I plan to add a bunch of downstream tests.

@YingboMa
Copy link
Member

Yeah, makes sense. I like this a lot. This should cut down a lot of complication time. BTW, do we want to move OrdinaryDiffEq's generic dense output to DiffEqBase? Then other solvers and callbacks can use that interface.

@devmotion
Copy link
Member

devmotion commented Jan 26, 2021

I agree, it's great to separate the more basic non-DiffEq stuff. Is the plan also to move common functionality (e.g., generic interpolation, initialization, and keyword arguments) that appears in OrdinaryDiffEq and StochasticDiffEq (and to some extent also in DelayDiffEq and StochasticDelayDiffEq) to DiffEqBase then? I assume this would make it a bit easier to synchronize changes in OrdinaryDiffEq, StochasticDiffEq, DelayDiffEq etc. and maybe would allow us to drop the dependency on OrdinaryDiffEq in StochasticDiffEq.

StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
TreeViews = "a2a6695c-b41b-5b7d-aed9-dbfdeacea5d7"
Copy link
Member

Choose a reason for hiding this comment

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

I was a bit surprised to see that the latest release is from July 2018 and the repo contains no Project.toml but only a REQUIRE file. But I assume it just indicates that the package is very stable and no changes are expected?

Copy link
Member Author

@ChrisRackauckas ChrisRackauckas Jan 26, 2021

Choose a reason for hiding this comment

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

It's super stable. @pfitzseb

Choose a reason for hiding this comment

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

Yep. I don't think there are any actively maintained consumers of TreeViews's tree views anymore though ;)

Copy link
Member Author

Choose a reason for hiding this comment

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

What do we define for VSCode and Juno nowadays then? TreeViews still seems to work for Juno?

Choose a reason for hiding this comment

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

Yes. VSCode's tree views (in the workspace) aren't customizable atm.

Copy link
Member

@devmotion devmotion left a comment

Choose a reason for hiding this comment

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

Just noticed that we defined eltype for instances of DESolutionRow and AbstractSciMLOperator although the Julia docs recommend to define it for types.

src/operators.jl Outdated Show resolved Hide resolved
src/tabletraits.jl Outdated Show resolved Hide resolved
@devmotion
Copy link
Member

devmotion commented Jan 26, 2021

  • There's a ton of packages which are @requires in DiffEqBase, which adds to the compile time.

Did you check if the PRs improve the compile time of DiffEqBase?

  1. I would like to get rid of the LabelledArrays dependency. Is there a good generic to use for the names? nameof?

It seems https://github.com/SciML/DiffEqBase.jl/blob/b5ac95fedb065af3b9aeb95a09eb2fa043b7424f/src/solutions/solution_interface.jl#L158 is equivalent to

    return keys(sol.u[1])

so maybe use keys?

@ChrisRackauckas
Copy link
Member Author

Did you check if the PRs improve the compile time of DiffEqBase?

No, that's a secondary concern here. Right now it's a big shuffle so I'm more concerned about correctness.

@ChrisRackauckas
Copy link
Member Author

Is the plan also to move common functionality (e.g., generic interpolation, initialization, and keyword arguments) that appears in OrdinaryDiffEq and StochasticDiffEq (and to some extent also in DelayDiffEq and StochasticDelayDiffEq) to DiffEqBase then? I assume this would make it a bit easier to synchronize changes in OrdinaryDiffEq, StochasticDiffEq, DelayDiffEq etc. and maybe would allow us to drop the dependency on OrdinaryDiffEq in StochasticDiffEq.

Yes, precisely. And we'll want to PR to upstream packages telling them about SciMLBase.jl.

BTW, do we want to move OrdinaryDiffEq's generic dense output to DiffEqBase?

Oh buddy, it's even worse than that:

https://github.com/SciML/DiffEqBase.jl/blob/master/src/interpolation.jl

That's the kind of thing I hope we can start cleaning up.

so maybe use keys?

Yes that looks like it works.

@@ -0,0 +1,42 @@
Tables.isrowtable(::Type{<:DESolution}) = true
Tables.columns(x::DESolution) = Tables.columntable(Tables.rows(x))
Copy link

Choose a reason for hiding this comment

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

Did we have this definition previously? At first glance, it doesn't seem necessary (the fallback in Tables.jl should do the same thing)

Copy link

Choose a reason for hiding this comment

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

Otherwise, all the Tables.jl stuff here looks great

@ChrisRackauckas
Copy link
Member Author

tests

Churning through those downstream tests 😃

@ChrisRackauckas
Copy link
Member Author

DelayDiffEq passed.

@ChrisRackauckas
Copy link
Member Author

LSODA passed.

@ChrisRackauckas
Copy link
Member Author

Sundials passed.

@ChrisRackauckas
Copy link
Member Author

DiffEqCallbacks passed.

@ChrisRackauckas
Copy link
Member Author

DiffEqJump passed

@ChrisRackauckas
Copy link
Member Author

DiffEqBase and ModelingToolkit passed

@ChrisRackauckas
Copy link
Member Author

DiffEqSensitivity passed

@ChrisRackauckas
Copy link
Member Author

StochasticDelayDiffEq passed

@ChrisRackauckas
Copy link
Member Author

DiffEqUncertainty passed

ChrisRackauckas added a commit to SciML/OrdinaryDiffEq.jl that referenced this pull request Jan 27, 2021
This is kind of a hack, but it looks like there was a major regression in that library and I'm not quite sure why, but given I found this while working on SciML/SciMLBase.jl#1 I'm putting a fix to ElasticArrays right inline and will upstream that later. I'm kind of confused because I don't see a recent tag from ElasticArrays but it could've been a versioning thing.
@ChrisRackauckas ChrisRackauckas merged commit 7151bbe into master Jan 27, 2021
@ChrisRackauckas ChrisRackauckas deleted the split branch January 27, 2021 03:25
ChrisRackauckas pushed a commit that referenced this pull request Mar 30, 2021
Vaibhavdixit02 pushed a commit that referenced this pull request Mar 11, 2024
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.

5 participants