U
    ?hY                     @   s`   d dl Z d dlmZmZmZmZmZ eeededG dd deZedkr\e 	  dS )    N)CUDATestCaseskip_on_cudasimskip_if_cudadevrt_missingskip_unless_cc_60skip_if_mvc_enabledzCG not supported with MVCz4cudasim doesn't support cuda import at non-top-levelc                   @   s   e Zd Zdd ZdS )TestCooperativeGroupsc           
         s   ddl m m} dd l}|d d d d df f} | fdd}|jd|jd}d}|jd | }|j| |}||k r| 	d	 |||f | |
|d
dj}	|j||	 d S )Nr   )cudaint32   c                    sl     d} j }| jd }| jd }td|D ]4}|| d }| |d |f d | ||f< |  q2d S )Nr
   r   )gridZcgZ	this_gridshaperangesync)McolgrowscolsrowZoppositer    W/var/www/html/venv/lib/python3.8/site-packages/numba/cuda/tests/doc_examples/test_cg.pysequential_rows   s    



z@TestCooperativeGroups.test_ex_grid_sync.<locals>.sequential_rows)   r   )Zdtype    z0Device does not support a large enough coop gridr   )r   r
   )Znumbar   r	   numpyZjitZzerosr   Z	overloadsZmax_cooperative_grid_blocksZskipTestZtileZarangeTZtestingZassert_equal)
selfr	   npsigr   AZblockdimZgriddimmb	referencer   r   r   test_ex_grid_sync   s    
z'TestCooperativeGroups.test_ex_grid_syncN)__name__
__module____qualname__r#   r   r   r   r   r   
   s   r   __main__)
ZunittestZnumba.cuda.testingr   r   r   r   r   r   r$   mainr   r   r   r   <module>   s   >