Skip to main content

cuThreadExchangeStreamCaptureMode

Function cuThreadExchangeStreamCaptureMode 

Source
pub unsafe extern "C" fn cuThreadExchangeStreamCaptureMode(
    mode: *mut CUstreamCaptureMode,
) -> CUresult
Expand description

Swaps the stream capture interaction mode for a thread.

Sets the calling thread’s stream capture interaction mode to the value contained in *mode, and overwrites *mode with the previous mode for the thread. To facilitate deterministic behavior across function or module boundaries, callers are encouraged to use this API in a push-pop fashion:

During stream capture (see cuStreamBeginCapture), some actions, such as a call to ::cudaMalloc, may be unsafe. In the case of ::cudaMalloc, the operation is not enqueued asynchronously to a stream, and is not observed by stream capture. Therefore, if the sequence of operations captured via cuStreamBeginCapture depended on the allocation being replayed whenever the graph is launched, the captured graph would be invalid.

Therefore, stream capture places restrictions on API calls that can be made within or concurrently to a cuStreamBeginCapture-cuStreamEndCapture sequence. This behavior can be controlled via this API and flags to cuStreamBeginCapture.

A thread’s mode is one of the following.

§Parameters

  • mode: - Pointer to mode value to swap with the current mode