assertionerror解决 python_Python的多进程模块(带有莳萝)给出了无用的AssertionError...

I have installed dill/pathos and its dependencies (with some difficulty) and I'm trying to perform a function over several processes. The class/attribute Model(self.xml,self.exp_data,i).SSR is custom made and depends on loads of other custom functions so I apologize in advance for not being able to provide 'runnable' code. In brief however, it takes some experimental data, integrates a system of ODE's with python's pysces module and calculates the sum of squares (SSR). The purpose for parallelizing this code is to speed up this calculation with multiple parameter sets.

The code:

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

The error message I get is:

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

Then I have tried using 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 object which gives me the same error when I attempts to use the MapResult's `get' method

File "C:\Anaconda1\lib\site-packages\multiprocess\pool.py", line 567, in get

raise self._value

AssertionError

Does anybody know what I'm doing wrong?

解决方案

On Windows you need to use freeze_support from __main__.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值