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.
Definition
Section titled “Definition”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.
Evidence
Section titled “Evidence”Each finding identifies the global synchronization call. The value is the number of global waits in stream-using modules.
Exceptions
Section titled “Exceptions”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.
Examples
Section titled “Examples”stream = device.create_stream()runtime.cudaDeviceSynchronize()stream = device.create_stream()stream.sync()References
Section titled “References”- Cites “cuda.bindings documentation”, runtime execution control. Open reference
- Cites “cuda.core documentation”, streams and event management. Open reference