Add argument to provide "context" for multiprocessing in evaluators... and controllers? #1675
MichaelClerx
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When using multiprocessing, there are different ways to start processes and it can matter which on you choose.
(For example, it took me most of yesterday to find out that within jupyter notebooks I should choose "spawn", although I still don't know exactly why).
Choosing a starting method can be done by calling e.g.
multiprocessing.set_start_method('fork')
but this can be done only once per program.
We never call this in PINTS, so users can make sure they call it once, and that's that.
But, users building a library that uses PINTS might wish to solve it in a nicer way, by passing in a "context", see also the previous link. Using a context allows you to use different starting methods in a single program (and without the side-effect of changing program-wide settings).
Should we make it possible for users to use PINTS this way?
It would be easy and not too obtrusive to update the methods in
_evaluation.py
to take a context as an optional argument.But I'm a bit less sure it's enough of an issue to warrant adding an optional argument to the constructor of all Controllers?
Thoughts, @pints-team/devs ?
Beta Was this translation helpful? Give feedback.
All reactions