vllm.distributed.device_communicators.pynccl
¶
Classes:
Functions:
-
defer_comm_warmup_on_rocm–Build communicators on this thread without their warm-up on ROCm, where
PyNcclCommunicator
¶
Methods:
-
__init__–Args:
-
all_to_all_single–All-to-all along dim 0, like
torch.distributed.all_to_all_single: -
bind_stream–Give the collectives issued on
streamtheir own communicator, so -
from_unique_id_bytes–Build a communicator from pre-shared
ncclUniqueIdbytes. -
resume–Restore a suspended comm (collective); no-op unless suspended.
-
suspend–Release comm GPU memory (collective, idempotent); keeps topology.
__init__(group, device, library_path=None)
¶
Parameters:
-
(group¶ProcessGroup | StatelessProcessGroup) –the process group to work on. If None, it will use the default process group.
-
(device¶int | str | device) –the device to bind the PyNcclCommunicator to. If None, it will be bound to f"cuda:{local_rank}".
-
(library_path¶str | None, default:None) –the path to the NCCL library. If None, it will use the default library path.
It is the caller's responsibility to make sure each communicator is bind to a unique device.
_init_comm(device)
¶
Create the communicator on device from the already-resolved
self.unique_id / self.rank / self.world_size, then run the
one-element warm-up all_reduce. Shared by __init__ and
from_unique_id_bytes so the init handshake stays identical on both.
all_to_all_single(output_tensor, input_tensor, output_split_sizes, input_split_sizes, stream=None)
¶
All-to-all along dim 0, like torch.distributed.all_to_all_single:
the next input_split_sizes[i] rows of input_tensor go to rank i, and
the next output_split_sizes[i] rows of output_tensor come from it.
CUDA graph capturable for split sizes fixed at capture.
bind_stream(stream)
¶
Give the collectives issued on stream their own communicator, so
they never share one with collectives on a concurrent stream. Collective.
from_unique_id_bytes(unique_id_bytes, rank, world_size, device, library_path=None)
classmethod
¶
Build a communicator from pre-shared ncclUniqueId bytes.
For peers that cannot join a StatelessProcessGroup / TCPStore (e.g. a
torch-free JAX trainer): every rank passes the same id, minted once via
ncclGetUniqueId and shared out of band. There is no barrier, so all
ranks must enter init concurrently or ncclCommInitRank hangs.
Warm-up handshake: immediately after ncclCommInitRank this issues a
one-element all_reduce (mirroring __init__). It is a collective,
so every peer -- including a foreign, non-vLLM rank -- must issue a
matching one-element all_reduce before any other collective, or all
ranks deadlock.
resume()
¶
Restore a suspended comm (collective); no-op unless suspended.
suspend()
¶
Release comm GPU memory (collective, idempotent); keeps topology.
defer_comm_warmup_on_rocm()
¶
Build communicators on this thread without their warm-up on ROCm, where the warm-up can deadlock if built next to a live engine whose existing communicators still have collectives in flight; instead the warm-up is deferred to when the engine is quiet (during commit).