python multiprocessing.pool应用程序

时间:2016-08-15 12:39:18

标签: python numpy scipy multiprocessing

以下(简化)代码在多处理模块上应用插值函数:

from multiprocessing import Pool
from scipy.interpolate import LinearNDInterpolator
...
if __name__=="__main__":
    p=Pool(4)
    lndi = LinearNDInterpolator(points, valuesA)
    valuesB = list(np.split(valuesA, 4))
    ret = p.map(lndi.__call__, valuesB)

当我运行.py时,python冻结,如果最后一行单独运行,一切正常,我得到了我希望的加速。 谁知道如何修复代码让它自动运行?

提前致谢

编辑:github问题已打开 - > https://github.com/spyder-ide/spyder/issues/3367

0 个答案:

没有答案