o
    H&i                     @   s  d dl Z d dlZd dlmZ d dlZd dlZd dlZdefddZe r-ej	
 s-edej	jZej	jZej	jZej	jZe rd dlmZmZmZmZmZmZmZmZmZmZm Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z- dde.fd	d
Z/ej0dkrd dlm1Z1m2Z2 ddl3T ddl3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z: ddl;m;Z;m<Z<m=Z= ddl>m?Z? e,  dS G dd dZ@e@ejAd _dS )    N)Enumreturnc                   C   s   t tjdS )a  
    Return ``True`` if the distributed package is available.

    Otherwise,
    ``torch.distributed`` does not expose any other APIs. Currently,
    ``torch.distributed`` is available on Linux, MacOS and Windows. Set
    ``USE_DISTRIBUTED=1`` to enable it when building PyTorch from source.
    Currently, the default value is ``USE_DISTRIBUTED=1`` for Linux and Windows,
    ``USE_DISTRIBUTED=0`` for MacOS.
    
_c10d_init)hasattrtorch_C r   r   EC:\wamp64\www\opt\env\Lib\site-packages\torch/distributed/__init__.pyis_available	   s   r
   z&Failed to initialize torch.distributed)Store	FileStoreTCPStoreProcessGroupBackendPrefixStoreReducerLoggerBuiltinCommHookType
GradBucketWork_DEFAULT_FIRST_BUCKET_BYTES_register_comm_hook_register_builtin_comm_hook_broadcast_coalesced"_compute_bucket_assignment_by_size_verify_params_across_processes_test_python_store
DebugLevelget_debug_levelset_debug_levelset_debug_level_from_env_make_nccl_premul_sumrankc                 C   s   t  | kr;d}ttjtjrtj}tdt_ztd|  dd W |dur-tj  |t_n|dur:tj  |t_w t	  dS )a  
        Set a breakpoint, but only on a single rank.  All other ranks will wait for you to be
        done with the breakpoint before continuing.  This calls ``breakpoint()`` under the
        hood, so you can customize it using the normal facilities, e.g., ``PYTHONBREAKPOINT``
        environment variable.

        Args:
            rank (int): Which rank to break on.  Default: ``0``
        Nr   zS
!!! ATTENTION !!!

Type 'up' to get to the frame that called dist.breakpoint(rank=z)
)header)
Zget_rank
isinstancesysstdinioTextIOWrapperopen
breakpointcloseZbarrier)r"   Z	old_stdinr   r   r	   r*   ;   s&   





r*   win32)	HashStore_round_robin_process_groups   )*)_all_gather_base_reduce_scatter_base_create_process_group_wrapper_rank_not_in_group_coalescing_manager_CoalescingManager_get_process_group_name)
rendezvous_create_store_from_optionsregister_rendezvous_handler)_remote_devicec                   @   s   e Zd ZdS )_ProcessGroupStubN)__name__
__module____qualname__r   r   r   r	   r<      s    r<   ztorch.distributed)r   )Bosr%   enumr   pdbr'   r   boolr
   r   r   RuntimeErrorZ
_DistErrorZ	DistErrorZ_DistBackendErrorZDistBackendErrorZ_DistNetworkErrorZDistNetworkErrorZ_DistStoreErrorZDistStoreErrorZtorch._C._distributed_c10dr   r   r   r   r   Z_Backendr   r   r   r   r   r   Z_Workr   r   r   r   r   r   r   r   r   r   r    r!   intr*   platformr-   r.   Zdistributed_c10dr1   r2   r3   r4   r5   r6   r7   r8   r9   r:   Zremote_devicer;   r<   modulesr   r   r   r	   <module>   s2    d
$

	