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

torch: sync values_handle firstly in sparse_allreduce_async #2965

Merged
merged 1 commit into from Jun 10, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion horovod/torch/mpi_ops.py
Expand Up @@ -518,8 +518,11 @@ def sparse_allreduce_async(tensor, name, op):
values_handle = allgather_async(t._values(), name=f'{name}.values')

def handle():
indices = synchronize(indices_handle)
# We need to sync values handle firstly for torch nightly >= 10.0
# Issue: https://github.com/horovod/horovod/issues/2961
values = synchronize(values_handle)
indices = synchronize(indices_handle)

values = (values / size()) if op == Average else values

if indices.dim() == 0 or values.dim() == 0:
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test_torch.py
Expand Up @@ -2421,8 +2421,6 @@ def forward(self, x):
loss.backward()
opt.step()

@pytest.mark.skipif(LooseVersion(torch.__version__) > LooseVersion('1.10.0'),
reason='https://github.com/horovod/horovod/issues/2961')
def test_async_sparse_allreduce(self):
"""Test that allgather over indices and values is equivalent to allreduce."""
hvd.init()
Expand Down