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

Fix sharding group #39668

Merged
merged 2 commits into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def __init__(self,

self.world_size = self.group.nranks
self.rank = self.group.rank
self._global_root_rank = 0
self._global_root_rank = self.group.ranks[0]

# Synchronous all ranks models
if pertrain_sync_models:
Expand Down Expand Up @@ -403,7 +403,7 @@ def _broadcast_params(self):
for dst_rank, internal_storage in dtype_per_rank.items():
dist.broadcast(
tensor=internal_storage.buffer,
src=dst_rank,
src=self.group.ranks[dst_rank],
group=self.group,
use_calc_stream=True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ def __init__(
self._world_size_scaling = 1.0 / self._group.nranks
assert self._group.nranks > 1, "Training must be distributed, ranks must be greater than 1"
self._rank = self._group.rank
self._global_root_rank = 0 # picking rank 0 as the reference
self._global_root_rank = self._group.ranks[
0] # picking rank 0 as the reference
self._default_device = device

# Global statistical parameters
Expand Down Expand Up @@ -319,7 +320,7 @@ def cleanup():
Taskflow(
task=dist.reduce(
tensor=param.grad,
dst=dst_rank,
dst=self._group.ranks[dst_rank],
group=self._group,
use_calc_stream=True),
callback=cleanup))
Expand Down Expand Up @@ -377,7 +378,8 @@ def cleanup():
Taskflow(
task=dist.reduce(
tensor=grad_storage.buffer,
dst=grad_storage.destination,
dst=self._group.ranks[
grad_storage.destination],
group=self._group,
use_calc_stream=True),
callback=cleanup))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ def __init__(self,
self._world_size_scaling = 1.0 / self._group.nranks
assert self._group.nranks > 1, "Training must be distributed, ranks must be greater than 1."
self._rank = self._group.rank
self._global_root_rank = 0 # picking rank 0 as the reference
self._global_root_rank = self._group.ranks[
0] # picking rank 0 as the reference
self._global_ranks = self._group.ranks

# Parameter segmentation for global ranks
Expand Down