I am trying to use parallel computation package joblib in python. I can execute the following example and get the result
Parallel(n_jobs=8)(delayed(sqrt)(i) for i in range(10))
However, the following code does not work out.
from joblib import Parallel, delayed
def f(x):
return 1
def y(x):
result=Parallel(n_jobs=8)(delayed(x)(i) for i in range(10))
return result
if __name__ == '__main__':
print y(f)
when I run the above code, it keeps running forever without generating any result or message.
Can anyone figure out the reason for this strange behavior(I am using windows)? thanks
if __name__ == '__main__'
block – gtlambert Jan 17 '16 at 16:262.7.9
– gtlambert Jan 17 '16 at 16:38f
– 3c. Jan 17 '16 at 16:44