【发布时间】:2022-01-20 11:47:50
【问题描述】:
我有一个需要 7 个参数的 python 函数:
my_fun(a,b,c,d,e,f,g)
我想并行运行它,但保持从 b 到 g 的参数固定并迭代 a。
目前我找到的解决方案是将其作为子函数运行:
def parallel_funct(t1):
a = t1
b = list
c = string
d = list
e= list
f = list
g = string
stationxml_storage = string
my_fun(a,b,c,d,e,f,g)
然后我运行:
ts = np array
if __name__ == '__main__':
p = Pool(6)
p.map(parallel_funct, ts)
有没有办法只使用 my_fun 来做到这一点?
希望很明确
【问题讨论】:
标签: python parallel-processing multiprocessing arguments