rtqichen / torchdiffeq

Differentiable ODE solvers with full GPU support and O(1)-memory backpropagation.
MIT License
5.36k stars 907 forks source link

Can torchdiffeq provide support for stiff ordinary differential equations? #214

Open Shirley-Ying opened 1 year ago

Shirley-Ying commented 1 year ago

I am currently working on some tasks on the derivation of chemical reaction equations and I have found that torchdiffeq does not seem to provide support for some solvers such as ode23tb and ode23s in matlab for stiff ordinary differential equations. My program seems to perform poorly with fixed step solvers. Is there a good alternative?

ryushinn commented 10 months ago

Hi @Shirley-YFY , I also have the same issue with stiff equations. Do you have any idea now? Any input will be highly appreciated.

Currently torchdiffeq seems to provide an interface for Scipy Solvers #132 (such as BDF and LSODA solvers that are more suitable for stiff systems). But in my case, the dynamics dimension is too large to adopt these solvers which try to allocate memory for Jacobian. Specifically my x is a 196k-dimension vector so it raises an error Unable to allocate 288. GiB for an array with shape (196608, 196608) and data type float64.