
    Vpf                     X    d dl Z d dlZd dlZdZg dZddgZddgZd Zd	efd
Z	d	efdZ
dS )    N0x1ae0)0x00270x005e0x00630x00560x0062r   r   z/dev/nvidia0z/dev/dxgc                     d} d}t          j         d          D ]}t          j        |                                                                          }|t
          k    rFt          j                            t          j        	                    |          d          }t          j        |                                                                          }|t          v r| dz  } | |fS )zCReturns the device id and number of TPU chips attached through PCI.r    z/sys/bus/pci/devices/*/vendordevice   )globpathlibPath	read_textstrip_GOOGLE_PCI_VENDOR_IDospathjoindirname_TPU_PCI_DEVICE_IDS)	num_chips	device_idvendor_path	vendor_iddevice_paths        W/var/www/html/nettyfy-visnx/env/lib/python3.11/site-packages/jax/_src/hardware_utils.py%num_available_tpu_chips_and_device_idr   ,   s    ))Y>??  k[))3355;;==I)))',,rw{;;XFFK[))3355;;==I'''1ni	I	    returnc                  6    t                      \  } }|t          v S )zFReturns if tpu_enhanced_barrier flag is supported on this TPU version.)r   _TPU_ENHANCED_BARRIER_SUPPORTED)_r   s     r   tpu_enhanced_barrier_supportedr$   =   s    688,!Y	5	55r   c                  >    t          d t          D                       S )zJTrue if there's a visible nvidia gpu available on device, False otherwise.c              3   T   K   | ]#}t           j                            |          V  $d S )N)r   r   exists).0ds     r   	<genexpr>z)has_visible_nvidia_gpu.<locals>.<genexpr>F   s0      <<1RW^^A<<<<<<r   )any_NVIDIA_GPU_DEVICES r   r   has_visible_nvidia_gpur.   C   s"     
<<(;<<<	<	<<r   )r   r   r   r   r   r"   r,   r   boolr$   r.   r-   r   r   <module>r0      s    
			    
 
 
  	#   
  "6 6 6 6 6= = = = = = =r   