§
    ŠŠtj¯  ã                   ó  — d dl Z d dlZd dlmZ d dlZg d¢Zd Zd„ Zd„ Z	d„ Z
d„ Zdej        eej                 z  d	dfd
„Zdeddfd„Zdd eddfddœdeej                 dej        eej                 z  dz  dededeej        j                 dz  deej                 dz  d	dfd„Z	 ddeej                 ded	dfd„Z	 	 ddeej                 deej                 d	dfd„Zeddfdeej                 deej                 ded	dfd„ZdS )é    N)ÚSequence)Ú
all_reduceÚreduceÚ	broadcastÚ
all_gatherÚreduce_scatterc                 óF  — t          t          j        d¦  «        st          j        dd¬¦  «         dS t          ¦   «         }| D ]]}|j        r dS |                     ¦   «         s dS |j        s dS | 	                    ¦   «         }||v r dS | 
                    |¦  «         Œ^dS )NÚ_nccl_all_reducez)PyTorch is not compiled with NCCL supporté   ©Ú
stacklevelFT)ÚhasattrÚtorchÚ_CÚwarningsÚwarnÚsetÚ	is_sparseÚis_contiguousÚis_cudaÚ
get_deviceÚadd)ÚtensorsÚdevicesÚtensorÚdevices       úM/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/torch/cuda/nccl.pyÚis_availabler      sÅ   € Ý•5”8Ð/Ñ0Ô0ð ÝŒÐAÈaÐPÑPÔPÐPØˆuå‰eŒe€GØð 
ð 
ˆØÔð 	Ø�5�5Ø×#Ò#Ñ%Ô%ð 	Ø�5�5ØŒ~ð 	Ø�5�5Ø×"Ò"Ñ$Ô$ˆØ�WÐÐØ�5�5Ø�Š�FÑÔÐÐàˆ4ó    c                  óæ   — t           j                             ¦   «         } | dz	  }| dz	  dz  }| dz  }t           j                             ¦   «                              d¦  «        }|dk    r|||fS ||||fS )a  
    Returns the version of the NCCL.


    This function returns a tuple containing the major, minor, and patch version numbers of the NCCL.
    The suffix is also included in the tuple if a version suffix exists.
    Returns:
        tuple: The version information of the NCCL.
    é    é   iÿÿ  zutf-8Ú )r   r   Ú_nccl_versionÚ_nccl_version_suffixÚdecode)ÚverÚmajorÚminorÚpatchÚsuffixs        r   Úversionr,   #   s}   € õ Œ(×
 Ò
 Ñ
"Ô
"€CØ�2‰I€EØ�B‰Y˜%Ñ€EØ�%‰K€EÝŒX×*Ò*Ñ,Ô,×3Ò3°GÑ<Ô<€FØ�‚|€|Ø�u˜eÐ$Ð$à�u˜e VÐ,Ð,r   c                  ó>   — t           j                             ¦   «         S ©N)r   r   Ú_nccl_unique_id© r   r   Ú	unique_idr1   8   s   € ÝŒ8×#Ò#Ñ%Ô%Ð%r   c                 óD   — t           j                             | ||¦  «        S r.   )r   r   Ú_nccl_init_rank)Ú	num_ranksÚuidÚranks      r   Ú	init_rankr7   <   s   € ÝŒ8×#Ò# I¨s°DÑ9Ô9Ð9r   ÚinputsÚreturnc                 ó–   — t          | t          j        j        ¦  «        rt          | t          j        ¦  «        rt          d¦  «        ‚d S )Nz(Inputs should be a collection of tensors)Ú
isinstanceÚcollectionsÚabcÚ	Containerr   ÚTensorÚ	TypeError)r8   s    r   Ú_check_sequence_typerA   @   sP   € Ý�f�kœoÔ7Ñ8Ô8ð D½JØ•”ñ=ô =ð Dõ ÐBÑCÔCÐCðDð Dr   c                 ó�   — t          | ¦  «         |€| }t          |¦  «         t          j                             | ||||¦  «         d S r.   )rA   r   r   r
   ©r8   ÚoutputsÚopÚstreamsÚcommss        r   r   r   G   sL   € Ý˜Ñ Ô Ð Ø€ØˆÝ˜Ñ!Ô!Ð!Ý	„H×Ò˜f g¨r°7¸EÑBÔBÐBÐBÐBr   )rD   ÚoutputÚrootrE   rF   rD   c                ó°  — t          | ¦  «         |�6|�t          d¦  «        ‚t          j        dt          d¬¦  «         ||         }njt          |t          j        ¦  «        sDt          |t          j	        j
        ¦  «        r%t          j        dt          d¬¦  «         ||         }n|€| |         n|}t          j                             | |||||¦  «         d S )Nzä'output' and 'outputs' can not be both specified. 'outputs' is deprecated in favor of 'output', taking in a single output tensor. The signature of reduce is: reduce(inputs, output=None, root=0, op=SUM, streams=None, comms=None).z}`nccl.reduce` with an output tensor list is deprecated. Please specify a single output tensor with argument 'output' instead.r   r   z\nccl.reduce with an output tensor list is deprecated. Please specify a single output tensor.)rA   Ú
