o
     ip
                     @   s|   d dl mZ d dlZddlmZmZmZmZmZ ddl	m
Z
 ddlmZ deeef fdd	Zd
d Zedkr<e  dS dS )    )DictN   )__version___cpp_lib_is_opensource_is_triton_availableops)OPERATORS_REGISTRY)DCGM_PROFILER_AVAILABLEreturnc                  C   sl   i } t D ]}| rdnd}|| |j d|j < qtj  D ]\}}|| d| < q!tt	 | d< | S )N	availableunavailable.zswiglu.is_triton_available)
r	   is_availableOPERATOR_CATEGORYNAMEr   	swiglu_op_infoitemsstrr   )featuresop
status_strkv r   A/home/ubuntu/.local/lib/python3.10/site-packages/xformers/info.pyget_features_status   s   r   c               	   C   s  t  } tdt  tj| d< tj r8d| d< tj }tj|}ddd |D | d< tj	|| d	< nd
| d< t
r@dnd| d< tj}|d u rVttjtjrVtjj}|d urd| d< |j| d< |j| d< |j| d< |j| d< |j D ]\}}|| d| < qwnd| d< zddd tjj D | d< W n ttfy   Y nw trd| d< nd| d< |  D ]\}}td| d| qd S )Nz	xFormers zpytorch.versionr   zpytorch.cudar   c                 s       | ]}t |V  qd S Nr   ).0verr   r   r   	<genexpr>#   s    zprint_info.<locals>.<genexpr>zgpu.compute_capabilityzgpu.nameznot availabler   dcgm_profilerz
build.infozbuild.cuda_versionzbuild.hip_versionzbuild.python_versionzbuild.torch_versionz
build.env.nonec                 s   r   r    r!   )r"   r   r   r   r   r$   =   s    
zbuild.nvcc_versionzopen sourcezsource.privacyfairinternalz	{:<50} {}:)r   printr   torchcudar   current_deviceget_device_capabilityjoinget_device_namer
   r   _build_metadata
isinstance_cpp_library_load_exceptionxFormersInvalidLibException
build_infocuda_versionhip_versionpython_versiontorch_version	build_envr   r   xformers_nvcc_build_versionRuntimeErrorAttributeErrorr   format)r   devicecapr4   r   r   namestatusr   r   r   
print_info   sP   











rC   __main__)typingr   r*    r   r   r   r   r   
ops.commonr	   profiler.profiler_dcgmr
   r   r   rC   __name__r   r   r   r   <module>   s   1
