holoscan::gxf::GXFExecutionContext
holoscan::gxf::GXFExecutionContext
Class to hold the execution context for GXF Operator.
This class provides the execution context for the operator using GXF.
Inherits from: holoscan::ExecutionContext (public)
Constructors
GXFExecutionContext
Default
Construct a new GXFExecutionContext object (with op)
Construct a new GXFExecutionContext object (with gxf input context and gxf output context)
Destructor
~GXFExecutionContext
Methods
gxf_input
Get the GXF input context.
Returns: The pointer to the GXFInputContext object.
gxf_output
Get the GXF output context.
Returns: The pointer to the GXFOutputContext object.
allocate_cuda_stream
allocate a new GXF CudaStream object and return the cudaStream_t corresponding to it
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.
stream_handle_from_stream
Return the CudaStreamHandle corresponding to a given cudaStream_t.
This will only work with a cudaStream_t that was allocated as a CudaStream object by GXF. The stream should correspond to a CudaStreamId that was received on one of the Operator’s input ports or a stream that was allocated via allocate_cuda_stream.
Returns: The GXF CudaStream handle if found, or unexpected if not found.
Parameters
A CUDA stream object.
cuda_object_handler
init_cuda_object_handler
initialize the CudaObjectHandler for the Operator
release_internal_cuda_streams
release any internal stream objects allocated by the operator
clear_received_streams
clear the handler’s received stream mappings from a prior Operator::compute call.
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_handle
allocate a new GXF CudaStream object and return the GXF Handle to it
get_operator_eid
get the GXF entity ID of the operator