o
    ih                     @   sp   d dl Zd dlmZmZmZ d dlmZmZ dZ	dd Z
dZdZd	d
 ZG dd deZedkr6e  dS dS )    N)cudaint32float32)unittestCUDATestCased   c                 C   sN   t jtt}t d}|dkrttD ]}|||< qt   || | |< d S )N   r   )r   sharedarrayNr   gridrangesyncthreads)arysmij r   b/home/ubuntu/transcripts/venv/lib/python3.10/site-packages/numba/cuda/tests/cudapy/test_globals.pysimple_smem   s   

r   
      c                 C   sX   t d\}}t jttft}|d |d  |||f< t   |||f | ||f< d S )N   r   )r   r   r	   r
   S0S1r   r   )r   r   r   r   r   r   r   coop_smem2d   s
   r   c                   @   s"   e Zd Zdd Zejdd ZdS )TestCudaTestGlobalc              	   C   sV   t dt}d}tj|tjd}|d|f | | t|tj|tjdk dS )zTest simple_smem
        zvoid(int32[:])r   dtyper   N)	r   jitr   npemptyr   
assertTrueallarange)selfcompilednelemr   r   r   r   test_global_int_const   s
   $z(TestCudaTestGlobal.test_global_int_constc                 C   s   t dt}d}tj|tjd}|d|f | t|}t|jd D ]}t|jd D ]}t	|d |d  |||f< q.q%| 
t|| dS )zTest coop_smem2d
        zvoid(float32[:,:]))r   r   r   r   r   N)r   r   r   r    r!   r   
empty_liker   shapefloatr"   allclose)r%   r&   r*   r   expr   r   r   r   r   test_global_tuple_const*   s   
z*TestCudaTestGlobal.test_global_tuple_constN)__name__
__module____qualname__r(   r   SkipTestr.   r   r   r   r   r      s    r   __main__)numpyr    numbar   r   r   numba.cuda.testingr   r   r   r   r   r   r   r   r/   mainr   r   r   r   <module>   s    
