Python 的多进程模块(带有莳萝)给出了一个无用的 AssertionError
Pythons multiprocess module (with dill) gives an unhelpful AssertionError
我已经安装了 dill/pathos 及其依赖项(有一些困难),我正在尝试在多个进程上执行一个功能。 class/attribute Model(self.xml,self.exp_data,i).SSR
是定制的,取决于其他自定义函数的负载,所以我提前为无法提供 'runnable' 代码道歉。但简而言之,它需要一些实验数据,将 ODE 系统与 python 的 pysces 模块集成在一起并计算平方和 (SSR
)。并行化此代码的目的是加快使用多个参数集的计算。
代码:
import multiprocess
def evaluate_chisq(pop):
p = multiprocess.Pool(8)
res= p.map(lambda i:Model(self.xml,self.exp_data,i).SSR , pop)#calcualteSSR with this parameter set
return res
我收到的错误信息是:
File "C:\Anaconda1\lib\site-packages\multiprocess\pool.py", line 251, in map
return self.map_async(func, iterable, chunksize).get()
File "C:\Anaconda1\lib\site-packages\multiprocess\pool.py", line 567, in get
raise self._value
AssertionError
然后我尝试使用 map_async
:
def evaluate_chisq(pop):
p = multiprocess.Pool(8)
res= p.map_async(lambda i:Model(self.xml,self.exp_data,i).SSR , pop)#calcualteSSR with this parameter set
return res
which returns a <multiprocess.pool.MapResult object at 0x0000000014AF8C18>
object 当我尝试使用 MapResult
's `get' method
时给我同样的错误
File "C:\Anaconda1\lib\site-packages\multiprocess\pool.py", line 567, in get
raise self._value
AssertionError
有人知道我做错了什么吗?
在 Windows 上,您需要使用 __main__
中的 freeze_support
。
参见https://docs.python.org/2/library/multiprocessing.html#multiprocessing.freeze_support。
我已经安装了 dill/pathos 及其依赖项(有一些困难),我正在尝试在多个进程上执行一个功能。 class/attribute Model(self.xml,self.exp_data,i).SSR
是定制的,取决于其他自定义函数的负载,所以我提前为无法提供 'runnable' 代码道歉。但简而言之,它需要一些实验数据,将 ODE 系统与 python 的 pysces 模块集成在一起并计算平方和 (SSR
)。并行化此代码的目的是加快使用多个参数集的计算。
代码:
import multiprocess
def evaluate_chisq(pop):
p = multiprocess.Pool(8)
res= p.map(lambda i:Model(self.xml,self.exp_data,i).SSR , pop)#calcualteSSR with this parameter set
return res
我收到的错误信息是:
File "C:\Anaconda1\lib\site-packages\multiprocess\pool.py", line 251, in map
return self.map_async(func, iterable, chunksize).get()
File "C:\Anaconda1\lib\site-packages\multiprocess\pool.py", line 567, in get
raise self._value
AssertionError
然后我尝试使用 map_async
:
def evaluate_chisq(pop):
p = multiprocess.Pool(8)
res= p.map_async(lambda i:Model(self.xml,self.exp_data,i).SSR , pop)#calcualteSSR with this parameter set
return res
which returns a <multiprocess.pool.MapResult object at 0x0000000014AF8C18>
object 当我尝试使用 MapResult
's `get' method
File "C:\Anaconda1\lib\site-packages\multiprocess\pool.py", line 567, in get
raise self._value
AssertionError
有人知道我做错了什么吗?
在 Windows 上,您需要使用 __main__
中的 freeze_support
。
参见https://docs.python.org/2/library/multiprocessing.html#multiprocessing.freeze_support。