holoscan::ExecutionContext
holoscan::ExecutionContext
Class to hold the execution context.
This class provides the execution context for the operator.
Constructors
ExecutionContext
Construct a new Execution Context object.
Destructor
~ExecutionContext
Methods
input
Get the input context.
Returns: The shared pointer to the input context.
output
Get the output context.
Returns: The shared pointer to the output context.
context
Get the context.
Returns: The pointer to the context.
allocate_cuda_stream
Allocate a CUDA stream from the operator’s CudaStreamPool.
Streams are cached by name — calling with the same name returns the same stream on subsequent calls within the same operator. This is useful for root operators that need to allocate a stream (rather than receiving one from upstream).
Streams allocated this way are not automatically emitted on output ports. Call OutputContext::set_cuda_stream() before emit() if you need to propagate the stream.
Returns: The allocated cudaStream_t, or an error if no CudaStreamPool is available.
Parameters
A name for the stream. The same name returns the same stream on subsequent calls. Defaults to an empty string.
synchronize_streams
Synchronize multiple CUDA streams to a target stream (non-blocking).
Uses cudaEventRecord and cudaStreamWaitEvent to create GPU-side dependencies without blocking the CPU. This is the same mechanism used internally by receive_cuda_stream.
When using receive_cuda_stream, synchronization is handled automatically and this method is not needed. It is provided for advanced manual stream handling use cases.
Parameters
Vector of streams to synchronize. std::nullopt elements are skipped.
The stream that will wait for all other streams to complete.
device_from_stream
Get the CUDA device ID for a given stream.
Only works with Holoscan-managed streams (those returned by receive_cuda_stream, receive_cuda_streams, or allocate_cuda_stream).
Returns: The device ID, or an error if the stream is not managed by Holoscan.
Parameters
The CUDA stream to query.
is_gpu_available
check if GPU capability is present on the system
find_operator
Find an operator by name.
If the operator name is not provided, the current operator is returned.
Returns: A shared pointer to the operator or nullptr if the operator is not found.
Parameters
The name of the operator.
get_operator_status
Get the status of the operator.
If the operator name is not provided, the status of the current operator is returned.
Returns: The status of the operator or an error if the operator is not found.
Parameters
The name of the operator.