Skip to content

Commit 91665cb

Browse files
authored
add xccl high priority stream test (#2049)
Feature #1715 and register pytorch/pytorch#163049 merged. add some high priority stream test case
1 parent a6c6239 commit 91665cb

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/xpu/distributed/test_c10d_xccl.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,32 @@ def _test_broadcast_coalesced(self, process_group, device, root_rank):
462462
if self.rank != root_rank:
463463
self.assertEqual(tensors, target)
464464

465+
def _test_pass_xccl_options(self, pg_opts):
466+
store = c10d.FileStore(self.file_name, self.world_size)
467+
# Test init_process_group accepts options
468+
dist.init_process_group(
469+
"xccl",
470+
world_size=self.world_size,
471+
rank=self.rank,
472+
store=store,
473+
pg_options=pg_opts,
474+
)
475+
476+
# Test with new_group
477+
pg = c10d.new_group([0, 1], pg_options=pg_opts)
478+
# test the process group works as expected
479+
t = torch.tensor([self.rank + 1] * 10).xpu(self.rank)
480+
pg.allreduce(t).wait()
481+
expected_tensor = torch.tensor([3] * 10).xpu(self.rank)
482+
self.assertEqual(expected_tensor, t)
483+
484+
@requires_xccl()
485+
@skip_if_lt_x_gpu(2)
486+
def test_pass_xccl_options_high_priority_stream(self):
487+
pg_opts = c10d.ProcessGroupXCCL.Options()
488+
pg_opts.is_high_priority_stream = True
489+
self._test_pass_xccl_options(pg_opts)
490+
465491
@requires_xccl()
466492
@skip_if_lt_x_gpu(2)
467493
def test_broadcast_coalesced_xccl(self):

0 commit comments

Comments
 (0)