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:
-
NCCLWeightTransferInitInfo–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.
NCCLWeightTransferInitInfo dataclass ¶
Bases: WeightTransferInitInfo
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¶NCCLWeightTransferInitInfo | dict) –Either an NCCLWeightTransferInitInfo object 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.