PY-NUMB0001 · kernel_return_value
Count explicit values returned from Numba CUDA kernels.
This is a deterministic rule for python. Read its implementation.
Definition
Section titled “Definition”Report a return statement with a value inside a module function compiled by cuda.jit as a
kernel. CUDA kernels cannot return values to their host caller. Results must be written through
an array or device buffer passed to the kernel.
Evidence
Section titled “Evidence”Each finding identifies the returning statement and its kernel. The value is the number of explicit return values in the kernel.
Exceptions
Section titled “Exceptions”A bare return is accepted because it only stops the current thread. A function compiled with
device=True is also accepted because device functions may return values.
Examples
Section titled “Examples”@cuda.jitdef total(values): return values[cuda.grid(1)]@cuda.jitdef total(values, output): output[cuda.grid(1)] = values[cuda.grid(1)]References
Section titled “References”- Cites “Numba CUDA documentation”, writing CUDA kernels and kernel declaration. Open reference