
    ; j.                        S SK Jr  S SKrS SKrS SKJr  S SKJr  S SKJ	r
  S SKJr   " S S\5      r\" S	S	S
9 " S S5      5       r\R                   SS j5       rSS jrg)    )annotationsN)Callable)	dataclass)load_nvidia_dynamic_lib)
IS_WINDOWSc                      \ rS rSrSrSrg)QueryDriverCudaVersionError   zURaised when ``query_driver_cuda_version()`` cannot determine the CUDA driver version. N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       s/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/cuda/pathfinder/_utils/driver_info.pyr	   r	      s    _r   r	   T)frozenslotsc                  8    \ rS rSr% SrS\S'   S\S'   S\S'   Srg)	DriverCudaVersion   ah  
CUDA-facing driver version reported by ``cuDriverGetVersion()``.

The name ``DriverCudaVersion`` is intentionally specific: this dataclass
models the version shown as ``CUDA Version`` in ``nvidia-smi``, not the
graphics driver release shown as ``Driver Version``. More specifically,
it reflects the CUDA user-mode driver (UMD) interface version reported by
``cuDriverGetVersion()``, not the kernel-mode driver (KMD) package
version.

Example ``nvidia-smi`` output::

    +---------------------------------------------------------------------+
    | NVIDIA-SMI 595.58.03  Driver Version: 595.58.03  CUDA Version: 13.2 |
    +---------------------------------------------------------------------+

For the example above, ``DriverCudaVersion(encoded=13020, major=13,
minor=2)`` corresponds to ``CUDA Version: 13.2``. It does not correspond
to ``Driver Version: 595.58.03``.
intencodedmajorminorr   N)r   r   r   r   r   __annotations__r   r   r   r   r   r      s    * LJJr   r   c                 |     [        5       n [        U U S-  U S-  S-  S9$ ! [         a  n[        S5      UeSnAff = f)zFReturn the CUDA driver version parsed into its major/minor components.i  
   )r   r   r   z(Failed to query the CUDA driver version.N)_query_driver_cuda_version_intr   	Exceptionr	   )r   excs     r   query_driver_cuda_versionr#   1   sV    _02 T/T>b(
 	

  _)*TU[^^_s     
;6;c                    [        S5      n [        (       a  [        R                  nO[        R                  nU" U R
                  5      nUR                  n[        R                  " [        R                  5      /Ul	        [        R                  Ul
        [        R                  " 5       nU" [        R                  " U5      5      nUS:w  a  [        SU S35      eUR                  $ )zEReturn the encoded CUDA driver version from ``cuDriverGetVersion()``.cudar   zEFailed to query CUDA driver version via cuDriverGetVersion() (status=z).)_load_nvidia_dynamic_libr   ctypesWinDLLCDLLabs_pathcuDriverGetVersionPOINTERc_intargtypesrestypebyrefRuntimeErrorvalue)loaded_cuda
loader_cls
driver_libcu_driver_get_versionversionstatuss         r   r    r    ?   s    *62Kz 4:==
[[
K001J&99&,nnV\\&B%C"$*LL!llnG"6<<#89F{bcibjjlmnn==r   )returnr   )r9   r   )
__future__r   r'   	functoolscollections.abcr   dataclassesr   5cuda.pathfinder._dynamic_libs.load_nvidia_dynamic_libr   r&   %cuda.pathfinder._utils.platform_awarer   r1   r	   r   cacher#   r    r   r   r   <module>rA      sm    #   $ ! =`, ` $d#  $6 
_ 
_r   