
    i<
                         S r SSKJr  SSKJrJrJr  SSKJr  SSK	J
r
  SSKJr  SS	KJrJrJr  SS
 jrS r " S S\5      rS rS rS rS rS r " S S\5      r\r   SS jr\S 5       rg)z
Contains CUDA API functions
    )contextmanager   )require_contextresetgpusFakeCUDAKernel)is_signaturewarn   )InOutInOutc                     U S:X  d   S5       eg )Nr   z/Only a single device supported by the simulator )devs    S/var/www/html/trading/venv/lib/python3.13/site-packages/numba/cuda/simulator/api.pyselect_devicer      s    !8FFF8    c                      gNTr   r   r   r   is_float16_supportedr      s    r   c                   .    \ rS rSrSr\S 5       rS rSrg)stream   z
The stream API is supported in the simulator - however, all execution
occurs synchronously, so synchronization requires no operation.
c              #      #    S v   g 7fNr   selfs    r   auto_synchronizestream.auto_synchronize   s        c                     g r   r   r   s    r   synchronizestream.synchronize!       r   r   N)	__name__
__module____qualname____firstlineno____doc__r   r!   r%   __static_attributes__r   r   r   r   r      s       r   r   c                      g r   r   r   r   r   r%   r%   %       r   c                      S[         l        g r   )r   closedr   r   r   closer2   )   s	    DKr   c                      g r   r   )argskwargss     r   declare_devicer6   -   r/   r   c                  R    [        S5        [        SS-  5        [        SS-  5        g )NzFound 1 CUDA deviceszid %d    %20s %40s)r   	SIMULATORz[SUPPORTED]z	%40s: 5.0zcompute capability)printr   r   r   detectr:   1   s(    	
 !	
!@
@A	+,
,-r   c                      [         $ r   )r   r   r   r   list_devicesr<   7   s    Kr   c                   8    \ rS rSrSrS	S jrS	S jrS rS rSr	g)
Event=   z
The simulator supports the event API, but they do not record timing info,
and all simulation is synchronous. Execution time is not recorded.
c                     g r   r   r    r   s     r   recordEvent.recordB   r'   r   c                     g r   r   rA   s     r   wait
Event.waitE   r'   r   c                     g r   r   r   s    r   r%   Event.synchronizeH   r'   r   c                     [        S5        g)NzSimulator timings are bogusg        r   )r    events     r   elapsed_timeEvent.elapsed_timeK   s    *+r   r   Nr   )
r(   r)   r*   r+   r,   rB   rE   r%   rK   r-   r   r   r   r>   r>   =   s    r   r>   Nc                    ^^^ U(       a  [        S5      eUb  [        S5      eU b%  [        U 5      (       d  [        U [        5      (       a
  UUU4S jnU$ [	        U TTS9$ )Nz)bounds checking is not supported for CUDAz Cannot link PTX in the simulatorc                    > [        U TTTS9$ )N)devicefastmathdebugr   )fnrR   rP   rQ   s    r   
jitwrapperjit.<locals>.jitwrapperb   s    !")/+3(-/ /r   )rP   rR   )NotImplementedErrorr
   
isinstancelistr	   )func_or_sigrP   rR   argtypesinlinerestyperQ   linkboundscheckoptcacherT   s    ``   `     r   jitra   S   sa    
 !"MNN!"DEE 	|K88+t,,	/
 +fEBBr   c               #      #    S v   g 7fr   r   r   r   r   defer_cleanuprc   k   s
      
r#   rM   )NFFNFNFNNTN)r,   
contextlibr   cudadrv.devicesr   r   r   kernelr	   numba.core.sigutilsr
   warningsr   r4   r   r   r   r   r   objectr   r%   r2   r6   r:   r<   r>   rJ   ra   rc   r   r   r   <module>rj      s    & 9 9 " ,  ! !G
V 
		.F & 	 ?C9=*.C0 
 
r   