I am currently trying to parallize a rather large task of computing a complex system of differential equations. I want to parallize the computation, so each computation has its own process. I need the results to be ordered, therefore I am using a dictionary to order it after the process. I am also on Windows 10.
For now I am only running the identity function to check the code, but even then it simply runs all logical cores at 100% but does not compute (I waited 5 minutes). Later on I will need to initalize each process with a bunch of variables to compute the actual system defined in a solver() function further up the code. What is going wrong?
import multiprocessing as mp
import numpy as np
Nmin = 0
Nmax = 20
periods = np.linspace(Nmin, Nmax, 2*Nmax +1) # 0.5 steps
results = dict()
def identity(a):
return a
with mp.Manager() as manager:
sharedresults = manager.dict()
with mp.Pool() as pool:
print("pools are active")
for result in pool.map(identity, periods):
#sharedresults[per] = res
print(result)
orderedResult = []
for k,v in sorted(results.items()):
oderedResult.append(v)
The program gets to the "pools are active" message and after printing it, it just does nothing I guess?
I am also using Jupyterlab, not sure wether that is an issue.