-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[distributed] multiprocessing.spawn python version check #14039
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
Conversation
The version check already happens in |
The else branch of this one: pytorch/torch/multiprocessing/__init__.py Lines 37 to 40 in b8de8f6
|
@pietern Not a big fan of creating another dummy class for this purpose. Changed to check the version at runtime and we always import these classes. |
from .spawn import spawn, SpawnContext | ||
"""Add helper function to spawn N processes and wait for completion of any of | ||
them. This depends `mp.get_context` which was added in Python 3.4.""" | ||
from .spawn import spawn, SpawnContext |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
||
class SpawnContext: | ||
def __init__(self, processes, error_queues): | ||
_python_version_check() |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
if sys.version_info < (3, 4): | ||
raise RuntimeError("Requires python 3.4 or higher to use " | ||
"torch.multiprocessing.spawn and " | ||
"torch.multiprocessing.SpawnContext helper " |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
I didn't imply another class, just: def spawn(*args, **kwargs):
raise RuntimeError("Python >= 3.4 required bla bla bla") |
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.
@teng-li is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Here's the conundrum: nobody should be using the SpawnContext directly, but its Two possible solutions:
The latter is a bit better because we don't have to worry about the docs and the class is usable by itself. Filed #14047. No need to block this. |
This will be super helpful to the user