Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions vllm/distributed/device_communicators/symm_mem.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,25 @@ def __init__(
self.max_size = SYMM_MEM_ALL_REDUCE_MAX_SIZES[self.device_capability][
self.world_size
]
from vllm.distributed.parallel_state import in_the_same_node_as

if not all(in_the_same_node_as(self.group, source_rank=0)):
# Cross-node group (multi-node NVLink): the default CUDA backend
# exchanges CUDA IPC handles, which are same-node only. Select
# the NVSHMEM backend before the process's first symm-mem
# allocation so rendezvous maps fabric-reachable peer VAs.
try:
torch_symm_mem.set_backend("NVSHMEM")
logger.info_once(
"SymmMemCommunicator: multi-node group, using the "
"NVSHMEM symmetric-memory backend"
)
except RuntimeError as e:
logger.warning_once(
"SymmMemCommunicator: could not select the NVSHMEM "
"backend for a multi-node group: %s",
str(e),
)
try:
self.buffer = torch_symm_mem.empty(
self.max_size // self.dtype.itemsize,
Expand Down
Loading