o
    TÃiê  ã                   @   s(   d dl mZ d dlmZ dZdd„ ZdS )é    )Úget_accelerator)Úis_compilingTc                    s   ‡ fdd„}|S )z¦Decorator that records an NVTX range for the duration of the function call.
       Skips NVTX instrumentation when torch.compile is active to avoid graph breaks.
    c                     s>   t rtƒ stƒ  ˆ j¡ ˆ | i |¤Ž}t rtƒ stƒ  ¡  |S )N)Úenable_nvtxr   r   Ú
range_pushÚ__qualname__Ú	range_pop)ÚargsÚkwargsÚret_val©Úfunc© úH/home/ubuntu/.local/lib/python3.10/site-packages/deepspeed/utils/nvtx.pyÚ
wrapped_fn   s   


z%instrument_w_nvtx.<locals>.wrapped_fnr   )r   r   r   r   r   Úinstrument_w_nvtx   s   r   N)Údeepspeed.acceleratorr   Údeepspeed.runtime.compilerr   r   r   r   r   r   r   Ú<module>   s   