SciML / OrdinaryDiffEq.jl

High performance ordinary differential equation (ODE) and differential-algebraic equation (DAE) solvers, including neural ordinary differential equations (neural ODEs) and scientific machine learning (SciML)
https://diffeq.sciml.ai/latest/
Other
521 stars 198 forks source link

refactor: use tunable parameters for cache in dae initialization #2186

Closed sathvikbhagavan closed 1 month ago

sathvikbhagavan commented 1 month ago

doing length(p) fails when p is MTKParameters object and gives warnings like:

┌ Warning: The supplied DiffCache was too small and was enlarged. This incurs allocations
│     on the first call to `get_tmp`. If few calls to `get_tmp` occur and optimal performance is essential,
│     consider changing 'N'/chunk size of this DiffCache to 12.
└ @ PreallocationTools ~/.julia/packages/PreallocationTools/zJxgA/src/PreallocationTools.jl:191

It should be fixed by using the length of the tunable portion.

will also fix https://github.com/SciML/ModelingToolkitNeuralNets.jl/issues/4