Skip to content

PY-CUDA0001 · direct_cuda_core_lifecycle_construction

Count direct construction of CUDA core stream and context wrappers.

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

Report direct calls to cuda.core.Stream or cuda.core.Context. Their constructors are not a supported ownership boundary. Streams come from Device.create_stream, and contexts come from a device or stream that already owns the correct CUDA context.

Each finding identifies the direct constructor call. The value is the number of unsupported stream or context constructions.

Stream.from_handle is accepted because it explicitly borrows or wraps an existing stream. Device.create_stream is accepted because the device establishes ownership and context.

stream = Stream()
device = Device()
stream = device.create_stream()
  • Cites “cuda.core documentation”, Stream construction. Open reference
  • Cites “cuda.core documentation”, Context construction. Open reference