Question about how and if parallelism is implemented

11 views
Skip to first unread message

Giovanni Pugliese Carratelli

unread,
Oct 28, 2020, 1:58:56 PM10/28/20
to tellurium-discuss
Hello,
          I've started using Tellurium recently for some caulcuations I had to do for a paper.

The kind a recation I have to with are as follows:



I immediately appreciated the speed of simulation.

The code I use, when R(A) = Rc a, is the following:

import tellurium as te
import numpy as np

r = te.loada(' -> A; k1; k1 = 1; A = 0; A ->; Gamma_A*A; Gamma_A=0.1; -> B; Rc*A; Rc = 1; B = 0; B ->; Gamma_B*B; Gamma_B=1;')
r.integrator = 'gillespie'
r.integrator.setValue('variable_step_size', True)
#r.integrator.seed = 1234

results = []
for k in range(1, 10):
    r.reset()
    s = r.simulate(0, 1000)
    results.append(s)

I have a question however regarding how and if parallesim is implemented for the gillespie integrator:

Is each trajectory on each core? If otherwise - as I suspect since I saw the load of only 1 of my cores go to 100% - is there any way to make use of all N cores?

Morever, my reasoning maybe flawed somehow for reasons unknown to me, if so how?

Thank you all in advance.

Kind regards,

gpc

Herbert M Sauro

unread,
Oct 29, 2020, 1:44:06 PM10/29/20
to Giovanni Pugliese Carratelli, tellurium-discuss
Unfortunately, as far as I know, there isn't any parallelism implemented in the stochastic simulator, that would be nice to have. What you could try instead is run multiple instances of roadrunner, in theory, it should exploit your cpu cores. If that doesn't work this is something we could look into to see if we could force roadrunner to use multiple cores. 

Herbert Sauro



--
You received this message because you are subscribed to the Google Groups "tellurium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tellurium-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tellurium-discuss/3a15155b-e09b-43f7-b6c1-3a783590dc98n%40googlegroups.com.


--
Herbert Sauro, Professor
University of Washington, Bioengineering

Giovanni Pugliese Carratelli

unread,
Oct 29, 2020, 1:54:07 PM10/29/20
to tellurium-discuss
Hello Herber,
                       thank you for this. I'll give it a try via Dask.

I personally started thinking about this when having to generate probaility mass functions from Gillespie runs. Especially when the functions are non linear and there are several molecules this could be slow and maybe worth paralleising. A similar argument would be to try to run each trajectory on a GPU as now days they have serveral cores.
I'll keep you posted if I find anything useful and working.

Best,

gpc

Lucian Smith

unread,
Oct 29, 2020, 3:22:59 PM10/29/20
to Giovanni Pugliese Carratelli, tellurium-discuss
Just a note--if you do go this route, you might find the 'saveState' and 'loadState' functions helpful:  you could use them to set up your initial RoadRunner object on one server, call saveState, then create your other RoadRunner objects on the various cores and set them up with a 'loadState' call.

Giovanni Pugliese Carratelli

unread,
Oct 30, 2020, 12:34:15 PM10/30/20
to tellurium-discuss
Thanks, I'll take a look soon.

I had another small question regarding simulations via gillespie. I noticed, or it is not obvious to me, how to have gillespie runs that save only the final state of the simulation. As this is one of the methods used to compute numerical Probability Mass Functions (namely several gillespie trajectories and consider only the end time) and  this increases the simulation time per trajectory, are you planning by any chance to implement it?
The few times I implemented Gillepie via matlab I noticed a quite a severe increase in simulation time if saving each data/time point with respect to saving only the last/current data point.

Thanks in advance once again,

gpc

Lucian Smith

unread,
Oct 30, 2020, 1:14:09 PM10/30/20
to Giovanni Pugliese Carratelli, tellurium-discuss
The easiest way to accomplish this is to tell it to only collect two points (i.e. the start point and the end point):

result = r.gillespie(0, 20, 2)

In this scenario, simulation will progress to a 'time' of 20, and result[0] will contain the initial state and result[1] will contain the end state.

-Lucian

Reply all
Reply to author
Forward
0 new messages