Skip to content

Commit

Permalink
[fix] megatron + oss (#127)
Browse files Browse the repository at this point in the history
authored-by: Naman Goyal <namangoyal@learnfair0755.h2.fair>
  • Loading branch information
ngoyal2707 committed Oct 8, 2020
1 parent 6658be2 commit 82dbd5d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fairscale/optim/oss.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,14 +434,14 @@ def _broadcast_params(
# Since all the parameters are already sorted per increasing size, we only need to consider the first ones.
while i_bucketed < len(params) and offset + params[i_bucketed].numel() < buffer_size:
end = offset + params[i_bucketed].numel()
if rank == self_rank:
if global_rank == self_rank:
buffer[offset:end].copy_(params[i_bucketed].data.view(-1)) # type: ignore
offset = end
i_bucketed += 1

if i_bucketed > 0:
future = dist.broadcast(tensor=buffer, src=global_rank, group=group, async_op=True)
if rank != self_rank:
if global_rank != self_rank:
# This request will need to be unrolled
bucket_requests.append((future, rank))

Expand Down

0 comments on commit 82dbd5d

Please sign in to comment.