Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

parallel loops in python

 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))
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #parallel #loops #python
ADD COMMENT
Topic
Name
2+9 =