2

I'm using SciPys integrate.ode module to integrate a large system (~8000 equations) of ODEs. Because I always have to do several of those with different parameters I parallelized it using the multiprocessing module, which seems to be working fine. However, the documentation of SciPy says:

Warning:

This integrator is not re-entrant. You cannot have two ode instances using the “vode” integrator at the same time.

So now my question is if I can trust my results from the parallel runs? Or does this Waring also apply to instances in different processes?

obachtos
  • 977
  • 1
  • 12
  • 30
  • 2
    *at the same time* most likely applies to the same Python session. If you started the script twice in two seperate sessions there should not be any interaction between them. This is also what happens in multiprocessing; each process runs it's own interpreter. So I think you are safe, but some more research won't hurt. – MB-F May 08 '17 at 10:50
  • 1
    Using `multiprocessing` is fine. See, for example, http://stackoverflow.com/questions/34291639/multiple-scipy-integrate-ode-instances/34301676#34301676 – Warren Weckesser May 08 '17 at 21:35

1 Answers1

1

If you try to use the integrator twice in the same session you get an error:

from scipy.integrate import ode

f = lambda x: x

a = ode(f)
b = ode(f)

a.set_integrator('vode')
b.set_integrator('vode')

a.integrate(0.1)
b.integrate(0.1)
a.integrate(0.1)

# IntegratorConcurrencyError: Integrator `vode` can be used to 
# solve only a single problem at a time. If you want to integrate 
# multiple problems, consider using a different integrator 
# (see `ode.set_integrator`)

If you do not get this error in a multiprocessing environment it seems reasonable to assume your results are valid.

MB-F
  • 22,770
  • 4
  • 61
  • 116