ó
\K]c           @` s·   d  d l  m Z m Z m Z d  d l Z d  d l m Z m Z m	 Z	 d  d l
 m Z m Z d Z d „  Z d Z d Z d	 „  Z d
 e e j f d „  ƒ  YZ e d k r³ e j ƒ  n  d S(   i    (   t   absolute_importt   print_functiont   divisionN(   t   cudat   int32t   float32(   t   unittestt   SerialMixinid   c         C` sp   t  j j t t ƒ } t  j d ƒ } | d k rT x! t t ƒ D] } | | | <q= Wn  t  j ƒ  | | |  | <d  S(   Ni   i    (   R   t   sharedt   arrayt   NR   t   gridt   ranget   syncthreads(   t   aryt   smt   it   j(    (    sC   lib/python2.7/site-packages/numba/cuda/tests/cudapy/test_globals.pyt   simple_smem	   s    
i
   i   c         C` st   t  j d ƒ \ } } t  j j t t f t ƒ } | d | d | | | f <t  j ƒ  | | | f |  | | f <d  S(   Ni   i   (   R   R   R   R	   t   S0t   S1R   R   (   R   R   R   R   (    (    sC   lib/python2.7/site-packages/numba/cuda/tests/cudapy/test_globals.pyt   coop_smem2d   s
    
t   TestCudaTestGlobalc           B` s#   e  Z d  „  Z e j d „  ƒ Z RS(   c         C` sy   t  j d ƒ t ƒ } d } t j | d t j ƒ} | d | f | ƒ |  j t j | t j | d t j ƒk ƒ ƒ d S(   s   Test simple_smem
        s   void(int32[:])id   t   dtypei   N(	   R   t   jitR   t   npt   emptyR   t
   assertTruet   allt   arange(   t   selft   compiledt   nelemR   (    (    sC   lib/python2.7/site-packages/numba/cuda/tests/cudapy/test_globals.pyt   test_global_int_const    s
    c         C` sÑ   t  j d ƒ t ƒ } d } t j | d t j ƒ} | d | f | ƒ t j | ƒ } x[ t | j d ƒ D]F } x= t | j d ƒ D]( } t	 | d ƒ | d | | | f <q„ Wqj W|  j
 t j | | ƒ ƒ d S(	   s   Test coop_smem2d
        s   void(float32[:,:])i
   i   R   i   i    N(   i
   i   (   R   R   R   R   R   R   t
   empty_likeR   t   shapet   floatR   t   allclose(   R   R   R#   R   t   expR   R   (    (    sC   lib/python2.7/site-packages/numba/cuda/tests/cudapy/test_globals.pyt   test_global_tuple_const+   s    *(   t   __name__t
   __module__R!   R   t   SkipTestR'   (    (    (    sC   lib/python2.7/site-packages/numba/cuda/tests/cudapy/test_globals.pyR      s   	t   __main__(   t
   __future__R    R   R   t   numpyR   t   numbaR   R   R   t   numba.cuda.testingR   R   R
   R   R   R   R   t   TestCaseR   R(   t   main(    (    (    sC   lib/python2.7/site-packages/numba/cuda/tests/cudapy/test_globals.pyt   <module>   s   	
	