This is the basic Python example from https://docs.python.org/2/library/multiprocessing.html#module-multiprocessing.pool on parallel processing
from multiprocessing import Pool
def f(x):
return x*x
if __name__ == '__main__':
p = Pool(5)
print(p.map(f, [1, 2, 3]))
which I can't run for some reason on my PC. When I try to execute the third block the program freezes. My OS is Windows 10. I run the program on the Spyder IDE and I have an anaconda installation. What is possibly the problem?
This is a problem Windows users have and it is not relevant to the anaconda environment. I found the solution. Firstly you have to create another .py file in order to save the f(x) function. Then you import the function you have created and the program runs smoothly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With