o
    ‡ZŽh—  ã                   @   sî   d dl mZ d dlZd dlm  mZ 	 dd„ Zdd„ Zdd„ Z	d	d
„ Z
dd„ Zdejdededee def
dd„Zdeej dededee def
dd„Zdejdeee  deee  dedee defdd„Zdejdejfdd„ZdS )é    )ÚOptionalNc                 C   ó   t  ||¡}tjj | ||¡S ©N)Úc10dÚ$_resolve_group_name_by_ranks_and_tagÚtorchÚopsÚ_c10d_functionalÚ	broadcast)ÚinputÚsrcÚtagÚranksÚ
group_sizeÚ
group_name© r   ú]/var/www/auris/lib/python3.10/site-packages/torch/distributed/_functional_collectives_impl.pyÚ
_broadcast   ó   ýr   c                 C   r   r   )r   r   r   r   r	   Z
all_reduce©r   Ú	reduce_opr   r   r   r   r   r   r   Ú_all_reduce   r   r   c                 C   r   r   )r   r   r   r   r	   Zall_reduce_coalesced©Úinputsr   r   r   r   r   r   r   r   Ú_all_reduce_coalesced    r   r   c                 C   ó   t  ||¡}tjj | ||¡S r   )r   r   r   r   r	   Zall_gather_into_tensor©r   r   r   r   r   r   r   r   Ú_all_gather_into_tensor)   r   r   c                 C   r   r   )r   r   r   r   r	   Z all_gather_into_tensor_coalescedr   r   r   r   Ú!_all_gather_into_tensor_coalesced2   r   r   r   r   r   r   r   c                 C   ó    t  ||¡}tjj | |||¡S r   )r   r   r   r   r	   Zreduce_scatter_tensorr   r   r   r   Ú_reduce_scatter_tensor;   ó   ür    r   c                 C   r   r   )r   r   r   r   r	   Zreduce_scatter_tensor_coalescedr   r   r   r   Ú _reduce_scatter_tensor_coalescedK   r!   r"   Úoutput_split_sizesÚinput_split_sizesc                 C   s`   |d u s|d u r |d u r|d u sJ dƒ‚| j d | g| }|}t ||¡}tjj | |||¡S )Nz^output_split_sizes and input_split_sizes must either be specified together or both set to Noner   )Úshaper   r   r   r   r	   Zall_to_all_single)r   r#   r$   r   r   r   r   r   r   r   Ú_all_to_all_single[   s   ÿür&   ÚtensorÚreturnc                 C   s   t jj | ¡S r   )r   r   r	   Zwait_tensor)r'   r   r   r   Ú_wait_tensort   s   r)   )Útypingr   r   Z"torch.distributed.distributed_c10dÚdistributedZdistributed_c10dr   r   r   r   r   r   ZTensorÚstrÚlistÚintr    r"   r&   r)   r   r   r   r   Ú<module>   sZ   					ÿþýü
ûÿþýü
ûÿ
þ
ýüû
ú