ValueErrorr   r   ÚFutureWarningr;   r   r?   r<   r=   r   r   Ú_nccl_reduce)r8   rH   rI   rE   rF   rG   rD   Ú_outputs           r   r   r   Q   s  € õ ˜Ñ Ô Ð àÐØÐÝðYñô ð õ ŒMðXåØð	ñ ô ð ð ˜d”mˆGˆGÝ˜¥¤Ñ-Ô-ð =µ*Ø•”Ô(ñ3ô 3ð =õ 	Œð5åØð		
ñ 	
ô 	
ð 	
ð ˜”,ˆˆà"( .�&˜”,�,°fˆÝ	„H×Ò˜& '¨4°°W¸eÑDÔDÐDÐDÐDr   c                 óh   — t          | ¦  «         t          j                             | |||¦  «         d S r.   )rA   r   r   Ú_nccl_broadcast)r8   rI   rF   rG   s       r   r   r   |   s4   € õ ˜Ñ Ô Ð Ý	„H×Ò˜V T¨7°EÑ:Ô:Ð:Ð:Ð:r   c                 ó†   — t          | ¦  «         t          |¦  «         t          j                             | |||¦  «         d S r.   )rA   r   r   Ú_nccl_all_gather)r8   rD   rF   rG   s       r   r   r   ƒ   sB   € õ ˜Ñ Ô Ð Ý˜Ñ!Ô!Ð!Ý	„H×Ò˜f g¨w¸Ñ>Ô>Ð>Ð>Ð>r   c                 óˆ   — t          | ¦  «         t          |¦  «         t          j                             | ||||¦  «         d S r.   )rA   r   r   Ú_nccl_reduce_scatterrC   s        r   r   r   Ž   sD   € õ ˜Ñ Ô Ð Ý˜Ñ!Ô!Ð!Ý	„H×!Ò! &¨'°2°wÀÑFÔFÐFÐFÐFr   )r   NN)NN)r<   r   Úcollections.abcr   Ú
torch.cudar   Ú__all__ÚSUMr   r,   r1   r7   r?   rA   r   ÚintÚcudaÚStreamr   r   r   r   r0   r   r   ú<module>r\      s“  ðà Ð Ð Ð Ø €€€Ø $Ð $Ð $Ð $Ð $Ð $à Ð Ð Ð ð PÐ
OÐ
O€à€ðð ð ð*-ð -ð -ð*&ð &ð &ð:ð :ð :ðD ¤°¸¼Ô0FÑ!Fð DÈ4ð Dð Dð Dð Dð  $¨°TÀð Cð Cð Cð Cð <@ØØØ26Ø
ð(Eð .2ð(Eð (Eð (EØ�U”\Ô"ð(EàŒL˜8 E¤LÔ1Ñ1°DÑ8ð(Eð ð(Eð 	ð	(Eð
 �e”jÔ'Ô(¨4Ñ/ð(Eð �e”lÔ# dÑ*ð(Eð 
ð(Eð (Eð (Eð (EðX HLð;ð ;Ø�U”\Ô"ð;Ø*-ð;à	ð;ð ;ð ;ð ;ð Ø
ð	?ð ?Ø�U”\Ô"ð?à�e”lÔ#ð?ð
 
ð?ð ?ð ?ð ?ð ØØ
ð	Gð 	GØ�U”\Ô"ð	Gà�e”lÔ#ð	Gð 	ð	Gð 
ð	Gð 	Gð 	Gð 	Gð 	Gð 	Gr   