I was working with python 3.6 on Linux, and I was using python's multiprocessing library, It was working until I switch to Windows 10. First, I thought it's because the multiprocessing library doesn't work the same way on Linux and Windows, so I make sure that all my variables are picklable but no results.
Then, I wanted to see if multiprocessing pool is working, I tried this code : (the basic example in multiprocessing doc)
from multiprocessing import Pool
def f(x):
return x*x
if __name__ == '__main__':
p = Pool(5)
print(p.map(f, [1, 2, 3]))
It didn't work and when I check the processors in the task manager, only 1% is used.
I also tried the p.map_async
, it worked but when I try to get the results (p.map_async().get()
) it doesn't work (RuntimeError)