-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Note multiprocessing start method compatibility #529
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## master #529 +/- ##
=======================================
Coverage 85.22% 85.22%
=======================================
Files 39 39
Lines 2342 2342
=======================================
Hits 1996 1996
Misses 346 346 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
@davidavdav could you also take a look? |
I think you could give this a (sub)heading |
@MilesCranmer have you run into this as well? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a few suggestions to incorporate some of @davidavdav's thoughts. I also made some copyediting suggestions to simplify the sentence structure.
|
||
multiprocessing.set_start_method('spawn') | ||
|
||
once in your code prior to using the multiprocessing library. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
once in your code prior to using the multiprocessing library. | |
once in your code prior to using the multiprocessing library. | |
Also, consider using the *spawn* or *forkserver* methods with ``multiprocessing.get_context``: | |
.. code:: python | |
context = multiprocessing.get_context('fork_server') | |
queue = context.Queue() | |
process = context.Process(target=foo, args=(queue,)) |
@davidavdav does that sound right?
is selected: *fork* (default on Unix) segfaults with with `unknown | ||
function` errors, while *spawn* (default on Windows and MacOS) generally, | ||
but not always, runs without memory allocation issues. To select *spawn*, | ||
include the line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is selected: *fork* (default on Unix) segfaults with with `unknown | |
function` errors, while *spawn* (default on Windows and MacOS) generally, | |
but not always, runs without memory allocation issues. To select *spawn*, | |
include the line | |
is selected. *fork* (default on Unix) segfaults with with `unknown | |
function` errors. *spawn* (default on Windows and MacOS) generally, | |
but not always, runs without memory allocation issues. To select *spawn*, | |
include the line |
Just using .
here simplifies sentence structure. When does using spawn run with memory allocation issues? Could you elaborate on that point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish I could, but I haven't done extensive enough testing to say why it happens. I've just noted that it does occasionally happen in my use case. @davidavdav is this something you've also experienced?
Co-authored-by: Mark Kittisopikul <[email protected]>
I have not tried to use Python multiprocessing with Julia. In PySR, all the multiprocessing is done on the Julia side, with the Python acting as a serial wrapper library. (I dynamically initialize processes with |
The point about spawn/fork is revealing. Here's the difference from stackoverflow:
|
Document findings from #362. @mkitti