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.
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 ¶
stateless_init_process_group(
master_address: str,
master_port: int,
rank: int,
world_size: int,
device,
) -> PyNcclCommunicator
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 ¶
trainer_init(
init_info: NCCLWeightTransferInitInfo | dict,
) -> PyNcclCommunicator
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:
| Name | Type | Description | Default |
|---|---|---|---|
init_info | NCCLWeightTransferInitInfo | dict | Either an NCCLWeightTransferInitInfo object or a dict with keys: - master_address: str - master_port: int - world_size: int | required |
Returns:
| Type | Description |
|---|---|
PyNcclCommunicator | PyNcclCommunicator for weight transfer. |
Source code in vllm/distributed/weight_transfer/nccl_common.py
worker_init_process_group ¶
worker_init_process_group(
init_info: NCCLWeightTransferInitInfo,
parallel_config: ParallelConfig,
) -> PyNcclCommunicator
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.