Skip to content

PY-NUMB0007 · device_wide_numba_synchronization_in_stream_scope

Count device-wide Numba synchronization in modules that create streams.

This is a deterministic rule for python. Read its implementation.

Report cuda.synchronize() in a module that creates a Numba CUDA stream. The call waits for all work on the device, including independent work on other streams. Synchronize the stream or an event that represents the actual dependency instead.

Each finding identifies the device-wide wait. The value is the number of global Numba waits in modules that otherwise use streams.

An explicit benchmark boundary or process shutdown may need a device-wide wait. Retain such a call only with a project waiver that states the measured boundary.

stream = cuda.stream()
cuda.synchronize()
stream = cuda.stream()
stream.synchronize()
  • Cites “Numba CUDA documentation”, CUDA Kernel API and synchronization. Open reference
  • Cites “CUDA C++ Programming Guide”, explicit synchronization. Open reference