pyswarm icon indicating copy to clipboard operation
pyswarm copied to clipboard

Add optional import of `pathos` for more robust multiprocessing support

Open parenthetical-e opened this issue 6 years ago • 0 comments

The multiprocessingbuilt-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.

parenthetical-e avatar Mar 12 '18 19:03 parenthetical-e