Having build a significant part of my code on dill serialization/pickling, I\'m also trying to use pathos multiprocessing to parallelize my calculations. Pathos it is a natu
I encountered exactly the same issue. In my case, The inner operation was the one that needed parallelism so I did a ThreadingPool
of a ProcessingPool
. Here it is with your example:
from pathos.multiprocessing import ProcessingPool, ThreadingPool
def triple(x):
return 3*x
def refork(x):
from pathos.multiprocessing import ProcessingPool
return ProcessingPool().map(triple, xrange(5))
ThreadingPool().map(refork, xrange(3))
You can even have another layer with another outer threading pool. Depending on your case, you can invert the order of these pools. However, you cannot have processes of processes. If really needed, see: https://stackoverflow.com/a/8963618/6522112. I haven't try it yet myself so I can't elaborate on this.