-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Remove silent behavior when num_slurm_tasks
does not correspond to number of processes in Trainer
#14300
Merged
Conversation
This file contains 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
11 tasks
awaelchli
requested review from
tchaton,
carmocca,
Borda,
justusschock,
williamFalcon,
kaushikb11 and
rohitgr7
as code owners
August 27, 2022 23:22
Codecov Report
@@ Coverage Diff @@
## master #14300 +/- ##
=======================================
Coverage 62% 62%
=======================================
Files 396 396
Lines 28879 28879
=======================================
Hits 17774 17774
Misses 11105 11105 |
carmocca
approved these changes
Aug 28, 2022
src/pytorch_lightning/trainer/connectors/accelerator_connector.py
Outdated
Show resolved
Hide resolved
src/pytorch_lightning/plugins/environments/slurm_environment.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Carlos Mocholí <[email protected]>
Borda
approved these changes
Sep 15, 2022
11 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
What does this PR do?
In our AcceleratorConnector, we currently have logic that disables the SLURMEnvironment when the number of processes does not correspond to the number of processes registered with SLURM, i.e., the following logic:
This logic has been there since the beginning of Lightning, but is extremely error-prone. For example, if the user forgets to set the num_nodes flag on the Trainer to the right value, or set it at all, then this can lead to hanging processes because Lightning expects a different number of processes than provided by SLURM.
Why was it there in the first place?
The use case here is that the user wants to let their SLURM manager provision the node, but does not want to let SLURM launch the Python processes. Instead, user wants to launch processes themselves. In this case, the user can just do
Trainer(plugins=LightningEnvironment())
. This way, even when in a Slurm environment, the trainer will not auto-detect slurm and user can do what they want.Also related to #14078
Fixes #13605
Does your PR introduce any breaking changes? If yes, please list them.
Yes, but the previous behavior was undocumented and in most cases lead to a surprise of the user.
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
I made sure I had fun coding 🙃
cc @awaelchli