vllm.distributed.weight_transfer.nccl_common ¶
Shared NCCL initialization helpers for weight transfer engines.
The dense (NCCLWeightTransferEngine) and sparse (SparseNCCLWeightTransferEngine) backends are independent engines that share only their process-group initialization. That common logic lives here so the sparse engine does not have to subclass the dense one.
Classes:
-
NCCLRendezvous–The three fields
trainer_initneeds to open the trainer endpoint. -
NCCLWeightTransferInitInfo–Worker-side initialization info for NCCL-based weight transfer backends.
Functions:
-
stateless_init_process_group–vLLM provides
StatelessProcessGroupto create a process group -
trainer_init–Initialize NCCL process group for trainer-side weight transfer.
-
worker_init_process_group–Create the trainer<->worker NCCL group on an inference worker.
NCCLRendezvous ¶
Bases: Protocol
The three fields trainer_init needs to open the trainer endpoint.
Structural so each backend can keep its own trainer init info next to its engine (dense NCCLTrainerInitInfo, SparseNCCLTrainerInitInfo) without this shared module importing either.
Source code in vllm/distributed/weight_transfer/nccl_common.py
NCCLWeightTransferInitInfo dataclass ¶
Bases: WeightTransferInitInfo
Worker-side initialization info for NCCL-based weight transfer backends.
Source code in vllm/distributed/weight_transfer/nccl_common.py
stateless_init_process_group(master_address, master_port, rank, world_size, device) ¶
vLLM provides StatelessProcessGroup to create a process group without considering the global process group in torch.distributed. It is recommended to create StatelessProcessGroup, and then initialize the data-plane communication (NCCL) between external (train processes) and vLLM workers.
Source code in vllm/distributed/weight_transfer/nccl_common.py
trainer_init(init_info) ¶
Initialize NCCL process group for trainer-side weight transfer.
The trainer is always rank 0 in the process group. Uses the current CUDA device (torch.accelerator.current_device_index()).
Parameters:
-
(init_info¶NCCLRendezvous | dict) –Any object carrying the
NCCLRendezvousfields (a trainer or worker NCCL init info), or a dict with keys: - master_address: str - master_port: int - world_size: int
Returns:
-
PyNcclCommunicator–PyNcclCommunicator for weight transfer.
Source code in vllm/distributed/weight_transfer/nccl_common.py
worker_init_process_group(init_info, parallel_config) ¶
Create the trainer<->worker NCCL group on an inference worker.
Computes a unique rank for this worker across all data-parallel groups and joins the stateless process group with the trainer.