2024-06-12 01:53:59 +08:00
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
import torch
|
|
|
|
|
|
2024-07-10 09:49:11 +08:00
|
|
|
from vllm.distributed.parallel_state import in_the_same_node_as
|
2024-06-12 01:53:59 +08:00
|
|
|
|
|
|
|
|
torch.distributed.init_process_group(backend="gloo")
|
2024-07-10 09:49:11 +08:00
|
|
|
test_result = all(
|
|
|
|
|
in_the_same_node_as(torch.distributed.group.WORLD, source_rank=0))
|
2024-06-12 01:53:59 +08:00
|
|
|
|
|
|
|
|
expected = os.environ.get("VLLM_TEST_SAME_HOST", "1") == "1"
|
|
|
|
|
assert test_result == expected, f"Expected {expected}, got {test_result}"
|
2024-07-13 12:51:48 +08:00
|
|
|
print("Same node test passed!")
|