
    `i                         d dl Z d dlZd dlZ ej                    Z G d de          Zd Zd Ze j	        d             Z
dS )    Nc                   $     e Zd ZdZd fd	Z xZS )DeviceSynchronizedzRaised when device synchronization is detected while disallowed.

    .. warning::

       This API has been deprecated in CuPy v10 and will be removed in future
       releases.

    .. seealso:: :func:`cupyx.allow_synchronize`

    Nc                 R    |d}t                                          |           d S )Nz5Device synchronization was detected while disallowed.)super__init__)selfmessage	__class__s     i/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/cupy/_core/syncdetect.pyr   zDeviceSynchronized.__init__   s+    ?MG!!!!!    N)__name__
__module____qualname____doc__r   __classcell__)r
   s   @r   r   r   	   sG        	 	" " " " " " " " " "r   r   c                  V    	 t           j        S # t          $ r dt           _        Y dS w xY w)NT)_thread_localallowedAttributeError r   r   _is_allowedr      s:    $$    $tts    ((c                  >    t                      st                      d S r   )r   r   r   r   r   _declare_synchronizer   $   s&     == # """# #r   c              #      K   t          j        d           t                      }| t          _        	 dV  |t          _        dS # |t          _        w xY w)a  Allows or disallows device synchronization temporarily in the current thread.

    .. warning::

       This API has been deprecated in CuPy v10 and will be removed in future
       releases.

    If device synchronization is detected, :class:`cupyx.DeviceSynchronized`
    will be raised.

    Note that there can be false negatives and positives.
    Device synchronization outside CuPy will not be detected.
    zucupyx.allow_synchronize will be removed in future releases as it is not possible to reliably detect synchronizations.N)warningswarnr   r   r   )allowolds     r   allow_synchronizer    +   sg        M	?@ @ @ --C!M$ #####s   A A)
contextlib	threadingr   localr   RuntimeErrorr   r   r   contextmanagerr    r   r   r   <module>r&      s              	!!" " " " " " " "$  # # # $ $ $ $ $r   