
    Ph
                     z    d dl mZ d dlmZ dededefdZ	 ddededed	ed
edee   fdZ		 ddeded	ed
eddf
dZ
y)    )	timedelta)Listrankprefixsizec                     g }t        |      D ](  }| j                  | |       }|j                  |       * | j                  | | dd       |dk(  r&t        |      D ]  }| j                  | | d        |S )aa  
    Given a store and a prefix, the method goes through the array of keys
    of the following format: ``{prefix}{idx}``, where idx is in a range
    from 0 to size, and tries to retrieve the data.

    The Rank0 process waits at the end to make sure all other processes
    finished the procedure before exiting.

    Usage

    ::

     values = get_all(store, 'torchelastic/data', 3)
     value1 = values[0] # retrieves the data for key torchelastic/data0
     value2 = values[1] # retrieves the data for key torchelastic/data1
     value3 = values[2] # retrieves the data for key torchelastic/data2

    z.FINs   FINr   )rangegetappendset)storer   r   r   data_arridxdata	node_ranks           pC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\torch/distributed/elastic/utils/store.pyget_allr      s    & HT{yyF8C5)*  
IId#V,qy tIII401 % O    r   
world_size
key_prefixbarrier_timeoutreturnc                     | j                  t        |             | j                  | | |       t        | |||      }|S )a  
    Synchronizes ``world_size`` agents between each other using the underlying c10d store.
    The ``data`` will be available on each of the agents.

    Note: The data on the path is not deleted, as a result there can be stale data if
        you use the same key_prefix twice.
    )seconds)set_timeoutr   r   r   )r   r   r   r   r   r   
agent_datas          r   synchronizer   /   sD     
i89	IITF#T*j*=Jr   Nc                 F    | j                         }t        | |||||       y)z
    A global lock between agents.

    Note: Since the data is not removed from the store, the barrier can be used
        once per unique ``key_prefix``.
    N)encoder   )r   r   r   r   r   r   s         r   barrierr    D   s&     VDtT:z?Kr   )i,  )datetimer   typingr   intstrr   bytesfloatr   r     r   r   <module>r(      s      c  P !
  	
   
%[, RU
L
L"%
L36
LIN
L	
Lr   