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

Unexpectedly slow simulation with zvode #927

Open
TorkelE opened this issue Mar 2, 2023 · 3 comments
Open

Unexpectedly slow simulation with zvode #927

TorkelE opened this issue Mar 2, 2023 · 3 comments

Comments

@TorkelE
Copy link

TorkelE commented Mar 2, 2023

I have a simple model I want to simulate. I try the various solvers lsoda zvode and vode. For some reason, the lsod solver is waaay faster than the other two. Like, thing are fine because I can simualte quickly, but I wanted to check whenever I was doing something wrong causing the slow down.

Here is the code:

import sys, os, numpy, libsbml, gillespy2
import timeit
import numpy
from gillespy2 import ODESolver, ODECSolver

model_multistate = gillespy2.core.import_SBML('../Data/multistate.xml')[0]

leng = 1000
%time model_multistate.run(solver=ODESolver,t=leng,increment=leng/50.,integrator='vode',integrator_options={"nsteps":1000000})
%time model_multistate.run(solver=ODESolver,t=leng,increment=leng/50.,integrator='zvode',integrator_options={"nsteps":1000000})
%time model_multistate.run(solver=ODESolver,t=leng,increment=leng/50.,integrator='lsoda',integrator_options={"nsteps":100000})
0

Here is a screenshot of the output:
image
(lsoda 100 times faster)

I am attaching the model (renamed as .txt file to make GitHub happy)
multistate.txt

@briandrawert
Copy link
Member

briandrawert commented Mar 3, 2023 via email

@TorkelE
Copy link
Author

TorkelE commented Mar 3, 2023

Away from computer, but can check tomorrow. You mean that for lsoda nstep lack one 0? Generally, having that argument seems to make no difference for lsoda. Even for the otherones it only sets the limit and shouldn't have any effect unless that limit is hit (which it is not)?

@TorkelE
Copy link
Author

TorkelE commented Mar 3, 2023

I can confirm that setting nsteps all equal does not make any change

import sys, os, numpy, libsbml, gillespy2
import timeit
import numpy
from gillespy2 import ODESolver, ODECSolver

model_multistate = gillespy2.core.import_SBML('../Data/multistate.xml')[0]

leng = 1000
%time model_multistate.run(solver=ODESolver,t=leng,increment=leng/50.,integrator='vode', integrator_options={"nsteps":10000})
%time model_multistate.run(solver=ODESolver,t=leng,increment=leng/50.,integrator='zvode',integrator_options={"nsteps":10000})
%time model_multistate.run(solver=ODESolver,t=leng,increment=leng/50.,integrator='lsoda',integrator_options={"nsteps":10000})
0

image

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

No branches or pull requests

2 participants