问题描述
我已经构建了一个多处理器来加速进程(300.000 参数),但是如果它显示类似的进度条以便我可以跟踪进度会很好。我在 stackoverflow 上搜索了合适的解决方案,但找不到类似的问题。是否可以在 starmap_async 上使用进度方法?如果没有,有什么好的选择?
import multiprocessing as mp
def origins(G,x,y):
return ox.get_nearest_node(G,(y,x))
x = [buildings.geometry[i].centroid.y for i in list(range(len(buildings)))]
y = [buildings.geometry[i].centroid.y for i in list(range(len(buildings)))]
params = ((G,orig,dest) for orig,dest in zip(y,x))
# create a pool of worker processes
pool = mp.Pool(4)
# map the function/parameters to the worker processes
sma = pool.starmap_async(origins,params)
# get the results,close the pool,wait for worker processes to all exit
routes = sma.get()
pool.close()
pool.join()
有人可以帮我吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)