o
    TÃiˆ  ã                   @   s   d Z G dd„ deƒZdS )a0  
DeepSpeed Communication Backend.

In the future, directly use NCCL/MPI/Gloo/etc without requiring torch.distributed. Simply wrap torch.distributed for now.

# Custom DS Backends -- Direct C/Ops
 - NCCL -- [EXPERIMENTAL]
 - MPI -- [EXPERIMENTAL]
 - RCCL -- [EXPERIMENTAL]
 - GLOO -- [EXPERIMENTAL]
# DS backend wrapper for torch.distributed [DEFAULT]
 - T-NCCL -- [DEFAULT]
 - T-GLOO
 - T-MPI

# Backend is the base class
     -- NcclBackend, MpiBackend, and TorchBackend are the main subclasses. TorchBackend is the only officially supported backend for now.
c                   @   s.   e Zd Zddd„Zdd„ Zdd	„ Zd
d„ ZdS )ÚBackendÚbackendé    é   c                 C   s(   || _ d | _|| _|| _g | _d| _d S )NF)ÚnameÚworld_groupÚ
world_sizeÚ
world_rankÚprocess_groupsÚinitialized)Úselfr   ÚrankÚsize© r   úJ/home/ubuntu/.local/lib/python3.10/site-packages/deepspeed/comm/backend.pyÚ__init__   s   
zBackend.__init__c                 C   s   | j S ©N©r
   ©r   r   r   r   Úis_initialized%   s   zBackend.is_initializedc                 C   s   d S r   r   r   r   r   r   Ú	new_group(   s   zBackend.new_groupc                 C   s
   d| _ d S )NTr   r   r   r   r   Úinit_process_group,   s   
zBackend.init_process_groupN)r   r   r   )Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   r   r      s
    

r   N)Ú__doc__Úobjectr   r   r   r   r   Ú<module>   s   