
    ΑiH                     8    S SK r S SKJrJr  / r SS jrS rS rg)    N)get_clusterloggerc           
         [         R                  " S5      nUc   S5       e[         R                  " S5      nUc   S5       e[         R                  " S5      nUc   S5       e[        [         R                  " S5      5      nUc   S	5       eUR                  S
5      n[	        U5      n[        U5      nU S:w  a2  U S
R                  U5      :w  a  [        R                  " SU  SU S35        [         R                  " S5      n	U	c  Un
US:  aQ   [        [         R                  " SS5      5      nU[	        U5      :  a!  X:w  a  [        R                  " SU S35        Un
U
c  Sn
[        [        X[	        U5      -   5      5      n/ n	U H)  nU	R                  U Vs/ s H	  o SU 3PM     sn5        M+     OUU	R                  S
5      n/ n	X-  [	        U5      :X  d   e[        U5       H   nU	R                  UUU-  US-   U-   5        M"     [        R                  " SU SU SU SU	 35        [        XEXU5      u  nnUUR                  U   4$ ! [         a  n[        U5         SnAGN
SnAff = fs  snf )zY
args_node_ips:string, device_mode:DeviceMode(Int), device_per_proc:list, args_port: int
PADDLE_TRAINERSNz"PADDLE_TRAINERS should not be NonePOD_IPzPOD_IP should not be NonePADDLE_TRAINER_IDz$PADDLE_TRAINER_ID should not be NoneTRAINER_PORTS_NUMz$TRAINER_PORTS_NUM should not be None,z	127.0.0.1zPlease NOTE: When using paddlecloud, cluster_node_ips is automatically got from PADDLE_TRAINERS(multi nodes) or POD_IP(single node).Your input cluster_node_ips: z doesn't equals to IPs: z from paddlecloud environment.DISTRIBUTED_TRAINER_ENDPOINTS   PADDLE_PORT zUse Cloud specified port:.  :zparsed from args: node_ips:z         node_ip:z node_rank:z trainer_endpoints:)osgetenvintsplitlenjoinr   warning	Exceptionprintlistrangeappenddebugr   pods)args_node_ipsdevice_modedevices_per_proc	args_portnode_ipsnode_ip	node_rankpaddle_ports_num	num_nodestrainer_endpointsstarted_portpaddle_porteportsipporttrainer_endpoints_oriiclusterpods                       d/var/www/html/banglarbhumi/venv/lib/python3.13/site-packages/paddle/distributed/fleet/cloud_utils.pyget_cloud_clusterr5      s    yy*+HE!EEii!G; ;;		-.I H"HH 299%89:'O)OO'~~c"HHIII#(9K(K+_,DXJ O	
 		"AB  q=!"))M2">? %,<(==#0NN%>{m1#MN#.L
 LU<<L8M)MNOB$$%GAdVn%GH  !2 7 7 <+s3H/IIIIy!A$$%((AE5E+E " LL
%hZ 0	YK/BCTBU	W
 ,;KLGS GLL+++9  a &Hs   AI
 I-


I*I%%I*c                      [         R                  " S5      n [         R                  " S5      n[         R                  " S5      n[         R                  " S5      nU b	  Ub  Ub  Uc  gg)Nr   r   r   r	   FT)r   r   )r$   r%   r&   r'   s       r4   use_paddlecloudr7   d   s[    yy*+Hii!G		-.Iyy!45?#    c                  B    [        [        R                  " SS5      5      $ )NPADDLE_TRAINERS_NUM1)r   r   r    r8   r4   get_trainers_numr=   t   s    ryy.455r8   )r   )r   %paddle.distributed.fleet.launch_utilsr   r   __all__r5   r7   r=   r<   r8   r4   <module>r@      s)    
 E
 =AK,\ 6r8   