§
    ŠŠtj&  ã                   óv   — d dl Z dgZeZdZ ee j        d¦  «        re j        j        ZdZ G d„ de¦  «        ZdS )é    NÚGreenContextFÚ_CUDAGreenContextTc                   ó´   ‡ — e Zd ZdZedddddœdedz  dedz  dedz  dedz  def
d	„¦   «         Zeddedz  defd
„¦   «         Z	dˆ fd„Z
dˆ fd„Zdˆ fd„Zˆ xZS )r   zyWrapper around a CUDA green context.

    .. warning::
       This API is in beta and may change in future releases.
    N©Únum_smsÚworkqueue_scopeÚworkqueue_concurrency_limitÚ	device_idr   r   r	   r
   Úreturnc                 ój   — t           st          d¦  «        ‚t                               || ||¬¦  «        S )a+  Create a CUDA green context.

        At least one of ``num_sms`` or ``workqueue_scope`` must be specified.
        Both can be combined to partition SMs and configure workqueues in the
        same green context.

        Arguments:
            num_sms (int, optional): The number of SMs to use in the green
                context. When ``None``, SMs are not partitioned.
            workqueue_scope (str, optional): Workqueue sharing scope. One of
                ``"device_ctx"`` (shared across all contexts, default driver
                behaviour) or ``"balanced"`` (non-overlapping workqueues with
                other balanced green contexts). When ``None``, no workqueue
                configuration is applied.
            workqueue_concurrency_limit (int, optional): Maximum number of
                concurrent stream-ordered workloads for the workqueue. Requires
                ``workqueue_scope`` to be set.
            device_id (int, optional): The device index of green context.
                When ``None``, the current device is used.
        ú1PyTorch was not built with Green Context support!)r
   r   r   r	   )Ú	SUPPORTEDÚRuntimeErrorÚ_GreenContextÚcreater   s       úW/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/torch/cuda/green_contexts.pyr   zGreenContext.create   sE   € õ8 ð 	TÝÐRÑSÔSÐSÝ×#Ò#ØØØ+Ø(Cð	 $ñ 
ô 
ð 	
ó    c                 ód   — t           st          d¦  «        ‚t                               | ¬¦  «        S )aw  Return the maximum workqueue concurrency limit for the device.

        This queries the device for the default number of concurrent
        stream-ordered workloads supported by workqueue configuration
        resources.

        Arguments:
            device_id (int, optional): The device index to query. When
                ``None``, the current device is used.
        r   ©r
   )r   r   r   Úmax_workqueue_concurrencyr   s    r   r   z&GreenContext.max_workqueue_concurrency>   s3   € õ ð 	TÝÐRÑSÔSÐSÝ×6Ò6ÀÐ6ÑKÔKÐKr   c                 óD   •— t          ¦   «                              ¦   «         S )z+Make the green context the current context.)ÚsuperÚset_context©ÚselfÚ	__class__s    €r   r   zGreenContext.set_contextP   s   ø€ å‰wŒw×"Ò"Ñ$Ô$Ð$r   c                 óD   •— t          ¦   «                              ¦   «         S )zƒAssuming 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_contextT   s   ø€ õ ‰wŒw×"Ò"Ñ$Ô$Ð$r   útorch.cuda.Streamc                 óD   •— t          ¦   «                              ¦   «         S )z1Return the CUDA Stream used by the green context.)r   ÚStreamr   s    €r   r!   zGreenContext.StreamZ   s   ø€ å‰wŒw�~Š~ÑÔÐr   )N)r   N)r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚstaticmethodÚintÚstrr   r   r   r   r   r!   Ú__classcell__)r   s   @r   r   r      s:  ø€ € € € € ðð ð ð #Ø&*Ø26Ø $ð"
ð "
ð "
à�t‘ð"
ð ˜t™ð"
ð &)¨4¡Zð	"
ð
 ˜‘:ð"
ð 
ð"
ð "
ð "
ñ „\ð"
ðH ðLð L¨S°4©Zð LÀ3ð Lð Lð Lñ „\ðLð"%ð %ð %ð %ð %ð %ð%ð %ð %ð %ð %ð %ð ð  ð  ð  ð  ð  ð  ð  ð  ð  r   )	ÚtorchÚ__all__Úobjectr   r   ÚhasattrÚ_Cr   r   © r   r   ú<module>r0      sŠ   ðØ €€€ð ð€ð €Ø€	à
€7ˆ5Œ8Ð(Ñ)Ô)ð Ø”HÔ.€MØ€Ið
J ð J ð J ð J ð J �=ñ J ô J ð J ð J ð J r   