
    
9j6                       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rS SK	r	\	R                  R                  R                  R                  r\(       d  S SK
Jr  S rS rS r " S S5      r " S	 S
5      rSS.S jrS rS rg)    )annotationsN)
pathfinderc                N     U " 5       $ ! U a  n[        U5      s S nA$ S nAff = fN)repr)funcerrorses      H/home/wildlama/miniconda3/lib/python3.13/site-packages/cupyx/_runtime.py_eval_or_errorr      s'    v Aws   	 $
$$c                     [         R                  " U 5      nUR                  $ ! [         R                  [        4 a     g f = fr   )r   load_nvidia_dynamic_libabs_pathDynamicLibNotFoundErrorRuntimeError)lib_name	loaded_dls     r   _load_and_get_pathr      sD    "66x@	 !!! ..= s   $ A Ac                    [        U 5      [        U5      :  d   e/ n[        [        U 5      5       H:  nUR                  X   5        U[        U5      :  d  M'  UR                  X   5        M<     U$ r   )lenrangeappend)ver_seqpath_seqresultis       r   _version_and_pathr   '   s_    w<3x=(((F3w< gj!s8}MM(+& ! M    c                  &    \ rS rSrS rS rS rSrg)_InstallInfo1   c                4   U R                  5       nUbt  [        R                  R                  US5      n[	        [        R                  R                  US5      5      [	        [        R                  R                  US5      5      S.nOS S S.nXl        X0l        g )Nz.datalibinclude)r#   r$   )_get_cupy_package_rootospathjoin_dir_or_nonecupy_package_root
data_paths)selfr*   	data_rootr+   s       r   __init___InstallInfo.__init__5   s}     779(%6@I#BGGLLE$BC'Y	(JKJ J
 "3$r   c                r    XR                   ;  a  [        SR                  U5      5      eU R                   U   $ )NzInvalid data type: {})r+   
ValueErrorformat)r,   	data_types     r   get_data_path_InstallInfo.get_data_pathF   s2    OO+4;;IFGGy))r   c                     [         R                  " [        5      n[        R
                  R                  U5      $ ! [         a     g f = fr   )inspectgetfilecupy	TypeErrorr&   r'   dirname)r,   	cupy_paths     r   r%   #_InstallInfo._get_cupy_package_rootK   s>    	-I wwy))  		s   ; 
AA)r*   r+   N)__name__
__module____qualname____firstlineno__r.   r4   r%   __static_attributes__ r   r   r    r    1   s    %"*
*r   r    c                      \ rS rSrSrSrSrSrSrSr	Sr
SrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSr Sr!Sr"Sr#Sr$Sr%Sr&Sr'SS.S jr(S r)Sr*g)_RuntimeInfoS   NTfullc                 ^ Xl         [        R                  U l        [        (       d$  [        R
                  R                  5       U l        O#[        R                  R                  5       U l        [        (       d$  [        R                  R                  5       U l        O#[        R                  R                  5       U l        [        [        R
                  R                  R                  5       5      U l        [        R
                  R                  R#                  5       (       a4   SS KnUR&                  R                  nU =R                   SU S3-  sl        [+        [        R
                  R,                  R.                  [        R
                  R,                  R0                  5      U l        [+        [        R
                  R,                  R4                  [        R
                  R,                  R0                  5      U l        [+        [        R
                  R8                  [:        5      U l        U(       a  [        (       d  [?        S5      U l         SU l!        U(       a1  [+        S [:        5      U l!        [        (       d  [?        S5      U l"         SSK#J$m  [+        U4S	 j[:        5      U l%        U(       a  [        (       d  [?        S
5      U l&        [+        S [:        5      U l'        U(       a  [        (       d  [?        S5      U l(        [+        S [:        5      U l)        U(       a  [        (       d  [?        S5      U l*        SU l+        U(       a1  [+        S [:        5      U l+        [        (       d  [?        S5      U l,        [+        S [:        5      U l-        U(       a  [        (       d  [?        S5      U l.         SS K/Js  J0n  UR                  5       U l1        [        (       de   [        R
                  Rd                  Rg                  5       nUc  SU l4        O1 [j        Rl                  " S5      n[        U(       a  U/O/ 5      U l4        [        R                  Ro                  S5      (       aZ  U(       a;  [        R                  Rq                  S5        [        (       d  [?        S5      U l9        OSU l:        U Rt                  U l;         SSK<J=n  UR                  5       U l:        UR}                  5       nUS:X  a  SnXl;        [        R
                  R~                  R                  5       U l@         SS KAJs  JBn	  U	R                  5       U lC         SSK<JDn
  U
R}                  5       U lE        U(       a  [        (       d  [?        S5      U lF         SSK<JGn  UR                  5       U lH        U(       a  [        (       d  [?        S5      U lI        [        R                  R                  U lL         SS KMnUR                  U lN        [        R                  R                  U lR         SS KSnUR                  R                  U lT        g ! [(         a    SS KnUR                  n GNf = f! [(         a     GNf = f! [(         a     GNf = f! [:         a    S n GNf = f! [:         a    S n GNtf = f! [(         a     GNf = f! [(         a     GNxf = f! [(         a     GNmf = f! [(         a     GN@f = f! [(         a     Nf = f! [(         a     g f = f)Nr   z (CUDA Python: )cudartz(available)c                     [         R                  R                  R                  [         R                  R                  R                  5       5      $ r   )r9   cudacublas
getVersiondeviceget_cublas_handlerC   r   r   <lambda>'_RuntimeInfo.__init__.<locals>.<lambda>   s/    		((33II$$668:r   rN   cufftc                 $   > T R                  5       $ r   )rO   rT   s   r   rR   rS      s    ((*r   rU   c                 R    [         R                  R                  R                  5       $ r   )r9   rM   curandrO   rC   r   r   rR   rS      s    DII$$//1r   rX   c                 R    [         R                  R                  R                  5       $ r   )r9   rM   cusolver_getVersionrC   r   r   rR   rS      s    DII&&224r   rZ   c                     [         R                  R                  R                  [         R                  R                  R                  5       5      $ r   )r9   rM   cusparserO   rP   get_cusparse_handlerC   r   r   rR   rS      s/    		**55II$$88:<r   r]   c                 R    [         R                  R                  R                  5       $ r   )r9   rM   nvrtcrO   rC   r   r   rR   rS      s    DIIOO..0r   r`   z(NVRTC unavailable)ncclz/(not loaded; try `import cupy.cuda.nccl` first))ra   z	(unknown))cutensorrb   )
cusparselt
cusparseLt)U_fullr9   __version__cupy_versionis_hiprM   get_cuda_path	cuda_path_environmentget_rocm_pathget_nvcc_path	nvcc_pathget_hipcc_pathstrdriverget_build_versioncuda_build_version_is_cuda_pythoncuda.bindingsbindingsImportErrorr   runtimedriverGetVersionCUDARuntimeErrorcuda_driver_versionruntimeGetVersioncuda_runtime_versionget_local_runtime_version	Exceptioncuda_local_runtime_versionr   cuda_local_runtime_pathcublas_versioncublas_path	cupy.cudarU   cufft_version
cufft_pathcurand_versioncurand_pathcusolver_versioncusolver_pathcusparse_versioncusparse_pathnvrtc_version
nvrtc_pathcupy.cuda.thrustthrustthrust_versionr`   rO   cuda_extra_include_dirsr   find_nvidia_header_directory_can_attempt_preload_preload_library	nccl_pathnccl_build_versionnccl_runtime_versioncupy_backends.cuda.libsra   get_versioncubcub_build_versioncupy.cuda.jitifyjitifyjitify_build_versionrb   cutensor_versioncutensor_pathrc   cusparselt_versioncusparselt_path_utilcython_build_vercython_build_versionCythoncython_versionnumpyversionfull_versionnumpy_versionscipyscipy_version)r,   rH   rM   cuda_versionr   r   dra   r   r   rb   rc   r   r   rU   s                 @r   r.   _RuntimeInfo.__init__   s}   
 ,,v!YY446DN!..<<>DNv!..<<>DN!..==?DN #&dii&6&6&H&H&J"K99++--0$#}}88 ##a'HH##1II..II..$0 
 %3II//II..%0! +9II//+' +=h+GD( ,"0:#D 6#5h#? 	'!/*I"7DFF"4W"=
 -1 1(;D !/4! !3J!?D !.$2<%D! 6%7
%C" ,0 09DO	--"(":":"<D
 v% $		 : : < $/D,"??IA 03!A3/D, 11&99!!226:v%7%?DN F ',0,C,C)	4&*&<&<&>D##'#3#3#5 #q('2$(<%
 "&!@!@!B	--(.(@(@(BD%
	8$,$8$8$:D! !3J!?D	:&0&B&B&DD# #5l#CD  %)JJ$?$?!	"("4"4D
 #]]77	!&!;!;Ds  0#//0F  		L  		  % $% ! A,  		  		  		  		  		  		s   %X= AY :Y/ $(Z  Z 9Z& .Z7 [ [ ([* [: =YY
Y,+Y,/
Y=<Y= ZZZ#"Z#&
Z43Z47
[[
[[
['&['*
[76[7:
\\c                
   U R                   nS[        R                  " 5       4S[        R                  " 5       4SU R                  4S[        (       d  SOS4SU R
                  4SU R                  4S	U R                  4S
U R                  4SU R                  4[        (       a  SOSU R                  4SU R                  4SU R                  4SU R                   SU R                   S34/nU(       a   [        (       d  USU R                   S34/-  nUSU R                   4/-  nSU R"                  4SU R$                  4SU R&                  4SU R(                  4SU R*                  4SU R,                  4SU R.                  4SU R0                  4SU R2                  4/	nU(       aj  [        (       d_  SU R4                  4SU R6                  4S U R8                  4S!U R:                  4S"U R<                  4S#U R>                  4/nU[A        X45      -  nOX#-  nUS$U RB                  4S%U RD                  4/-  nU(       a  [        (       d  US&U RF                  4/-  nUS'U RH                  4/-  nU(       a  [        (       d  US(U RJ                  4/-  nUS)U RL                  4/-  nU(       a  [        (       d  US*U RN                  4/-  nS+n [P        RR                  RT                  RW                  5       n[a        U5       H  n[P        RR                  Rc                  U5       n[P        RR                  RT                  Re                  U5      n	S.Rg                  U5      U	S/   Ri                  5       4n
S0Rg                  U5      URj                  4n[        (       a(   U	S1   Ri                  5       nS4Rg                  U5      U4nOS5Rg                  U5      URp                  4nX*X/-  nS S S 5        M     [s        U Vs/ s H  n[u        US+   5      PM     sn5      S6-   nS7[o        U5      -   S8-   n[v        Rx                  " 5       nU H'  u  nnUR{                  URg                  UU5      5        M)     UR}                  5       $ ! [P        RR                  RT                  RX                   a7  nS,URZ                  S+   ;  a  [\        R^                  " S-U 35         S nAGNS nAff = f! [l         a    S2[o        U	S3   5      -   n GNQf = f! , (       d  f       GM  = fs  snf )9NOSzPython VersionzCuPy VersionzCuPy PlatformzNVIDIA CUDAzAMD ROCmzNumPy VersionzSciPy VersionzCython Build VersionzCython Runtime Versionz	CUDA Rootz
HIPCC PATHz	NVCC PATHzCUDA Build VersionzCUDA Driver VersionzCUDA Runtime Versionz (linked to CuPy) / z (locally installed)zCUDA Runtime PathzCUDA Extra Include DirszcuBLAS VersionzcuFFT VersionzcuRAND VersionzcuSOLVER VersionzcuSPARSE VersionzNVRTC VersionzThrust VersionzCUB Build VersionzJitify Build VersionzcuBLAS Pathz
cuFFT PathzcuRAND PathzcuSOLVER PathzcuSPARSE Pathz
NVRTC PathzNCCL Build VersionzNCCL Runtime Versionz	NCCL PathzcuTENSOR VersionzcuTENSOR PathzcuSPARSELt Build VersionzcuSPARSELt Pathr   ErrorNoDevicez!Failed to detect number of GPUs: zDevice {} NamenamezDevice {} PCI Bus IDgcnArchNamegfxgcnArchzDevice {} ArchzDevice {} Compute Capability   z{:z}: {}
)?re   platformpython_versionrg   rh   r   r   r   r   rj   rn   rs   r{   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r9   rM   rx   getDeviceCountrz   argswarningswarnr   DevicegetDevicePropertiesr2   decode
pci_bus_idKeyErrorrp   compute_capabilitymaxr   ioStringIOwritegetvalue)r,   rH   recordsctk_lib_versctk_lib_pathsdevice_countr
   	device_idrP   propsr   pci_busarchrwidthfmtskvs                      r   __str___RuntimeInfo.__str__5  s   zz H%%'(x6689T../66mzJd001d001#T%>%>?%t':':;$..)#V\dnnE!4#:#:;"D$<$<=#,,--A2233GI
( #//00DE  G
 	&(D(DE
 	

 t223d001t223!6!67!6!67d001t223 $"8"89#T%>%>?

  0 01t/ 0 01 $"4"45 $"4"45t/M (EEG#G!4#:#:;#T%>%>?
 	
 dnn566G!6!67
 	
 $*<*<=>>G')@)@A
 	
 *D,@,@ABBG	G99,,;;=L
 |,I!!),		))==iH(//	:f,,.0188C!,,.6;$]3::< -33I>ED:AA)L"557D$00 -, -$ 01S1Y01A5SZ)+KKMDAqGGCJJq!$%  zz|9 yy  11 	GaffQi/ A!EF	G $ ;$Sy)9%::; -," 1sO   (Q1 A6S5S 7S5,T1(S,SSS2.S51S22S55
T	)$re   r   r   r   rs   r{   r   r   r   rj   r}   r   r   rg   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rn   r   r   r   r   )+r>   r?   r@   rA   rg   rj   rn   rs   r{   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   re   r.   r   rB   rC   r   r   rE   rE   S   s    LII   !%" NKMJNKMMMJN" IMONMME# oblr   rE   TrG   c                    [        U S9$ )NrG   )rE   rG   s    r   get_runtime_infor     s    T""r   c                     [        5       $ r   )r    rC   r   r   get_install_infor     s
    >r   c                P    [         R                  R                  U 5      (       a  U $ g)z$Returns None if path does not exist.N)r&   r'   isdir)r'   s    r   r)   r)     s    	ww}}Tr   )
__future__r   r7   r   r&   r   r   r   r9   cupy_backendsrM   apirx   rh   r   r   r   r   r    rE   r   r   r)   rC   r   r   <module>r      s    "  	 	      
					'	'	.	."* *DN Nb
 " #r   