Fully remove subprocess from the multi-gpu launcher#623
Merged
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
sgugger
reviewed
Aug 10, 2022
Collaborator
sgugger
left a comment
There was a problem hiding this comment.
Very clean, thanks!
I just have one concern in terms of PyTorch versions. The run is pretty recent I think only 1.10 and above (which is why we had the util get_launch_prefix). So I think we should keep the old launcher as is for earlier versions and dispatch to the correct launcher depending on the PyTorch version.
| return cmd | ||
|
|
||
|
|
||
| def _filter_args(args): |
sgugger
approved these changes
Aug 10, 2022
sgugger
reviewed
Aug 10, 2022
src/accelerate/utils/constants.py
Outdated
Comment on lines
+35
to
+38
| # These are the args for `torch.distributed.launch` for pytorch < 1.9 | ||
| TORCH_LAUNCH_PARAMS = """nnodes,nproc_per_node,rdzv_backend,rdzv_endpoint,rdzv_id,rdzv_conf,standalone,max_restarts,monitor_interval,start_method,role,module,m,no_python,run_path,log_dir,r,redirects,t,tee,node_rank,master_addr,master_port""".split( | ||
| "," | ||
| ) |
Collaborator
There was a problem hiding this comment.
Please use a regular list here, it's going to be easier to maintain (in terms of diff)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Completely remove all
subprocessfrommulti_gpu_launcherWhat does this add?
This PR removes the subprocess parts of the
multi_gpulauncher code and replaces it with raw torchrun. This reduces the number of subprocesses had (2 to 1, just torchrun's), and lets us actually get a readable stack trace now that isn't overwhelmed with subprocess bits (so we can play with them now! 🥳 )Who is it for?
Users of Accelerate
Why is it needed?
Old stack traces were very hard to read and parse through, especially to play with since it's a double-nesting of subprocess. Now only one instance of subprocess is used, leaving us with the following new stack trace example:
A follow-up PR will help with the repeating structure of this stack trace via rich
It would also be a good idea to see what the other launchers would take to run them via native python to launch rather than calling subprocess to call the script/entrypoint
What parts of the API does this impact?
User-facing:
Absolutely nothing
Internal structure:
Functionally nothing
TODO: