
    zj                        U d dl mZ d dlmZmZ d dlmZ d dlmZ erd dl	m
Z
 d dlmZ ee
eef         Zded<   d	gZ	 dddZd
S )    )annotations)TYPE_CHECKINGUnion)	TypeAlias)core)CustomPlace)_customDevicePropertiesr   _CustomPlaceLikeget_device_propertiesNdevice_CustomPlaceLike | Nonereturnr	   c                   | t          | t                    r0| }t          j                    }|st	          d          |d         }nt          | t          j                  r)|                                 }|                                 }nt          | t                    rn| 	                    d          }|dk    r| }d}n| d|         }| |dz   d         }|
                                st	          d| d          t          |          }nAt	          d	|  d
          t          j                    }|st	          d          |d         }d}t          j        ||          S )a  
    Return the properties of given custom device.

    Args:
        device (CustomPlace|str|int|None, optional): The device, the id of the device or
            the string name of device like 'metax_gpu:x' which to get the properties of the
            device from. Notice that this api only supports gpgpu backend. If device is None, the device is the current device.
            Default: None.

    Returns:
        _customDeviceProperties: The properties of the device which include device name,
            major compute capability, minor compute capability, global memory available
            and the number of multiprocessors on the device.

    Examples:
        .. code-block:: python

            >>> import paddle
            >>> paddle.device.get_device_properties('metax_gpu:0')
            >>> paddle.device.get_device_properties(0)
            >>> paddle.device.get_device_properties(paddle.CustomPlace('metax_gpu', 0))
    Nz No custom device types availabler   :   zInvalid device ID 'z:'. After colon must be digits only. Example: 'metax_gpu:0'zThe device type z is not expected. Because paddle.device.get_device_properties only support int, str or CustomPlace. Please input appropriate device again!)
isinstanceintr   get_all_custom_device_type
ValueErrorr   get_device_typeget_device_idstrrfindisdigitr   )r   	device_id	dev_typesdevice_name	colon_idxdevice_id_strs         k/lsinfo/ai/hellotax_ai/data_center/backend/venv/lib/python3.11/site-packages/paddle/device/gpgpu_backend.pyr   r   %   s   2 fc""  	I799I E !CDDD#A,KK 011 	 0022K,,..II$$ 	S))IB$		$ZiZ0 &y1} 7$,,.. $1m 1 1 1    ..		96 9 9 9   355	 	A?@@@l	%k9===    )N)r   r   r   r	   )
__future__r   typingr   r   typing_extensionsr   paddle.baser   paddler   paddle.base.libpaddler	   r   r   r
   __annotations____all__r    r"   r!   <module>r,      s    # " " " " " " ' ' ' ' ' ' ' ' ' ' ' ' ' '       """"""======"'	#      '+C> C> C> C> C> C> C>r"   