pyswarm
pyswarm copied to clipboard
Add optional import of `pathos` for more robust multiprocessing support
The multiprocessing
built-in uses pickle, which fails for functions defined outside the top-level of a module.
Although not perhaps the best idea, it can be convenient to define a loss function inside another function, leading to a closure of shared/'global' parameters from one to the other. pickle
fails here.
In this request, I've added an optional import of the pathos
multiprocessing lib, which uses dill
-
a more flexible serialization option.