o
    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 )zCreate 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   [/sda-disk/www/egybert/egybert_env/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   )zAssuming 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    