2

我正在使用 SciPysintegrate.ode模块来集成 ODE 的大型系统(约 8000 个方程)。因为我总是要做几个具有不同参数的操作,所以我使用multiprocessing模块将其并行化,这似乎工作正常。但是,SciPy的文档说:

警告:

该积分器不可重入。您不能同时使用“vode”积分器有两个 ode 实例。

所以现在我的问题是我是否可以相信并行运行的结果?或者这个 Waring 是否也适用于不同进程中的实例?

4

1 回答 1

1

如果您尝试在同一会话中两次使用积分器,则会收到错误消息:

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`)

如果您在多处理环境中没有收到此错误,那么假设您的结果是有效的似乎是合理的。

于 2017-05-08T10:59:36.607 回答