ó
    tñ:is'  ã                   ób  • % S r SSKrSSKrSSKrSSKrSSKJr  SSKJrJ	r	  SSK
JrJrJrJrJr  SSKrSSKJr  SSKJrJrJrJrJrJr  \R6                  " S	5      r\\\\\4   4   r\\ S
'   \\\\4      r!\\ S'   \\\!4   r"\\ S'   \ " S S5      5       r#S\!SS4S jr$S&S jr%S\4S jr&S\4S jr'S\(4S jr)S\SS4S jr*S\4S jr+S\S\S\4S jr,S\RZ                  S\4S jr.\	 " S S\5      5       r/S\R`                  S \/S\R`                  4S! jr1S&S" jr2S\\   4S# jr3 " S$ S%5      r4g)'z-XGBoost collective communication related API.é    N)Ú	dataclass)ÚIntEnumÚunique)ÚAnyÚDictÚOptionalÚ	TypeAliasÚUnioné   )Ú_T)Ú_LIBÚ_check_callÚ
build_infoÚc_strÚmake_jcargsÚpy_strz[xgboost.collective]Ú_ConfÚ_ArgValsÚ_Argsc                   ó�   • \ rS rSr% SrSr\\   \S'   Sr	\\   \S'   Sr
\\   \S'   Sr\\   \S'   Sr\\   \S'   S	\S
\4S jrSrg)ÚConfigé   ag  User configuration for the communicator context. This is used for easier
integration with distributed frameworks. Users of the collective module can pass the
parameters directly into tracker and the communicator.

.. versionadded:: 3.0

Attributes
----------
retry : See `dmlc_retry` in :py:meth:`init`.

timeout :
    See `dmlc_timeout` in :py:meth:`init`. This is only used for communicators, not
    the tracker. They are different parameters since the timeout for tracker limits
    only the time for starting and finalizing the communication group, whereas the
    timeout for communicators limits the time used for collective operations, like
    :py:meth:`allreduce`.

tracker_host_ip : See :py:class:`~xgboost.tracker.RabitTracker`.

tracker_port : See :py:class:`~xgboost.tracker.RabitTracker`.

tracker_timeout : See :py:class:`~xgboost.tracker.RabitTracker`.

NÚretryÚtimeoutÚtracker_host_ipÚtracker_portÚtracker_timeoutÚargsÚreturnc                 óv   • U R                   b  U R                   US'   U R                  b  U R                  US'   U$ )z*Update the arguments for the communicator.Ú
dmlc_retryÚdmlc_timeout)r   r   ©Úselfr   s     ÚU/srv/projetos/modelo_ml_acdoc/venv/lib/python3.13/site-packages/xgboost/collective.pyÚget_comm_configÚConfig.get_comm_config:   s7   € à�:‰:Ñ!Ø!%§¡ˆD�ÑØ�<‰<Ñ#Ø#'§<¡<ˆD�Ñ Øˆó    © )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   ÚintÚ__annotations__r   r   Ústrr   r   r   r&   Ú__static_attributes__r)   r(   r%   r   r      sb   ‡ ñð2  €Eˆ8�C‰=ÓØ!€GˆX�c‰]Ó!à%)€O�X˜c‘]Ó)Ø"&€L�(˜3‘-Ó&Ø%)€O�X˜c‘]Ó)ð Eð ¨e÷ r(   r   r   r   c            	      óT   • [        [        R                  " [        S0 U D65      5        g)a  Initialize the collective library with arguments.

Parameters
----------
args :
    Keyword arguments representing the parameters and their values.

    Accepted parameters:
      - dmlc_communicator: The type of the communicator.
        * rabit: Use Rabit. This is the default if the type is unspecified.
        * federated: Use the gRPC interface for Federated Learning.

    Only applicable to the Rabit communicator:
      - dmlc_tracker_uri: Hostname of the tracker.
      - dmlc_tracker_port: Port number of the tracker.
      - dmlc_task_id: ID of the current task, can be used to obtain deterministic
      - dmlc_retry: The number of retry when handling network errors.
      - dmlc_timeout: Timeout in seconds.
      - dmlc_nccl_path: Path to load (dlopen) nccl for GPU-based communication.

    Only applicable to the Federated communicator:
      - federated_server_address: Address of the federated server.
      - federated_world_size: Number of federated workers.
      - federated_rank: Rank of the current worker.
      - federated_server_cert: Server certificate file path. Only needed for the SSL
        mode.
      - federated_client_key: Client key file path. Only needed for the SSL mode.
      - federated_client_cert: Client certificate file path. Only needed for the SSL
        mode.

    Use upper case for environment variables, use lower case for runtime
    configuration.

