o
    i<
                     @   s   d Z ddlmZ ddlmZmZmZ ddlmZ ddl	m
Z
 ddlmZ dd	lmZmZmZ d#d
dZdd ZG dd deZdd Zdd Zdd Zdd Zdd ZG dd deZeZ			d$dd Zed!d" ZdS )%z
Contains CUDA API functions
    )contextmanager   )require_contextresetgpusFakeCUDAKernel)is_signaturewarn   )InOutInOutc                 C   s   | dksJ dd S )Nr   z/Only a single device supported by the simulator )devr   r   g/var/www/html/eduruby.in/lip-sync/lip-sync-env/lib/python3.10/site-packages/numba/cuda/simulator/api.pyselect_device   s   r   c                   C   s   dS NTr   r   r   r   r   is_float16_supported      r   c                   @   s$   e Zd ZdZedd Zdd ZdS )streamz
    The stream API is supported in the simulator - however, all execution
    occurs synchronously, so synchronization requires no operation.
    c                 c       d V  d S Nr   selfr   r   r   auto_synchronize   s   
zstream.auto_synchronizec                 C      d S r   r   r   r   r   r   synchronize!   r   zstream.synchronizeN)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r      s
    
r   c                   C   r   r   r   r   r   r   r   r   %   r   r   c                   C   s
   dt _d S r   )r   closedr   r   r   r   close)   s   
r$   c                  O   r   r   r   )argskwargsr   r   r   declare_device-   r   r'   c                   C   s$   t d t dd  t dd  d S )NzFound 1 CUDA deviceszid %d    %20s %40s)r   Z	SIMULATORz[SUPPORTED]z	%40s: 5.0zcompute capability)printr   r   r   r   detect1   s   r)   c                   C   s   t S r   )r   r   r   r   r   list_devices7   r   r*   c                   @   s4   e Zd ZdZdddZdddZdd Zd	d
 ZdS )Eventz
    The simulator supports the event API, but they do not record timing info,
    and all simulation is synchronous. Execution time is not recorded.
    r   c                 C   r   r   r   r   r   r   r   r   recordB   r   zEvent.recordc                 C   r   r   r   r,   r   r   r   waitE   r   z
Event.waitc                 C   r   r   r   r   r   r   r   r   H   r   zEvent.synchronizec                 C   s   t d dS )NzSimulator timings are bogusg        r
   )r   eventr   r   r   elapsed_timeK   s   zEvent.elapsed_timeNr   )r   r    r!   r"   r-   r.   r   r0   r   r   r   r   r+   =   s    

r+   NFTc                    sX   |rt d|d urt d| d u st| st| tr% fdd}|S t|  dS )Nz)bounds checking is not supported for CUDAz Cannot link PTX in the simulatorc                    s   t |  dS )N)devicefastmathdebugr   )fnr4   r2   r3   r   r   
jitwrapperb   s
   zjit.<locals>.jitwrapper)r2   r4   )NotImplementedErrorr	   
isinstancelistr   )Zfunc_or_sigr2   r4   argtypesinlinerestyper3   linkZboundscheckoptcacher7   r   r6   r   jitS   s   rA   c                   c   r   r   r   r   r   r   r   defer_cleanupk   s   
rB   r1   )NFFNFNFNNTN)r"   
contextlibr   Zcudadrv.devicesr   r   r   Zkernelr   Znumba.core.sigutilsr	   warningsr   r%   r   r   r   r   r   objectr   r   r$   r'   r)   r*   r+   r/   rA   rB   r   r   r   r   <module>   s.    

