gaioguys / GAIO.jl

A Julia package for set oriented computations.
MIT License
9 stars 4 forks source link

Integrate DifferentialEquations.jl #100

Open April-Hannah-Lena opened 11 months ago

April-Hannah-Lena commented 11 months ago

It makes sense to integrate DifferentialEquations.jl to get access to all of the first class integrators. The primary challenge with this is that DifferentialEquations.jl is designed for a few long trajectories, not many short trajectories. Therefore the chllenge is to find a way to avoid the massive overhead involved in mapping many small trajectories independently.

April-Hannah-Lena commented 11 months ago

The conlusion I'm coming to is that DifferentialEquations.jl is really not made for this. To give a taste of the attemps, here are some benchmarks:

  1.243267 seconds (183.81 M allocations: 5.751 GiB, 36.11% gc time)
  2.422525 seconds (54.45 M allocations: 6.011 GiB, 17.11% gc time)
 44.263472 seconds (47.38 M allocations: 196.606 GiB, 20.79% gc time)

... as you can see it isn't working too well.

The biggest issue is that EnsembleProblem forces you to use an indexable list of initial conditions, meaning all test points need to be collected beforehand and stored in a huge array. The output is an equally huge array of points.

It is also impossible to get around the need to call remake since ODEProblem objects are immutable, and the initial condition is part of the ODEProblem.

gaioguy commented 11 months ago

Ok, the timing for a naive usage of DifferentialEquations.jl is not too bad, in fact. Let us just simply include an example where we show how to interface with DifferentialEquations.jl and show a speed comparison with rk4. Shall we maybe raise an issue with DifferentialEquations.jl?