o
    lÛ‚i  ã                   @   s<   d dl Z eZdZee jdƒre jjZdZG dd„ deƒZdS )é    NFÚ_CUDAGreenContextTc                       sL   e Zd ZdZeddededefdd„ƒZd‡ fd	d
„Zd‡ fdd„Z	‡  Z
S )ÚGreenContextzyWrapper around a CUDA green context.

    .. warning::
       This API is in beta and may change in future releases.
    r   Únum_smsÚ	device_idÚreturnc                 C   s   t stdƒ‚t | |¡S )zÍCreate a CUDA green context.

        Arguments:
            num_sms (int): The number of SMs to use in the green context.
            device_id (int, optional): The device index of green context.
        z1PyTorch was not built with Green Context support!)Ú	SUPPORTEDÚRuntimeErrorÚ_GreenContextÚcreate)r   r   © r   ú\/home/ubuntu/maya3_transcribe/venv/lib/python3.10/site-packages/torch/cuda/green_contexts.pyr
      s   zGreenContext.createNc                    ó
   t ƒ  ¡ S )z+Make the green context the current context.)ÚsuperÚset_context©Úself©Ú	__class__r   r   r   #   s   
zGreenContext.set_contextc                    r   )zƒAssuming the green context is the current context, pop it from the
        context stack and restore the previous context.
        )r   Úpop_contextr   r   r   r   r   '   s   
zGreenContext.pop_context)r   )r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚstaticmethodÚintr	   r
   r   r   Ú__classcell__r   r   r   r   r      s    r   )ÚtorchÚobjectr	   r   ÚhasattrÚ_Cr   r   r   r   r   r   Ú<module>   s    