o
    Tæ«d¼  ã                   @   sN   d dl Z d dlmZ G dd„ deƒZG dd„ deƒZdZd e¡Zd	d
„ Z	dS )é    N)ÚLoweringErrorc                       s   e Zd Zd‡ fdd„	Z‡  ZS )ÚKernelRuntimeErrorNc                    s>   || _ || _|| _d}|| j | j| jf }tt| ƒ |¡ d S )Nz1An exception was raised in thread=%s block=%s
	%s)ÚtidÚctaidÚmsgÚsuperr   Ú__init__)Úselfr   r   r   Út©Ú	__class__© úd/home/ncw/WWW/www-new/content/articles/pi-bbp/venv/lib/python3.10/site-packages/numba/cuda/errors.pyr      s   zKernelRuntimeError.__init__)NN)Ú__name__Ú
__module__Ú__qualname__r   Ú__classcell__r   r   r   r   r      s    r   c                   @   s   e Zd ZdS )ÚCudaLoweringErrorN)r   r   r   r   r   r   r   r      s    r   zJhttps://numba.readthedocs.io/en/stable/cuda/kernels.html#kernel-invocationz›
Kernel launch configuration was not specified. Use the syntax:

kernel_function[blockspergrid, threadsperblock](arg0, arg1, ..., argn)

See {} for help.

c                 C   s8   dd„ }d| |fv rt tƒ‚|| dƒ} ||dƒ}| |fS )zE
    Normalize and validate the user-supplied kernel dimensions.
    c                 S   sŠ   t | ttfƒs| g} nt| ƒ} t| ƒdkrtd|| f ƒ‚| D ]}t |tjƒs/td|| f ƒ‚qt| ƒdk rA|  d¡ t| ƒdk s6t| ƒS )Né   z3%s must be a sequence of 1, 2 or 3 integers, got %rz)%s must be a sequence of integers, got %ré   )	Ú
isinstanceÚtupleÚlistÚlenÚ
ValueErrorÚnumbersÚIntegralÚ	TypeErrorÚappend)ÚdimÚnameÚvr   r   r   Ú	check_dim%   s"   ÿÿÿ
ÿz.normalize_kernel_dimensions.<locals>.check_dimNÚgriddimÚblockdim)r   Úmissing_launch_config_msg)r#   r$   r"   r   r   r   Únormalize_kernel_dimensions    s   

r&   )
r   Únumba.core.errorsr   ÚRuntimeErrorr   r   Ú_launch_help_urlÚformatr%   r&   r   r   r   r   Ú<module>   s    ù
