tf::cudaStream
cudaObject< cudaStream_t, cudaStreamCreator, cudaStreamDeleter >
taskflow/cuda/cuda_stream.hpp
tf::cudaStream::cudaStream
(cudaStream_t stream)
cudaStream
tf::cudaStream::cudaStream
cudaStream_t stream

constructs an RAII-styled object from the given CUDA stream

Constructs a cudaStream object which owns `stream`.

tf::cudaStream::cudaStream
()=default
cudaStream
tf::cudaStream::cudaStream

default constructor

void void tf::cudaStream::synchronize () const synchronize tf::cudaStream::synchronize

synchronizes the associated stream

Equivalently calling `cudaStreamSynchronize` to block until this stream has completed all operations.

void void tf::cudaStream::begin_capture (cudaStreamCaptureMode m=cudaStreamCaptureModeGlobal) const begin_capture tf::cudaStream::begin_capture cudaStreamCaptureMode m cudaStreamCaptureModeGlobal

begins graph capturing on the stream

When a stream is in capture mode, all operations pushed into the stream will not be executed, but will instead be captured into a graph, which will be returned via cudaStream::end_capture.

A thread's mode can be one of the following:

- `cudaStreamCaptureModeGlobal:` This is the default mode. If the local thread has an ongoing capture sequence that was not initiated with `cudaStreamCaptureModeRelaxed` at `cuStreamBeginCapture`, or if any other thread has a concurrent capture sequence initiated with `cudaStreamCaptureModeGlobal`, this thread is prohibited from potentially unsafe API calls.

- `cudaStreamCaptureModeThreadLocal:` If the local thread has an ongoing capture sequence not initiated with `cudaStreamCaptureModeRelaxed`, it is prohibited from potentially unsafe API calls. Concurrent capture sequences in other threads are ignored.

- `cudaStreamCaptureModeRelaxed:` The local thread is not prohibited from potentially unsafe API calls. Note that the thread is still prohibited from API calls which necessarily conflict with stream capture, for example, attempting `cudaEventQuery` on an event that was last recorded inside a capture sequence.

cudaGraph_t cudaGraph_t tf::cudaStream::end_capture () const end_capture tf::cudaStream::end_capture

ends graph capturing on the stream

Equivalently calling `cudaStreamEndCapture` to end capture on stream and returning the captured graph. Capture must have been initiated on stream via a call to cudaStream::begin_capture. If capture was invalidated, due to a violation of the rules of stream capture, then a NULL graph will be returned.

void void tf::cudaStream::record (cudaEvent_t event) const record tf::cudaStream::record cudaEvent_t event

records an event on the stream

Equivalently calling `cudaEventRecord` to record an event on this stream, both of which must be on the same CUDA context.

void void tf::cudaStream::wait (cudaEvent_t event) const wait tf::cudaStream::wait cudaEvent_t event

waits on an event

Equivalently calling `cudaStreamWaitEvent` to make all future work submitted to stream wait for all work captured in event.

class to create an RAII-styled wrapper over a native CUDA stream

A cudaStream object is an RAII-styled wrapper over a native CUDA stream (`cudaStream_t`). A cudaStream object is move-only.

cudaObject< cudaStream_t, cudaStreamCreator, cudaStreamDeleter >
tf::cudaStream
cudaObject< cudaStream_t, cudaStreamCreator, cudaStreamDeleter >
tf::cudaStream
- tf::cudaStream
  begin_capture
- tf::cudaStream
  cudaStream
- tf::cudaStream
  cudaStream
- tf::cudaStream
  end_capture
- tf::cudaStream
  record
- tf::cudaStream
  synchronize
- tf::cudaStream
  wait