PY-NUMB0005 · synchronous_transfer_in_numba_stream_scope
Count synchronous Numba transfers in modules that create streams.
This is a deterministic rule for python. Read its implementation.
Definition
Section titled “Definition”Report to_device, copy_to_device, or copy_to_host without an explicit stream in a module
that creates a Numba CUDA stream. The default transfer is synchronous and drains the overlap
the stream was introduced to provide.
Evidence
Section titled “Evidence”Each finding identifies the transfer call. The value is the number of synchronous transfers in modules that otherwise use streams.
Exceptions
Section titled “Exceptions”A module with no stream is left alone. A transfer with a stream keyword or a second
positional argument is accepted. Setup and final result copies outside a hot path may be
waived with measured evidence.
Examples
Section titled “Examples”stream = cuda.stream()device = cuda.to_device(host)stream = cuda.stream()device = cuda.to_device(host, stream=stream)References
Section titled “References”- Cites “Numba CUDA documentation”, memory management and stream-ordered transfers. Open reference
- Cites “CUDA C++ Best Practices Guide”, asynchronous transfers and overlapping. Open reference