Skip to content
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

Fix multiprocessing bug in Windows/Mac OS X #13

Merged
merged 2 commits into from
Apr 28, 2022

Conversation

alistairewj
Copy link
Contributor

The multiprocessing pool started uses the default method for launching child processes, which is OS specific. The default on Unix is "fork", and the resulting process inherits all resources from the parent process. Conversely, the default on Mac OS X/Windows is "spawn", which results in a minimal number of resources inherited by the child process.

I changed the code to explicitly use "fork", and I was able to run through the README on a Mac M1. I presume this fix would also help Windows users, though I haven't tested myself.

While I was at it, I fixed a small typo in the README.

Thanks for sharing the code and having a really nice README!

…ency

The method for launching a process can be "spawn", "fork", and "forkserver".
The default on Unix is fork, and the resulting process inherits all resources
from the parent process. Conversely, the default on Mac OS X/Windows is spawn,
which results in a minimal number of resources inherited by the child process.

https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods
@carlini
Copy link
Collaborator

carlini commented Apr 28, 2022

Looks great. Thanks.

@carlini carlini merged commit faf2df7 into google-research:master Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants