test_same_node.py 447 B

12345678910111213
  1. import os
  2. import torch.distributed as dist
  3. from aphrodite.distributed.parallel_state import in_the_same_node_as
  4. if __name__ == "__main__":
  5. dist.init_process_group(backend="gloo")
  6. test_result = all(in_the_same_node_as(dist.group.WORLD, source_rank=0))
  7. expected = os.environ.get("APHRODITE_TEST_SAME_HOST", "1") == "1"
  8. assert test_result == expected, f"Expected {expected}, got {test_result}"
  9. print("Same node test passed!")