📜  python代码示例中的并行循环

📅  最后修改于: 2022-03-11 14:45:45.602000             🧑  作者: Mango

代码示例1
pythonCopyfrom joblib import Parallel, delayed
import math

def sqrt_func(i, j):
    time.sleep(1)
    return math.sqrt(i**j)

Parallel(n_jobs=2)(delayed(sqrt_func)(i, j) for i in range(5) for j in range(2))