Skip to content

vllm.distributed.device_communicators.mnnvl_compat

CustomCommunicator

Bases: CommBackend

Source code in vllm/distributed/device_communicators/mnnvl_compat.py
class CustomCommunicator(CommBackend):
    def __init__(self, group):
        self._group = group

    def Get_rank(self) -> int:
        return self._group.rank()

    def Get_size(self) -> int:
        return self._group.size()

    def allgather(self, data: int):
        gathered = [None] * self.Get_size()
        dist.all_gather_object(gathered, data, group=self._group)
        return gathered

    # NOTE(rob): CommBackend is an abstract class, and bcast/barrier
    # are unimplemented on vLLM side. If we need to utilize these
    # methods in the future, can create a concrete implementation.
    def bcast(self, data: Any, root: int) -> Any:
        raise NotImplementedError

    def barrier(self) -> None:
        raise NotImplementedError

    def Split(self, color: int, key: int) -> "CustomCommunicator":
        return self

_group instance-attribute

_group = group

Get_rank

Get_rank() -> int
Source code in vllm/distributed/device_communicators/mnnvl_compat.py
def Get_rank(self) -> int:
    return self._group.rank()

Get_size

Get_size() -> int
Source code in vllm/distributed/device_communicators/mnnvl_compat.py
def Get_size(self) -> int:
    return self._group.size()

Split

Split(color: int, key: int) -> CustomCommunicator
Source code in vllm/distributed/device_communicators/mnnvl_compat.py
def Split(self, color: int, key: int) -> "CustomCommunicator":
    return self

__init__

__init__(group)
Source code in vllm/distributed/device_communicators/mnnvl_compat.py
def __init__(self, group):
    self._group = group

allgather

allgather(data: int)
Source code in vllm/distributed/device_communicators/mnnvl_compat.py
def allgather(self, data: int):
    gathered = [None] * self.Get_size()
    dist.all_gather_object(gathered, data, group=self._group)
    return gathered

barrier

barrier() -> None
Source code in vllm/distributed/device_communicators/mnnvl_compat.py
def barrier(self) -> None:
    raise NotImplementedError

bcast

bcast(data: Any, root: int) -> Any
Source code in vllm/distributed/device_communicators/mnnvl_compat.py
def bcast(self, data: Any, root: int) -> Any:
    raise NotImplementedError