o
    ˜º¥g  ã                   @   s&   d dl Z d dlZd dlZddd„ZdS )é    NFc                    sL   t j d¡st d¡ d S d |h}d	dd„‰ ‡ fdd„|D ƒ}dd„ |D ƒS )
NÚlinuxz(find_cudart_versions only works on Linuxc                 S   s|   d}| r
|d |  }z)t  |¡}t|j_t  t j¡g|j_t  ¡ }| t  |¡¡}|dkr0W d S W |j
S  t	y=   Y d S w )Nzlibcudart.soÚ.r   )ÚctypesÚCDLLÚintÚcudaRuntimeGetVersionÚrestypeÚPOINTERÚc_intÚargtypesÚbyrefÚ	ExceptionÚvalue)Úfind_cudart_versionÚcudart_lib_filenameÚcudartÚversionÚstatus© r   úf/var/www/visachat/venv/lib/python3.10/site-packages/onnxruntime/capi/onnxruntime_collect_build_info.pyÚget_cudart_version   s    
ÿýÿz0find_cudart_versions.<locals>.get_cudart_versionc                    s   h | ]}ˆ |ƒ’qS r   r   )Ú.0Úcudart_version©r   r   r   Ú	<setcomp>,   ó    z'find_cudart_versions.<locals>.<setcomp>c                 S   s   g | ]}|r|‘qS r   r   )r   Úverr   r   r   Ú
<listcomp>/   r   z(find_cudart_versions.<locals>.<listcomp>)N)ÚsysÚplatformÚ
startswithÚwarningsÚwarn)Ú	build_envÚbuild_cuda_versionÚcudart_possible_versionsÚcudart_found_versionsr   r   r   Úfind_cudart_versions
   s   	

r'   )FN)r   r   r!   r'   r   r   r   r   Ú<module>   s   