Nr)   )r   r   ÚXGCommunicatorInitr   ©r   s    r%   Úinitr6   C   s    € ôF ”×'Ò'¬Ñ(;°dÑ(;Ó<Õ=r(   c                  ó@   • [        [        R                  " 5       5        g)zFinalize the communicator.N)r   r   ÚXGCommunicatorFinalizer)   r(   r%   Úfinalizer9   i   s   € ä”×+Ò+Ó-Õ.r(   c                  ó0   • [         R                  " 5       n U $ )zVGet rank of current process.

Returns
-------
rank : int
    Rank of current process.
)r   ÚXGCommunicatorGetRank©Úrets    r%   Úget_rankr>   n   s   € ô ×
$Ò
$Ó
&€CØ€Jr(   c                  ó0   • [         R                  " 5       n U $ )zLGet total number workers.

Returns
-------
n :
    Total number of process.
)r   ÚXGCommunicatorGetWorldSizer<   s    r%   Úget_world_sizerA   z   s   € ô ×
)Ò
)Ó
+€CØ€Jr(   c                  óB   • [         R                  " 5       n [        U 5      $ )z.If the collective communicator is distributed.)r   ÚXGCommunicatorIsDistributedÚbool)Úis_dists    r%   Úis_distributedrF   †   s   € ä×.Ò.Ó0€GÜ�‹=Ðr(   Úmsgc                 ó  • [        U [        5      (       d  [        U 5      n [        R                  " 5       nUS:w  a7  [	        [        R
                  " [        U R                  5       5      5      5        g[        U R                  5       SS9  g)zÖPrint message to the communicator.

This function can be used to communicate the information of
the progress to the communicator.

Parameters
----------
msg : str
    The message to be printed to the communicator.
r   T)ÚflushN)	Ú
isinstancer1   r   rC   r   ÚXGCommunicatorPrintr   ÚstripÚprint)rG   rE   s     r%   Úcommunicator_printrN   Œ   s]   € ô �cœ3×ÑÜ�#‹hˆÜ×.Ò.Ó0€GØ�!ƒ|Ü”D×,Ò,¬U°3·9±9³;Ó-?Ó@ÕAäˆc�i‰i‹k Ó&r(   c                  óÀ   • [         R                  " 5       n [        [        R                  " [         R
                  " U 5      5      5        U R                  n[        U5      $ )zPGet the processor name.

Returns
-------
name :
    The name of processor(host)
)ÚctypesÚc_char_pr   r   ÚXGCommunicatorGetProcessorNameÚbyrefÚvaluer   )Úname_strrT   s     r%   Úget_processor_namerV       s?   € ô �ŠÓ €HÜ”×3Ò3´F·L²LÀÓ4JÓKÔLØ�N‰N€EÜ�%‹=Ðr(   ÚdataÚrootc           	      ól  • [        5       n[        R                  " 5       nX:X  a=  U c   S5       e[        R                  " U [        R
                  S9n[        U5      Ul        [        [        R                  " [        R                  " U5      [        R                  " [        R                  5      U5      5        X:w  a“  [        R                  UR                  -  " 5       n[        [        R                  " [        R                  " U[        R                  5      UR                  U5      5        [        R                   " UR"                  5      n AU $ [        [        R                  " [        R                  " [        R$                  " W5      [        R                  5      UR                  U5      5        AU $ )a'  Broadcast object from one node to all other nodes.

Parameters
----------
data : any type that can be pickled
    Input data, if current rank does not equal root, this can be None
root : int
    Rank of the node to broadcast data from.

Returns
-------
object : int
    the result of broadcast.
z&need to pass in data when broadcasting)Úprotocol)r>   rP   Úc_ulongÚpickleÚdumpsÚHIGHEST_PROTOCOLÚlenrT   r   r   ÚXGCommunicatorBroadcastrS   ÚsizeofÚc_charÚcastÚc_void_pÚloadsÚrawrQ   )rW   rX   ÚrankÚlengthÚsÚdptrs         r%   Ú	broadcastrk   ®   s2  € ô ‹:€DÜ�^Š^Ó€FØƒ|ØÑÐIÐ!IÓIÐÜ�LŠL˜¬×(?Ñ(?Ñ@ˆÜ˜1“vˆŒäÜ×$Ò$Ü�LŠL˜Ó ¤&§-¢-´·±Ó"?Àó	
ôð
 ƒ|Ü—‘ §¡Ò,Ó/ˆäÜ×(Ò(Ü—’˜D¤&§/¡/Ó2°F·L±LÀ$óô	
ô
 �|Š|˜DŸH™HÓ%ˆØð €Kô 	Ü×(Ò(Ü—’œFŸOšO¨AÓ.´·±Ó@À&Ç,Á,ÐPTóô	
ð
 Ø€Kr(   Údtypec                 óŠ  • [         R                  " S5      S[         R                  " S5      S[         R                  " S5      S[         R                  " S5      S[         R                  " S	5      S
[         R                  " S5      S[         R                  " S5      S[         R                  " S5      S[         R                  " S5      S[         R                  " S5      S[         R                  " S5      S0n UR                  [         R                  " S5      S05        X;  a  [        SU  S35      eX   $ ! [         a     N$f = f)NÚfloat16r   Úfloat32r   Úfloat64é   Úint8é   Úint16é   Úint32é   Úint64é   Úuint8é   Úuint16é	   Úuint32é
   Úuint64é   Úfloat128é   z
data type z* is not supported on the current platform.)Únprl   ÚupdateÚ	TypeError)rl   Ú	dtype_maps     r%   Ú
_map_dtyperˆ   Þ   sþ   € ä
�Š�Ó˜QÜ
�Š�Ó˜QÜ
�Š�Ó˜QÜ
�Š�Ó˜!Ü
�Š�Ó˜1Ü
�Š�Ó˜1Ü
�Š�Ó˜1Ü
�Š�Ó˜1Ü
�Š�Ó˜AÜ
�Š�Ó˜BÜ
�Š�Ó˜Bð€IðØ×Ñœ"Ÿ(š( :Ó.°Ð2Ô3ð ÓÜ˜* U GÐ+UÐVÓWÐWàÑÐøô ó Ùðús   Ã6'D5 Ä5
EÅEc                   ó0   • \ rS rSrSrSrSrSrSrSr	Sr
S	rg
)ÚOpé÷   z#Supported operations for allreduce.r   r   rq   rƒ   rs   ru   r)   N)r*   r+   r,   r-   r.   ÚMAXÚMINÚSUMÚBITWISE_ANDÚ
BITWISE_ORÚBITWISE_XORr2   r)   r(   r%   rŠ   rŠ   ÷   s#   † á-à
€CØ
€CØ
€CØ€KØ€JØƒKr(   rŠ   Úopc           
      ót  • [        U [        R                  5      (       d  [        S5      eU R	                  5       R                  5       n[        [        R                  " UR                  R                  [        R                  5      UR                  [        UR                  5      [        U5      5      5        U$ )zïPerform allreduce, return the result.

Parameters
----------
data :
    Input data.
op :
    Reduction operator.

Returns
-------
result :
    The result of allreduce, have same shape as data

Notes
-----
This function is not thread-safe.
z%allreduce only takes in numpy.ndarray)rJ   r„   Úndarrayr†   ÚravelÚcopyr   r   ÚXGCommunicatorAllreducerP   Údata_asrd   Úsizerˆ   rl   r/   )rW   r’   Úbufs      r%   Ú	allreducer›     s‚   € ô& �dœBŸJ™J×'Ñ'ÜÐ?Ó@Ð@Ø
�*‰*‹,×
Ñ
Ó
€CÜÜ×$Ò$Ø�J‰J×ÑœvŸ™Ó/Ø�H‰HÜ�s—y‘yÓ!Ü�‹Gó		
ôð €Jr(   c                  ó@   • [        [        R                  " 5       5        g)zKill the process.N)r   r   ÚXGCommunicatorSignalErrorr)   r(   r%   Úsignal_errorrž   $  s   € ä”×.Ò.Ó0Õ1r(   c                  óÔ  • SSK Jn   U R                  b*  [        R                  R                  U R                  5      nO<[        U S5      (       a)  [        U R                  5      S:”  a  U R                  S   nOS nU(       d  g [        R                  " U5      nU(       d  g S nU H  nUR                  S5      (       d  M  Un  O   Ub!  [        R                  R                  X5      nU$ g )Nr   )ÚlibÚ__path__z
libnccl.so)Únvidia.ncclr    Ú__file__ÚosÚpathÚdirnameÚhasattrr_   r¡   ÚlistdirÚ
startswithÚjoin)r    r¦   ÚfilesÚlibnameÚnamer¥   s         r%   Ú
_find_ncclr®   )  sº   € Ýð ‡|�|ÑÜ!#§¡§¡°·±Ó!>‰Ü	��j×	!Ñ	!¤c¨#¯,©,Ó&7¸!Ó&;Ø—,‘,˜q‘/‰àˆÞØô �JŠJ�wÓ€EÞØà!€GÛˆØ�?‰?˜<×(Ó(ØˆGÙñ ð
 ÑÜ�w‰w�|‰|˜GÓ-ˆØˆØr(   c                   óJ   • \ rS rSrSrS\SS4S jrS\4S jrS\	SS4S jr
S	rg)
ÚCommunicatorContextiK  zNA context controlling collective communicator initialization and finalization.r   r   Nc                 óÈ   • Xl         SnUR                  US 5      b  g [        5       nUS   (       d  g  [        5       nU(       a  X@R                   U'   g g ! [         a     g f = f)NÚdmlc_nccl_pathÚUSE_DLOPEN_NCCL)r   Úgetr   r®   ÚImportError)r$   r   ÚkeyÚbinfor¥   s        r%   Ú__init__ÚCommunicatorContext.__init__N  sd   € ØŒ	ØˆØ�8‰8�C˜ÓÑ*Øä“ˆØÐ&×'Øð	ä“<ˆDÞØ!%—	‘	˜#’ð øäó 	Ùð	ús   ³A Á
A!Á A!c                 ó�   • [        S0 U R                  D6  [        5       (       d   e[        R	                  S5        U R                  $ )Nz8-------------- communicator say hello ------------------r)   )r6   r   rF   ÚLOGGERÚdebug)r$   s    r%   Ú	__enter__ÚCommunicatorContext.__enter__`  s7   € ÜÑˆt�y‰yÒÜ×ÑÐÐÜ�‰ÐOÔPØ�y‰yÐr(   c                 óB   • [        5         [        R                  S5        g )Nz7--------------- communicator say bye ------------------)r9   r»   r¼   r#   s     r%   Ú__exit__ÚCommunicatorContext.__exit__f  s   € ÜŒ
Ü�‰ÐNÕOr(   r5   )r*   r+   r,   r-   r.   r   r¸   r   r½   r   rÀ   r2   r)   r(   r%   r°   r°   K  s:   † ÙXð˜xð ¨Dô ð$˜5ô ðP˜cð P d÷ Pr(   r°   )r   N)5r.   rP   Úloggingr¤   r\   Údataclassesr   Úenumr   r   Útypingr   r   r   r	   r
   Únumpyr„   Ú_typingr   Úcorer   r   r   r   r   r   Ú	getLoggerr»   r1   r/   r   r0   r   r   r   r6   r9   r>   rA   rD   rF   rN   rV   rk   rl   rˆ   rŠ   r”   r›   rž   r®   r°   r)   r(   r%   Ú<module>rÊ      s�  ðÚ 3ã Û Û 	Û Ý !ß  ß 8Õ 8ã å ß K× Kà	×	Ò	Ð1Ó	2€ð ˜˜U 3¨ 8™_Ð,Ñ-€€yÓ -Ø˜u S¨# X™Ñ/€ˆ)Ó /Ø˜˜X˜Ñ&€€yÓ &ð ÷'ð 'ó ð'ðT#>�ð #>˜dô #>ôL/ð
	�#ô 	ð	˜ô 	ð˜ô ð'˜Cð ' Dô 'ð(˜Cô ð,�Bð ,˜cð , bô ,ð`�b—h‘hð  3ô ð2 ôˆó ó ðð�B—J‘Jð  Bð ¨2¯:©:ô ôB2ð
�H˜S‘Mô ÷DPò Pr(   