§
    Pzni�  ã                   ó<  — d dl Z d dlZd dlmZmZmZ d dlZg d¢Zd Z	d„ Z
d„ Zd„ Zd„ Zdeej        eej                 f         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eej        eej                 f                  dededeeej        j                          deeej                          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)ÚOptionalÚSequenceÚUnion)Ú
all_reduceÚreduceÚ	broadcastÚ
all_gatherÚreduce_scatterc                 óB  — t          t          j        d¦  «        st          j        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 supportFT)ÚhasattrÚtorchÚ_CÚwarningsÚwarnÚsetÚ	is_sparseÚis_contiguousÚis_cudaÚ
get_deviceÚadd)ÚtensorsÚdevicesÚtensorÚdevices       úo/var/www/html/cool-property-finder/image-detection-backend/venv/lib/python3.11/site-packages/torch/cuda/nccl.pyÚis_availabler      sÀ   € Ý•5”8Ð/Ñ0Ô0ð ÝŒÐAÑBÔBÐBØˆuå‰eŒe€GØð 
ð 
ˆØÔð 	Ø�5�5Ø×#Ò#Ñ%Ô%ð 	Ø�5�5ØŒ~ð 	Ø�5�5Ø×"Ò"Ñ$Ô$ˆØ�WÐÐØ�5�5Ø�Š�FÑÔÐÐàˆ4ó    c                  ól   — t           j                             ¦   «         } | dz	  }| dz	  dz  }| dz  }|||fS )Né    é   iÿÿ  )r   r   Ú_nccl_version)ÚverÚmajorÚminorÚpatchs       r   Úversionr'   "   sB   € Ý
Œ(×
 Ò
 Ñ
"Ô
"€CØ�2‰I€EØ�B‰Y˜%Ñ€EØ�%‰K€EØ�5˜%Ð Ð r   c                  ó>   — t           j                             ¦   «         S ©N)r   r   Ú_nccl_unique_id© r   r   Ú	unique_idr,   *   s   € ÝŒ8×#Ò#Ñ%Ô%Ð%r   c                 óD   — t           j                             | ||¦  «        S r)   )r   r   Ú_nccl_init_rank)Ú	num_ranksÚuidÚranks      r   Ú	init_rankr2   .   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)r3   s    r   Ú_check_sequence_typer<   2   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)   )r<   r   r   r   ©r3   ÚoutputsÚopÚstreamsÚcommss        r   r   r   9   sL   € Ý˜Ñ Ô Ð Ø€ØˆÝ˜Ñ!Ô!Ð!Ý	„H×Ò˜f g¨r°7¸EÑBÔBÐBÐBÐBr   )r?   ÚoutputÚrootr@   rA   r?   c                ó�  — t          | ¦  «         |�.|�t          d¦  «        ‚t          j        d¦  «         ||         }nbt	          |t
          j        ¦  «        s<t	          |t          j        j	        ¦  «        rt          j        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 instead.z\nccl.reduce with an output tensor list is deprecated. Please specify a single output tensor.)r<   Ú
ValueErrorr   r   r6   r   r:   r7   r8   r   r   Ú_nccl_reduce)r3   rC   rD   r@   rA   rB   r?   Ú_outputs           r   r   r   C   sí   € õ ˜Ñ Ô Ð àÐØÐÝðYñô ð õ ŒMð`ñô ð ð ˜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)   )r<   r   r   Ú_nccl_broadcast)r3   rD   rA   rB   s       r   r   r   j   s4   € õ ˜Ñ Ô Ð Ý	„H×Ò˜V T¨7°EÑ:Ô:Ð:Ð:Ð:r   c                 ó†   — t          | ¦  «         t          |¦  «         t          j                             | |||¦  «         d S r)   )r<   r   r   Ú_nccl_all_gather)r3   r?   rA   rB   s       r   r	   r	   q   sB   € õ ˜Ñ Ô Ð Ý˜Ñ!Ô!Ð!Ý	„H×Ò˜f g¨w¸Ñ>Ô>Ð>Ð>Ð>r   c                 óˆ   — t          | ¦  «         t          |¦  «         t          j                             | ||||¦  «         d S r)   )r<   r   r   Ú_nccl_reduce_scatterr>   s        r   r
   r
   |   sD   € õ ˜Ñ Ô Ð Ý˜Ñ!Ô!Ð!Ý	„H×!Ò! &¨'°2°wÀÑFÔFÐFÐFÐFr   )r   NN)NN)r7   r   Útypingr   r   r   Ú
torch.cudar   Ú__all__ÚSUMr   r'   r,   r2   r:   r<   r   ÚintÚcudaÚStreamr   r   r	   r
   r+   r   r   ú<module>rV      s«  ðØ Ð Ð Ð Ø €€€Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,à Ð Ð Ð ð PÐ
OÐ
O€à€ðð ð ð*!ð !ð !ð&ð &ð &ð:ð :ð :ðD  u¤|°X¸e¼lÔ5KÐ'KÔ!Lð DÐQUð Dð Dð Dð Dð  $¨°TÀð Cð Cð Cð Cð EIØØØ59Ø
ð$Eð 15ð$Eð $Eð $EØ�U”\Ô"ð$Eà�U˜5œ<¨°%´,Ô)?Ð?Ô@ÔAð$Eð ð$Eð 	ð	$Eð
 �h˜uœzÔ0Ô1Ô2ð$Eð �h˜uœ|Ô,Ô-ð$Eð 
ð$Eð $Eð $Eð $EðP HLð;ð ;Ø�U”\Ô"ð;Ø*-ð;à	ð;ð ;ð ;ð ;ð Ø
ð	?ð ?Ø�U”\Ô"ð?à�e”lÔ#ð?ð
 
ð?ð ?ð ?ð ?ð ØØ
ð	Gð 	GØ�U”\Ô"ð	Gà�e”lÔ#ð	Gð 	ð	Gð 
ð	Gð 	Gð 	Gð 	Gð 	Gð 	Gr   