Skip to content

PY-CUDA0004 · blocking_raw_memory_operation_in_stream_scope

Count blocking raw CUDA memory operations in Python stream scopes.

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

Report synchronous allocation, copy, or free calls from cuda.bindings in a module that creates streams. Stream-ordered buffers and asynchronous copies retain concurrency and express ownership more safely through cuda.core.

Each finding identifies the raw blocking call. The value is the number of blocking memory operations in stream-using modules.

Initialization before any concurrent work and final teardown may be deliberate. A project can keep those isolated calls with measured evidence. Asynchronous raw APIs are accepted.

stream = device.create_stream()
runtime.cudaMemcpy(target, source, size, kind)
target.copy_from(source, stream=stream)
  • Cites “cuda.core documentation”, buffer copies and stream-ordered memory. Open reference
  • Cites “cuda.core documentation”, Buffer asynchronous release. Open reference