Torchdiffeq vs DifferentialEquations.jl (/ DiffEqFlux.jl) Benchmarks
Benchmark: Solve the Lorenz equations from 0 to 100 with abstol=reltol=1e-8
Absolute Timings
- DifferentialEquations.jl: 1.675 ms
- diffeqpy (DifferentialEquations.jl called from Python): 3.473 ms
- SciPy+Numba: 50.99 ms
- SciPy: 110.6 ms
- torchdiffeq: 48 seconds
- torchscript torchdiffeq: 48 seconds
Timings Relative to DifferentialEquations.jl
- DifferentialEquations.jl: 1x
- diffeqpy (DifferentialEquations.jl called from Python): 2.07x Slower
- SciPy+Numba: 30x Slower
- SciPy: 66x Slower
- torchdiffeq: 30,000x Slower
- torchscript torchdiffeq: 30,000x Slower
The torchscript versions are kept as separate scripts to allow for the JITing process to occur, and are called before timing to exclude JIT timing, as per the PyTorch documentation suggestions. Python results were scaled by the number of times ran in timeit.