a
    NSic	  ã                   @   s’   d dl mZ zd dlmZ W n( eyD   G dd„ deƒZeƒ ZY n0 g d¢Zdd„ Zdd	„ Z	e
d
œdd„Zdd
œdd„Zdd„ Zedd„ ƒZdS )é    )Úcontextmanager)Ú_nvtxc                   @   s$   e Zd Zedd„ ƒZeZeZeZdS )Ú	_NVTXStubc                  O   s   t dƒ‚d S )NzANVTX functions not installed. Are you sure you have a CUDA build?)ÚRuntimeError)ÚargsÚkwargs© r   úK/var/www/html/django/DPS/env/lib/python3.9/site-packages/torch/cuda/nvtx.pyÚ_fail   s    z_NVTXStub._failN)Ú__name__Ú
__module__Ú__qualname__Ústaticmethodr
   Ú
rangePushAÚrangePopÚmarkAr   r   r   r	   r      s
   
r   )Ú
range_pushÚ	range_popÚrange_startÚ	range_endÚmarkÚrangec                 C   s
   t  | ¡S )z¾
    Pushes a range onto a stack of nested range span.  Returns zero-based
    depth of the range that is started.

    Args:
        msg (string): ASCII message to associate with range
    )r   r   ©Úmsgr   r   r	   r      s    r   c                   C   s   t  ¡ S )zz
    Pops a range off of a stack of nested range spans.  Returns the
    zero-based depth of the range that is ended.
    )r   r   r   r   r   r	   r      s    r   )Úreturnc                 C   s
   t  | ¡S )aì  
    Mark the start of a range with string message. It returns an unique handle
    for this range to pass to the corresponding call to rangeEnd().

    A key difference between this and range_push/range_pop is that the
    range_start/range_end version supports range across threads (start on one
    thread and end on another thread).

    Returns: A range handle (uint64_t) that can be passed to range_end().

    Args:
        msg (string): ASCII message to associate with the range.
    )r   ÚrangeStartAr   r   r   r	   r   '   s    r   Nc                 C   s   t  | ¡ dS )z€
    Mark the end of a range for a given range_id.

    Args:
        range_id (int): an unique handle for the start range.
    N)r   ÚrangeEnd)Zrange_idr   r   r	   r   8   s    r   c                 C   s
   t  | ¡S )z’
    Describe an instantaneous event that occurred at some point.

    Args:
        msg (string): ASCII message to associate with the event.
    )r   r   r   r   r   r	   r   B   s    r   c                 o   s$   t | j|i |¤Žƒ dV  tƒ  dS )a  
    Context manager / decorator that pushes an NVTX range at the beginning
    of its scope, and pops it at the end. If extra arguments are given,
    they are passed as arguments to msg.format().

    Args:
        msg (string): message to associate with the range
    N)r   Úformatr   )r   r   r   r   r   r	   r   L   s    
r   )Ú
contextlibr   Útorch._Cr   ÚImportErrorÚobjectr   Ú__all__r   r   Úintr   r   r   r   r   r   r   r	   Ú<module>   s   	

