
    sh
                         S SK rS SKJr  \" SS5      rSr " S S5      r " S S	5      r " S
 S5      r\" 5       r	S r
SS jrS rg)    N)
namedtuple_MemoryInfoz
free,total)      c                   *    \ rS rSrS r\S 5       rSrg)FakeCUDADevice	   c                     SU l         g )Nz(GPU-00000000-0000-0000-0000-000000000000uuidselfs    x/Users/tiagomarins/Projetos/claudeai/copy_bank/venv/lib/python3.13/site-packages/numba/cuda/simulator/cudadrv/devices.py__init__FakeCUDADevice.__init__
   s	    >	    c                     [         $ N_SIMULATOR_CCr   s    r   compute_capability!FakeCUDADevice.compute_capability       r   r   N)__name__
__module____qualname____firstlineno__r   propertyr   __static_attributes__ r   r   r   r   	   s    ?  r   r   c                   |    \ rS rSrSrS rS rS rS r\	S 5       r
\	S 5       r\	S	 5       rS
 rS rS rSS jrSrg)FakeCUDAContext   zT
This stub implements functionality only for simulating a single GPU
at the moment.
c                 .    Xl         [        5       U l        g r   )
_device_idr   _device)r   	device_ids     r   r   FakeCUDAContext.__init__   s    #%'r   c                     g r   r    r   s    r   	__enter__FakeCUDAContext.__enter__       r   c                     g r   r    )r   exc_typeexc_valexc_tbs       r   __exit__FakeCUDAContext.__exit__   r,   r   c                      SR                  U S9$ )Nz<Managed Device {self.id}>r   )formatr   s    r   __str__FakeCUDAContext.__str__!   s    +222==r   c                     U R                   $ r   )r%   r   s    r   idFakeCUDAContext.id$   s    r   c                     U R                   $ r   )r&   r   s    r   deviceFakeCUDAContext.device(   s    ||r   c                     [         $ r   r   r   s    r   r   "FakeCUDAContext.compute_capability,   r   r   c                     g r   r    r   s    r   resetFakeCUDAContext.reset0   r,   r   c                 >    [        [        S5      [        S5      5      $ )z
Cross-platform free / total host memory is hard without external
dependencies, e.g. `psutil` - so return infinite memory to maintain API
type compatibility
inf)r   floatr   s    r   get_memory_infoFakeCUDAContext.get_memory_info3   s     5<u66r   c                 ,    [         R                  " USS9$ )z
Allocates memory on the simulated device
At present, there is no division between simulated
host memory and simulated device memory.
u1)dtype)npndarray)r   szs     r   memallocFakeCUDAContext.memalloc;   s     zz"D))r   c                 $    U R                  U5      $ )zAllocates memory on the host)rM   )r   rL   mappedportablewcs        r   memhostallocFakeCUDAContext.memhostallocC   s    }}R  r   )r&   r%   N)FFF)r   r   r   r   __doc__r   r*   r1   r5   r   r8   r;   r   r@   rE   rM   rS   r   r    r   r   r"   r"      sk    (>      7*!r   r"   c                   F    \ rS rSrSrS rS rS rS rS r	\
S 5       rS	rg
)FakeDeviceListH   z
This stub implements a device list containing a single GPU. It also
keeps track of the GPU status, i.e. whether the context is closed or not,
which may have been set by the user calling reset()
c                 4    [        S5      4U l        SU l        g )Nr   F)r"   lstclosedr   s    r   r   FakeDeviceList.__init__N   s    #A&(r   c                 .    SU l         U R                  U   $ )NFr[   rZ   )r   devnums     r   __getitem__FakeDeviceList.__getitem__R   s    xxr   c                 v    SR                  U R                   Vs/ s H  n[        U5      PM     sn5      $ s  snf )Nz, )joinrZ   str)r   ds     r   r5   FakeDeviceList.__str__V   s+    yy$((3(Q#a&(3443s   6c                 ,    [        U R                  5      $ r   )iterrZ   r   s    r   __iter__FakeDeviceList.__iter__Y   s    DHH~r   c                 ,    [        U R                  5      $ r   )lenrZ   r   s    r   __len__FakeDeviceList.__len__\   s    488}r   c                 D    U R                   (       a  g U R                  S   $ )Nr   r^   r   s    r   currentFakeDeviceList.current_   s    ;;xx{r   r^   N)r   r   r   r   rU   r   r`   r5   ri   rm   r   rp   r   r    r   r   rW   rW   H   s4    
 5  r   rW   c                       S[         S   l        g )NTr   )gpusr[   r    r   r   r@   r@   i   s    DGNr   c                     [        U 5      $ r   )r"   )r_   s    r   get_contextru   m   s    6""r   c                     U $ )zH
In the simulator, a context is always "available", so this is a no-op.
r    )funcs    r   require_contextrx   q   s	     Kr   )r   )numpyrJ   collectionsr   r   r   r   r"   rW   rs   r@   ru   rx   r    r   r   <module>r{      sT     "5 3! 3!l < #r   