a
    –§»až	  ã                	   @   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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)Ú	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   úR/home/yuhw/wc/pochoir/venv/lib/python3.9/site-packages/numba/cuda/simulator/api.pyÚselect_device   s    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   s
   d V  d S ©Nr   ©Úselfr   r   r   Úauto_synchronize   s    zstream.auto_synchronizec                 C   s   d S r   r   r   r   r   r   Úsynchronize   s    zstream.synchronizeN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r      s   
r   c                   C   s   d S r   r   r   r   r   r   r       s    r   c                   C   s
   dt _d S )NT)r   Úclosedr   r   r   r   Úclose$   s    r   c                  O   s   d S r   r   )ÚargsÚkwargsr   r   r   Údeclare_device(   s    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.2zcompute capability)Úprintr   r   r   r   Údetect,   s    r$   c                   C   s   t S r   )r   r   r   r   r   Úlist_devices2   s    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   s   d S r   r   ©r   r   r   r   r   Úrecord=   s    zEvent.recordc                 C   s   d S r   r   r'   r   r   r   Úwait@   s    z
Event.waitc                 C   s   d S r   r   r   r   r   r   r   C   s    zEvent.synchronizec                 C   s   t dƒ dS )NzSimulator timings are bogusg        r
   )r   Úeventr   r   r   Úelapsed_timeF   s    zEvent.elapsed_timeN)r   )r   )r   r   r   r   r(   r)   r   r+   r   r   r   r   r&   8   s
   

r&   NFc	           
         sR   |rt dƒ‚|d urt dƒ‚| d u s4t| tttfƒrF‡ ‡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Úfastmathr   )Úfnr,   r   r   Ú
jitwrapper[   s    þzjit.<locals>.jitwrapper)r-   )ÚNotImplementedErrorÚ
isinstanceÚstrÚtupler	   r   )
Zfunc_or_sigr-   ÚdebugÚargtypesÚinlineÚrestyper.   ÚlinkZboundscheckr0   r   r,   r   ÚjitN   s    r:   c                   c   s
   d V  d S r   r   r   r   r   r   Údefer_cleanupc   s    r;   )r   )	NFFNFNFNN)r   Ú
contextlibr   Zcudadrv.devicesr   r   r   Úkernelr   Znumba.core.typingr	   Úwarningsr   r    r   r   r   r   Úobjectr   r   r   r"   r$   r%   r&   r*   r:   r;   r   r   r   r   Ú<module>   s*   
   þ
