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

adding BAND/BOR/BXOR reduce ops to unsupported list for complex numbers. added tests #46270

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 2 additions & 1 deletion torch/distributed/distributed_c10d.py
Expand Up @@ -52,7 +52,8 @@
# We'd like calls to unsupported ops to error out accordingly,
# rather than returning garbage values.
def supports_complex(reduceOp: ReduceOp) -> bool:
denyList = [ReduceOp.MAX, ReduceOp.MIN, ReduceOp.PRODUCT]
denyList = [ReduceOp.MAX, ReduceOp.MIN, ReduceOp.PRODUCT,
ReduceOp.BAND, ReduceOp.BOR, ReduceOp.BXOR]
return reduceOp not in denyList


Expand Down
9 changes: 6 additions & 3 deletions torch/testing/_internal/distributed/distributed_test.py
Expand Up @@ -1303,10 +1303,13 @@ def test_all_reduce_sum_complex(self):
)

@unittest.skipIf(BACKEND == "nccl", "Nccl does not support CPU tensors")
def test_all_reduce_max_complex_unsupported(self):
def test_all_reduce_complex_unsupported_ops(self):
unsupported_ops = [dist.ReduceOp.MAX, dist.ReduceOp.MIN, dist.ReduceOp.PRODUCT,
dist.ReduceOp.BAND, dist.ReduceOp.BOR, dist.ReduceOp.BXOR]
group, group_id, rank = self._init_global_test()
with self.assertRaisesRegex(RuntimeError, "all_reduce does not support"):
dist.all_reduce(_build_tensor(1, dtype=torch.cfloat), dist.ReduceOp.MAX, group_id)
for unsupported_op in unsupported_ops:
with self.assertRaisesRegex(RuntimeError, "all_reduce does not support"):
dist.all_reduce(_build_tensor(1, dtype=torch.cfloat), unsupported_op, group_id)

@unittest.skipIf(
BACKEND != "gloo",
Expand Down