
    xKg<
                         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
Zd Z G d de      Zd Zd Zd Zd Zd Z G d de      ZeZ	 	 	 ddZed        Zy)z
Contains CUDA API functions
    )contextmanager   )require_contextresetgpusFakeCUDAKernel)is_signaturewarn   )InOutInOutc                     | dk(  sJ d       y )Nr   z/Only a single device supported by the simulator )devs    \/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/numba/cuda/simulator/api.pyselect_devicer      s    !8FFF8    c                       yNTr   r   r   r   is_float16_supportedr      s    r   c                   &    e Zd ZdZed        Zd Zy)streamz
    The stream API is supported in the simulator - however, all execution
    occurs synchronously, so synchronization requires no operation.
    c              #      K   d  y wNr   selfs    r   auto_synchronizezstream.auto_synchronize   s	        c                      y r   r   r   s    r   synchronizezstream.synchronize!       r   N)__name__
__module____qualname____doc__r   r    r#   r   r   r   r   r      s       r   r   c                       y r   r   r   r   r   r#   r#   %       r   c                      dt         _        y r   )r   closedr   r   r   closer-   )   s	    DKr   c                       y r   r   )argskwargss     r   declare_devicer1   -   r*   r   c                  R    t        d       t        ddz         t        ddz         y )NzFound 1 CUDA deviceszid %d    %20s %40s)r   	SIMULATORz[SUPPORTED]z	%40s: 5.0zcompute capability)printr   r   r   detectr5   1   s(    	
 !	
!@
@A	+,
,-r   c                      t         S r   )r   r   r   r   list_devicesr7   7   s    Kr   c                   ,    e Zd ZdZddZddZd Zd Zy)Eventz
    The simulator supports the event API, but they do not record timing info,
    and all simulation is synchronous. Execution time is not recorded.
    c                      y r   r   r   r   s     r   recordzEvent.recordB   r$   r   c                      y r   r   r;   s     r   waitz
Event.waitE   r$   r   c                      y r   r   r   s    r   r#   zEvent.synchronizeH   r$   r   c                     t        d       y)NzSimulator timings are bogusg        r   )r   events     r   elapsed_timezEvent.elapsed_timeK   s    *+r   Nr   )r%   r&   r'   r(   r<   r>   r#   rB   r   r   r   r9   r9   =   s    r   r9   Nc                     |rt        d      |t        d      | t        |       st        | t              r	fd}|S t	        |       S )Nz)bounds checking is not supported for CUDAz Cannot link PTX in the simulatorc                 "    t        |       S )N)devicefastmathdebugr   )fnrH   rF   rG   s    r   
jitwrapperzjit.<locals>.jitwrapperb   s    !")/+3(-/ /r   )rF   rH   )NotImplementedErrorr
   
isinstancelistr	   )func_or_sigrF   rH   argtypesinlinerestyperG   linkboundscheckoptcacherJ   s    ``   `     r   jitrV   S   s[    
 !"MNN!"DEE 	|K8+t,	/
 +fEBBr   c               #      K   d  y wr   r   r   r   r   defer_cleanuprX   k   s      
r!   rC   )NFFNFNFNNTN)r(   
contextlibr   cudadrv.devicesr   r   r   kernelr	   numba.core.sigutilsr
   warningsr   r/   r   r   r   r   r   objectr   r#   r-   r1   r5   r7   r9   rA   rV   rX   r   r   r   <module>r_      s    & 9 9 " ,  ! !G
V 
		.F & 	 ?C9=*.C0 
 
r   