Skip to content

PY-CUDA0003 · device_wide_synchronization_in_stream_scope

Count device-wide synchronization where a Python CUDA module uses streams.

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

Report cudaDeviceSynchronize or cuCtxSynchronize in a module that creates a CUDA stream. Device-wide synchronization waits for unrelated work on every stream. Prefer stream or event synchronization that states the dependency actually required.

Each finding identifies the global synchronization call. The value is the number of global waits in stream-using modules.

Process shutdown and explicit benchmark barriers may require a device-wide wait. Those call sites should retain measured intent in a project waiver rather than making global waits the default coordination primitive.

stream = device.create_stream()
runtime.cudaDeviceSynchronize()
stream = device.create_stream()
stream.sync()
  • Cites “cuda.bindings documentation”, runtime execution control. Open reference
  • Cites “cuda.core documentation”, streams and event management. Open reference