o
    X۷i                     @  sR   d dl mZ d dlZd dlmZ d dlmZ d dl	m
Z
 ejdd Zdd	 ZdS )
    )annotationsN)runtime)	benchmark)
time_rangec                   c  s*    t   z
dV  W t   dS t   w )a  Enable CUDA profiling during with statement.

    This function enables profiling on entering a with statement, and disables
    profiling on leaving the statement.

    >>> with cupyx.profiler.profile():
    ...    # do something you want to measure
    ...    pass

    .. note::
        When starting ``nvprof`` from the command line, manually setting
        ``--profile-from-start off`` may be required for the desired behavior.
        Likewise, when using ``nsys profile`` setting ``-c cudaProfilerApi``
        may be required.

    .. seealso:: :func:`cupy.cuda.runtime.profilerStart`,
        :func:`cupy.cuda.runtime.profilerStop`
    N)_runtimeprofilerStartprofilerStop r	   r	   M/home/ubuntu/vllm_env/lib/python3.10/site-packages/cupyx/profiler/__init__.pyprofile	   s
   r   c                 C  s   ddl m} | | dS )zLoad the %gpu_timeit magic.

    This function is called when the extension is loaded via:
        %load_ext cupyx.profiler
    r   )GPUTimeitMagicsN)cupyx.profiler._timeit_magicr   register_magics)ipythonr   r	   r	   r
   load_ipython_extension$   s   r   )
__future__r   
contextlib_contextlib	cupy.cudar   r   cupyx.profiler._timer   cupyx.profiler._time_ranger   contextmanagerr   r   r	   r	   r	   r
   <module>   s    
