
    9i                     p    d dl Z eZdZ ee j        d          re j        j        ZdZ G d de          ZdS )    NF_CUDAGreenContextTc                   V     e Zd ZdZed
dededefd            Zd fdZd fd	Z	 x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                 d    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   s     L/var/www/icac/venv/lib/python3.11/site-packages/torch/cuda/green_contexts.pyr   zGreenContext.create   s2      	TRSSS##GY777    Nc                 D    t                                                      S )z+Make the green context the current context.)superset_contextself	__class__s    r   r   zGreenContext.set_context#   s    ww""$$$r   c                 D    t                                                      S )zAssuming the green context is the current context, pop it from the
        context stack and restore the previous context.
        )r   pop_contextr   s    r   r   zGreenContext.pop_context'   s     ww""$$$r   )r   )r   N)__name__
__module____qualname____doc__staticmethodintr   r   r   r   __classcell__)r   s   @r   r   r      s          	8 	8 	8 	8M 	8 	8 	8 \	8% % % % % %% % % % % % % % % %r   r   )torchobjectr   r
   hasattr_Cr   r    r   r   <module>r$      st     	
758()) H.MI
% % % % %= % % % % %r   