o
    Tæ«dn  ã                   @   sî  d dl Z ddlmZmZmZmZmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z  ddl!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z' ddl(m)Z) d dl*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3 d dl4m5Z5 ddl6m7Z7 d d	l8m9Z9 dd
l:m;Z; ddl<m=Z=m>Z> ddl?T ddl?m@Z@ ddlAmBZBmCZCmDZD ddlEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZM ddlNmOZO eOjP ZQZPe D ]ZReSe jTeU eRjUeRƒ eRjVD ]ZWeSe jTeU eWeRƒ qÖqÇ[R[ dd„ ZXdd„ ZYdd„ ZZe9 [¡  dS )é    Né   )Ú	threadIdxÚblockIdxÚblockDimÚgridDimÚlaneidÚwarpsizeÚsyncwarpÚsharedÚlocalÚconstÚatomicÚshfl_sync_intrinsicÚvote_sync_intrinsicÚmatch_any_syncÚmatch_all_syncÚthreadfence_blockÚthreadfence_systemÚthreadfenceÚselpÚpopcÚbrevÚclzÚffsÚfmaÚcbrtÚcgÚ
activemaskÚlanemask_ltÚ	nanosleepÚfp16Ú_vector_type_stubs)ÚgridÚgridsizeÚsyncthreadsÚsyncthreads_andÚsyncthreads_countÚsyncthreads_or)ÚCudaSupportError)	ÚBaseCUDAMemoryManagerÚHostOnlyCUDAMemoryManagerÚGetIpcHandleMixinÚMemoryPointerÚMappedMemoryÚPinnedMemoryÚ
MemoryInfoÚ	IpcHandleÚset_memory_manager)Úruntime)Únvvm)Ú
initialize)ÚKernelRuntimeError)ÚjitÚdeclare_device)Ú*)Ú_auto_device)ÚInÚOutÚInOut)Úall_syncÚany_syncÚeq_syncÚballot_syncÚ	shfl_syncÚshfl_up_syncÚshfl_down_syncÚshfl_xor_sync)Ú	reductionc                  C   s0   d} zt j j} W n	 ty   Y nw | ot ¡ S )z†Returns a boolean to indicate the availability of a CUDA GPU.

    This will initialize the driver if it hasn't been initialized.
    F)ÚdriverÚis_availabler(   r3   )Údriver_is_available© rI   úi/home/ncw/WWW/www-new/content/articles/pi-bbp/venv/lib/python3.10/site-packages/numba/cuda/device_init.pyrG   ,   s   
ÿrG   c                   C   s   t  ¡ S )a  Returns True if the CUDA Runtime is a supported version.

    Unsupported versions (e.g. newer versions than those known to Numba)
    may still work; this function provides a facility to check whether the
    current Numba version is tested and known to work with the current
    runtime version. If the current version is unsupported, the caller can
    decide how to act. Options include:

    - Continuing silently,
    - Emitting a warning,
    - Generating an error or otherwise preventing the use of CUDA.
    )r2   Úis_supported_versionrI   rI   rI   rJ   rK   ?   s   rK   c                   C   s   t j jS )z§Returns None if there was no error initializing the CUDA driver.
    If there was an error initializing the driver, a string describing the
    error is returned.
    )rF   Úinitialization_errorrI   rI   rI   rJ   Ú
cuda_errorP   s   rM   )\ÚsysÚstubsr   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   Ú
intrinsicsr"   r#   r$   r%   r&   r'   Úcudadrv.errorr(   Únumba.cuda.cudadrv.driverr)   r*   r+   r,   r-   r.   r/   r0   r1   Únumba.cuda.cudadrv.runtimer2   Úcudadrvr3   Ú
numba.cudar4   Úerrorsr5   Ú
decoratorsr6   r7   Úapir9   Úargsr:   r;   r<   Úintrinsic_wrapperr=   r>   r?   r@   rA   rB   rC   rD   ÚkernelsrE   ÚReduceÚreduceÚvector_type_stubÚsetattrÚmodulesÚ__name__ÚaliasesÚaliasrG   rK   rM   Úinitialize_allrI   rI   rI   rJ   Ú<module>   s4   „ ,(

ÿ