pub struct StreamGraphCapture<'s> { /* private fields */ }Expand description
Driver-backed CUDA stream capture.
Where StreamCapture is a CPU-side recorder (it only logs operation
specifications), StreamGraphCapture drives the real
cuStreamBeginCapture_v2 / cuStreamEndCapture API. The caller begins
capture on a live Stream, submits ordinary GPU work to that stream
(kernel launches, async memset/memcpy) which the driver records instead of
executing, and end finalises the captured CUgraph into a
launchable GraphExec. Launching that exec replays the captured work.
Requires a driver with stream-capture support (CUDA 10.0+); otherwise
begin returns CudaError::NotSupported.
Implementations§
Source§impl<'s> StreamGraphCapture<'s>
impl<'s> StreamGraphCapture<'s>
Sourcepub fn begin(stream: &'s Stream, mode: CUstreamCaptureMode) -> CudaResult<Self>
pub fn begin(stream: &'s Stream, mode: CUstreamCaptureMode) -> CudaResult<Self>
Begins driver-backed capture on stream with the given capture mode
(e.g. CU_STREAM_CAPTURE_MODE_GLOBAL).
§Errors
CudaError::NotInitializedwhen no driver is loaded.CudaError::NotSupportedwhen the driver predates stream capture.- Any
CudaErrormapped fromcuStreamBeginCapture_v2.
Sourcepub fn capture_status(&self) -> CudaResult<CUstreamCaptureStatus>
pub fn capture_status(&self) -> CudaResult<CUstreamCaptureStatus>
Reports the driver’s capture status for the stream
(cuStreamIsCapturing).
§Errors
Propagates driver-load failures and any error from
cuStreamIsCapturing.
Sourcepub fn end(self) -> CudaResult<GraphExec>
pub fn end(self) -> CudaResult<GraphExec>
Ends capture and instantiates the captured CUgraph into a launchable
GraphExec.
The returned exec’s node_count reflects the
number of nodes the driver actually captured (queried via
cuGraphGetNodes), and launch replays the
captured work via cuGraphLaunch.
§Errors
Propagates driver-load failures and any error from cuStreamEndCapture
or graph instantiation. On instantiation failure the captured graph is
destroyed before returning so the driver object does not leak.