Class GXFExecutionContext
Defined in File gxf_execution_context.hpp
Base Type
public holoscan::ExecutionContext
(Class ExecutionContext)
-
class GXFExecutionContext : public holoscan::ExecutionContext
Class to hold the execution context for GXF Operator.
This class provides the execution context for the operator using GXF.
Public Functions
-
GXFExecutionContext(gxf_context_t context, Operator *op)
Construct a new GXFExecutionContext object.
- Parameters
context – The pointer to the GXF context.
op – The pointer to the operator.
Construct a new GXFExecutionContext object.
- Parameters
context – The pointer to the GXF context.
gxf_input_context – The shared pointer to the GXFInputContext object.
gxf_output_context – The shared pointer to the GXFOutputContext object.
-
~GXFExecutionContext() override = default
-
inline std::shared_ptr<GXFInputContext> gxf_input()
Get the GXF input context.
- Returns
The pointer to the GXFInputContext object.
-
inline std::shared_ptr<GXFOutputContext> gxf_output()
Get the GXF output context.
- Returns
The pointer to the GXFOutputContext object.
-
virtual expected<cudaStream_t, RuntimeError> allocate_cuda_stream(const std::string &stream_name) override
allocate a new GXF CudaStream object and return the cudaStream_t corresponding to it
-
virtual void synchronize_streams(const std::vector<std::optional<cudaStream_t>> &cuda_streams, cudaStream_t target_cuda_stream) override
synchronize all of the streams in cuda_streams with target_cuda_stream
-
virtual expected<int, RuntimeError> device_from_stream(cudaStream_t stream) override
determine the CUDA device corresponding to the given stream
-
expected<gxf::CudaStreamHandle, RuntimeError> stream_handle_from_stream(cudaStream_t 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
.- Parameters
stream_handle – A CUDA stream object.
- Returns
The GXF CudaStream handle if found, or unexpected if not found.
-
inline std::shared_ptr<CudaObjectHandler> cuda_object_handler()
-
void init_cuda_object_handler(Operator *op)
initialize the CudaObjectHandler for the Operator
-
void release_internal_cuda_streams()
release any internal stream objects allocated by the operator
-
void clear_received_streams()
clear the handler’s received stream mappings from a prior
Operator::compute
call.
Protected Functions
-
expected<CudaStreamHandle, RuntimeError> allocate_cuda_stream_handle(const std::string &stream_name)
allocate a new GXF CudaStream object and return the GXF Handle to it
Protected Attributes
-
std::shared_ptr<GXFInputContext> gxf_input_context_ = {}
The GXF input context.
-
std::shared_ptr<GXFOutputContext> gxf_output_context_ = {}
The GXF output context.
-
std::shared_ptr<CudaObjectHandler> cuda_object_handler_ = {}
Friends
- friend class holoscan::gxf::GXFWrapper
- friend class holoscan::gxf::GXFInputContext
- friend class holoscan::gxf::GXFOutputContext
-
GXFExecutionContext(gxf_context_t context, Operator *op)