@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / f48b6a03ba
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 14, 05:30 UTC

[Misc]allow disable pynccl (#25421)

Signed-off-by: Lu Fang <fanglu@fb.com> Co-authored-by: Lucia (Lu) Fang <fanglu@meta.com>

Lucia Fang committed Sep 30, 2025 at 23:04 UTC f48b6a03ba3880e1771ef2494b352ebae87697fb
3 files changed +12 -1
vllm/distributed/device_communicators/cuda_communicator.py
+4
@@ -147,6 +147,10 @@ class CudaCommunicator(DeviceCommunicatorBase):
147 assert out is not None
148 return out
149 pynccl_comm = self.pynccl_comm
150 + if pynccl_comm is None or pynccl_comm.disabled:
151 + out = input_.clone()
152 + torch.distributed.all_reduce(out, group=self.device_group)
153 + return out
154 assert pynccl_comm is not None
155 out = pynccl_comm.all_reduce(input_)
156 if out is None:
vllm/distributed/device_communicators/pynccl.py
+2 -1
@@ -8,6 +8,7 @@ import torch
8 import torch.distributed as dist
9 from torch.distributed import ProcessGroup, ReduceOp
10
11 +import vllm.envs as envs
12 from vllm.distributed.device_communicators.pynccl_wrapper import (
13 NCCLLibrary, buffer_type, cudaStream_t, ncclComm_t, ncclDataTypeEnum,
14 ncclRedOpTypeEnum, ncclUniqueId)
@@ -83,7 +84,7 @@ class PyNcclCommunicator:
84 self.group = group
85
86 # if world_size == 1, no need to create communicator
86 - if self.world_size == 1:
87 + if self.world_size == 1 or envs.VLLM_DISABLE_PYNCCL:
88 self.available = False
89 self.disabled = True
90 return
vllm/envs.py
+6
@@ -98,6 +98,7 @@ if TYPE_CHECKING:
98 VLLM_SKIP_P2P_CHECK: bool = False
99 VLLM_DISABLED_KERNELS: list[str] = []
100 VLLM_DISABLE_NCCL_FOR_DP_SYNCHRONIZATION: bool = False
101 + VLLM_DISABLE_PYNCCL: bool = False
102 VLLM_USE_V1: bool = True
103 VLLM_ROCM_USE_AITER: bool = False
104 VLLM_ROCM_USE_AITER_PAGED_ATTN: bool = False
@@ -897,6 +898,11 @@ environment_variables: dict[str, Callable[[], Any]] = {
898 (os.getenv("VLLM_DISABLE_NCCL_FOR_DP_SYNCHRONIZATION", "False").lower() in
899 ("true", "1")),
900
901 + # Disable pynccl (using torch.distributed instead)
902 + "VLLM_DISABLE_PYNCCL":
903 + lambda:
904 + (os.getenv("VLLM_DISABLE_PYNCCL", "False").lower() in ("true", "1")),
905 +
906 # If set, use the V1 code path.
907 "VLLM_USE_V1":
908 lambda: bool(int(os.getenv("VLLM_USE_V1", "1"))),