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

[bugfix] Group defaults to WORLD if None #5125

Merged
merged 9 commits into from
Dec 23, 2020

Conversation

8greg8
Copy link
Contributor

@8greg8 8greg8 commented Dec 14, 2020

What does this PR do?

Fixes #5122

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • 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? Otherwise, we ask you to create a separate PR for every change.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?
  • Did you verify new and existing tests pass locally with your changes?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

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; Bugfixes should be including in bug-fix release milestones (m.f.X) and features should be included in (m.X.b) releases.

Did you have fun?

Make sure you had fun coding 🙃

@pep8speaks
Copy link

pep8speaks commented Dec 14, 2020

Hello @8greg8! Thanks for updating this PR.

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-12-23 16:21:46 UTC

@Borda Borda added the bug Something isn't working label Dec 14, 2020
Copy link
Member

@Borda Borda left a comment

Choose a reason for hiding this comment

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

lgtm :]

@codecov
Copy link

codecov bot commented Dec 14, 2020

Codecov Report

Merging #5125 (a433756) into master (9a3c035) will increase coverage by 0%.
The diff coverage is n/a.

@@          Coverage Diff           @@
##           master   #5125   +/-   ##
======================================
  Coverage      93%     93%           
======================================
  Files         134     134           
  Lines        9932    9928    -4     
======================================
+ Hits         9239    9242    +3     
+ Misses        693     686    -7     

@Borda Borda added this to the 1.1.x milestone Dec 14, 2020
Copy link
Contributor

@rohitgr7 rohitgr7 left a comment

Choose a reason for hiding this comment

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

Saw one more bug down a bit.

Copy link
Contributor

@rohitgr7 rohitgr7 left a comment

Choose a reason for hiding this comment

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

oops my bad... there's another PR open for that. Putting the bug back

@rohitgr7 rohitgr7 added the ready PRs ready to be merged label Dec 15, 2020
@awaelchli awaelchli added the distributed Generic distributed-related topic label Dec 16, 2020
@@ -203,6 +203,7 @@ def all_gather_ddp_if_available(
Return:
A tensor of shape (world_size, batch, ...)
"""
group = group if group is not None else torch.distributed.group.WORLD
Copy link
Member

Choose a reason for hiding this comment

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

Should this be moved inside the if statement as torch.distributed.group.WORLD is not defined on windows?

@s-rog
Copy link
Contributor

s-rog commented Dec 17, 2020

def all_gather_ddp_if_available(
    tensor: Union[torch.Tensor], group: Any = torch.distributed.group.WORLD, sync_grads: bool = False
) -> torch.Tensor:

This might be simpler?

@Borda
Copy link
Member

Borda commented Dec 17, 2020

def all_gather_ddp_if_available(
    tensor: Union[torch.Tensor], group: Any = torch.distributed.group.WORLD, sync_grads: bool = False
) -> torch.Tensor:

This might be simpler?

yes, just not sure about it some uses do already uses pass the None...

@s-rog
Copy link
Contributor

s-rog commented Dec 17, 2020

I thought None produces an error as outlined in the linked issue, so this shouldn't break any existing working code?

@SkafteNicki SkafteNicki mentioned this pull request Dec 21, 2020
11 tasks
@Borda Borda enabled auto-merge (squash) December 23, 2020 16:21
@Borda Borda merged commit 1767350 into Lightning-AI:master Dec 23, 2020
Borda pushed a commit that referenced this pull request Jan 6, 2021
* [bugfix] Group defaults to WORLD if None

* fix no_grad

* Update pytorch_lightning/utilities/distributed.py

* Update pytorch_lightning/utilities/distributed.py

Co-authored-by: Gregor Koporec <gregork@unicorn.gorenje.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
(cherry picked from commit 1767350)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working distributed Generic distributed-related topic ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Thre process group doesn't default to all processes (world) but to None
10 participants