Skip to content

Conversation

@awaelchli
Copy link
Contributor

@awaelchli awaelchli commented Jul 6, 2021

What does this PR do?

Unblocks #8017 who is calling trainer.log_dir early in Callback.setup(), which internally leads to a broacast, but hangs because device is not yet set!

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

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:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

Did you have fun?

I made sure I had fun coding 🙃

@codecov
Copy link

codecov bot commented Jul 6, 2021

Codecov Report

Merging #8312 (3f9a9e2) into master (f796cb4) will decrease coverage by 0%.
The diff coverage is 80%.

@@          Coverage Diff           @@
##           master   #8312   +/-   ##
======================================
- Coverage      92%     92%   -0%     
======================================
  Files         213     213           
  Lines       13798   13793    -5     
======================================
- Hits        12744   12726   -18     
- Misses       1054    1067   +13     

@awaelchli awaelchli force-pushed the bugfix/set-device branch from d2564f6 to 519d01c Compare July 6, 2021 23:02
@awaelchli awaelchli added feature Is an improvement or enhancement distributed Generic distributed-related topic labels Jul 7, 2021
@awaelchli awaelchli added this to the v1.4 milestone Jul 7, 2021
@awaelchli awaelchli marked this pull request as ready for review July 7, 2021 08:38
Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !

@awaelchli awaelchli enabled auto-merge (squash) July 7, 2021 10:52
@awaelchli awaelchli added the ready PRs ready to be merged label Jul 7, 2021
@carmocca
Copy link
Contributor

carmocca commented Jul 7, 2021

Do we also want to move?:

pytorch_lightning//plugins/training_type/horovod.py:136:            torch.cuda.set_device(self.root_device)
pytorch_lightning//plugins/training_type/ddp_spawn.py:333:            torch.cuda.set_device(self.root_device)

@awaelchli awaelchli merged commit d73c32a into master Jul 7, 2021
@awaelchli awaelchli deleted the bugfix/set-device branch July 7, 2021 11:15
@awaelchli
Copy link
Contributor Author

@carmocca the one in ddp_spawn cannot be moved, it needs to set the device in the spawned subprocesses too.
for horovod I'm not confident enough to change it right now, as we have very little testing around that plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

distributed Generic distributed-related topic feature Is an improvement or enhancement ready PRs ready to be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants