
    sie                        S r SSKJr  SSKrSSK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  SSKJr  SS	KJr  SS
KJr  \(       a  SSKJr  S r\R,                  S 5       r\SS j5       rS rg)zDetect CUDA version.    )annotationsN)suppress)TYPE_CHECKING   )NULL   )hookimpl)CondaVirtualPackage)Iterablec                 r   [         R                  " S5      n U R                  5       n U R                  [        U4SSS9nUR                  5         UR                  SS9  UR                  5         UR                  5       (       a  [        $ UR                  5       nUb  U$ [        $ ! WR                  5         f = f)a  
Attempt to detect the version of CUDA present in the operating system.

On Windows and Linux, the CUDA library is installed by the NVIDIA
driver package, and is typically found in the standard library path,
rather than with the CUDA SDK (which is optional for running CUDA apps).

On macOS, the CUDA library is only installed with the CUDA SDK, and
might not be in the library path.

Returns: version string (e.g., '9.2') or None if CUDA is not found.
spawnzCUDA driver version detectorT)targetargsnamedaemong      N@)timeout)multiprocessingget_contextSimpleQueueProcess$_cuda_driver_version_detector_targetstartjoinkillemptyr   get)contextqueuedetectorresults       Clib/python3.13/site-packages/conda/plugins/virtual_packages/cuda.pycuda_versionr"      s    " ))'2G!E??7/	 # 
 	d# 	{{}}YY[F'61T1 	s   6B$ $B6c                     [        5       $ )z.A cached version of the cuda detection system.)r"        r!   cached_cuda_versionr&   @   s     >r%   c               #  0   #    [        S[        S SS9v   g 7f)Ncudaversion)r   r)   buildoverride_entity)r
   r&   r$   r%   r!   conda_virtual_packagesr,   F   s       #!	 s   c                R   [         R                  " 5       nUS:X  a  / SQnOUS:X  a4  / SQn[        [        R                  R                  S U 5       5      5      nOIUS:X  a1  [         R                  " 5       S   R                  SS	5      nS
U S3S/nOU R                  S5        gUS:X  a  [        R                  nO[        R                  nU H-  n[        [        5         UR                  U5      n SSS5          O   U R                  S5        g[        R                   R#                  SS5         UR$                  n[        R&                  " S5      nU" U5      n	U	S:w  a  U R                  S5        gUR(                  n
[        R*                  " S5      nU
" [        R,                  " U5      5      n	U	S:w  a  U R                  S5        gUR.                  nU R                  US-   SUS-  S-   35        g! , (       d  f       GM8  = f! [         a    U R                  S5         gf = f)a  
Attempt to detect the version of CUDA present in the operating system in a
subprocess.

On Windows and Linux, the CUDA library is installed by the NVIDIA
driver package, and is typically found in the standard library path,
rather than with the CUDA SDK (which is optional for running CUDA apps).

On macOS, the CUDA library is only installed with the CUDA SDK, and
might not be in the library path.

Returns: version string (e.g., '9.2') or None if CUDA is not found.
         The result is put in the queue rather than a return value.
Darwin)zlibcuda.1.dylibzlibcuda.dylibz#/usr/local/cuda/lib/libcuda.1.dylibz!/usr/local/cuda/lib/libcuda.dylibLinux)z
libcuda.soz/usr/lib64/nvidia/libcuda.soz$/usr/lib/x86_64-linux-gnu/libcuda.soz/usr/lib/wsl/lib/libcuda.soc              3  .   #    U  H  o S 3U4v   M     g7f)z.1Nr$   ).0libs     r!   	<genexpr>7_cuda_driver_version_detector_target.<locals>.<genexpr>s   s     )U}U":s*;}s   Windowsr   bit nvcudaz.dllz
nvcuda.dllNCUDA_VISIBLE_DEVICESi  .
   )platformsystemlist	itertoolschainfrom_iterablearchitecturereplaceputctypeswindllcdllr   	ExceptionLoadLibraryosenvironpopcuInitc_uintcuDriverGetVersionc_intbyrefvalue)r   r=   lib_filenamesbitsdlllib_filenamelibcudarM   flagsretrO   version_intrR   s                r!   r   r   R   s     __F
 
7	
 OO)))U})UU
 
9	$$&q)11%<!$t,l;		$ mmkk%i ool3G !  &
 			$
 JJNN)40a Um!8IIdO$77ll1o k!:;!8IIdO !!		Ud]O1edlr%9$:;<? ! @  		$s,   G51AH 3AH 	+H 5
H	H&%H&)returnzIterable[CondaVirtualPackage])__doc__
__future__r   rE   	functoolsr?   r   rJ   r<   
contextlibr   typingr   auxlibr   r7   r	   typesr
   collections.abcr   r"   cacher&   r,   r   r$   r%   r!   <module>re      sl     "     	       '(%2P  
 
 
Rr%   