相关疑难解决方法(0)

IPython.parallel模块中的内存泄漏?

我正在使用IPython.parallel来处理集群上的大量数据.我运行的远程功能如下:

def evalPoint(point, theta):
    # do some complex calculation
    return (cost, grad)
Run Code Online (Sandbox Code Playgroud)

这个函数调用它:

def eval(theta, client, lview, data):
    async_results = []
    for point in data:
        # evaluate current data point
        ar = lview.apply_async(evalPoint, point, theta)
        async_results.append(ar)

    # wait for all results to come back
    client.wait(async_results)

    # and retrieve their values
    values = [ar.get() for ar in async_results]

    # unzip data from original tuple
    totalCost, totalGrad = zip(*values)

    avgGrad =  np.mean(totalGrad, axis=0)
    avgCost = np.mean(totalCost, axis=0)

    return (avgCost, avgGrad)
Run Code Online (Sandbox Code Playgroud)

如果我运行代码:

client …
Run Code Online (Sandbox Code Playgroud)

parallel-processing memory-leaks ipython

4
推荐指数
1
解决办法
1570
查看次数