[Core][Distributed] add same-node detection (#5369)

This commit is contained in:
youkaichao
2024-06-11 10:53:59 -07:00
committed by GitHub
parent dcbf4286af
commit c4bd03c7c5
4 changed files with 87 additions and 1 deletions

View File

@@ -0,0 +1,11 @@
import os
import torch
from vllm.distributed.parallel_state import is_in_the_same_node
torch.distributed.init_process_group(backend="gloo")
test_result = is_in_the_same_node(torch.distributed.group.WORLD)
expected = os.environ.get("VLLM_TEST_SAME_HOST", "1") == "1"
assert test_result == expected, f"Expected {expected}, got {test_result}"