Class GXFExecutor

Holoscan v0.5.1
class GXFExecutor : public holoscan::Executor

Executor for GXF.

Public Functions

GXFExecutor() = delete

explicit GXFExecutor(holoscan::Fragment *app, bool create_gxf_context = true)

~GXFExecutor() override

virtual void run(Graph &graph) override

Initialize the graph and run the graph.

This method calls compose() to compose the graph, and runs the graph.

virtual void context(void *context) override

Set the context.

For GXF, GXFExtensionManager(gxf_extension_manager_) is initialized with the context.

Parameters

context – The context.

virtual std::shared_ptr<ExtensionManager> extension_manager() override

Get GXF extension manager.

Returns

The GXF extension manager.

inline void op_eid(gxf_uid_t eid)

Set the GXF entity ID of the operator initialized by this executor.

If this is 0, a new entity is created for the operator. Otherwise, the operator as a codelet will be added to the existing entity specified by this ID. This is useful when initializing operators inside the existing entity. (e.g., when initializing an operator from holoscan::gxf::OperatorWrapper class)

Parameters

eid – The GXF entity ID.

inline void op_cid(gxf_uid_t cid)

Set the GXF component ID of the operator initialized by this executor.

If this is 0, a new component is created for the operator. This is useful when initializing operators using the existing component inside the existing entity. (e.g., when initializing an operator from holoscan::gxf::OperatorWrapper class)

Parameters

cid – The GXF component ID.

inline virtual void context(void *context)

Set the context.

Parameters

context – The context.

inline void *context()

Get the context.

Returns

The context.

Public Static Functions

static void create_input_port(Fragment *fragment, gxf_context_t gxf_context, gxf_uid_t eid, IOSpec *io_spec, bool bind_port = false)

Create and setup GXF components for input port.

For a given input port specification, create a GXF Receiver component for the port and create a GXF SchedulingTerm component that is corresponding to the Condition of the port.

If there is no condition specified for the port, a default condition (MessageAvailableCondition) is created. It currently supports ConditionType::kMessageAvailable and ConditionType::kNone condition types.

This function is a static function so that it can be called from other classes without dependency on this class.

Parameters
  • fragment – The fragment that this operator belongs to.

  • gxf_context – The GXF context.

  • eid – The GXF entity ID.

  • io_spec – The input port specification.

  • bind_port – If true, bind the port to the existing GXF Receiver component. Otherwise, create a new GXF Receiver component.

static void create_output_port(Fragment *fragment, gxf_context_t gxf_context, gxf_uid_t eid, IOSpec *io_spec, bool bind_port = false)

Create and setup GXF components for output port.

For a given output port specification, create a GXF Receiver component for the port and create a GXF SchedulingTerm component that is corresponding to the Condition of the port.

If there is no condition specified for the port, a default condition (DownstreamMessageAffordableCondition) is created. It currently supports ConditionType::kDownstreamMessageAffordable and ConditionType::kNone condition types.

This function is a static function so that it can be called from other classes without dependency on on this class.

Parameters
  • fragment – The fragment that this operator belongs to.

  • gxf_context – The GXF context.

  • eid – The GXF entity ID.

  • io_spec – The output port specification.

  • bind_port – If true, bind the port to the existing GXF Transmitter component. Otherwise, create a new GXF Transmitter component.

Protected Functions

virtual bool initialize_operator(Operator *op) override

Initialize the given operator.

This method is called by Operator::initialize() to initialize the operator.

Depending on the type of the operator, this method may be overridden to initialize the operator. For example, the default executor (GXFExecutor) initializes the operator using the GXF API and sets the operator’s ID to the ID of the GXF codelet.

Parameters

op – The pointer to the operator.

Returns

true if the operator is initialized successfully. Otherwise, false.

virtual bool add_receivers(const std::shared_ptr<Operator> &op, const std::string &receivers_name, std::set<std::string, std::less<>> &input_labels, std::vector<holoscan::IOSpec*> &iospec_vector) override

Add the receivers as input ports of the given operator.

This method is to be called by the Fragment::add_flow() method to support for the case where the destination input port label points to the parameter name of the downstream operator, and the parameter type is ‘std::vector<holoscan::IOSpec*>’. This finds a parameter with with ‘std::vector<holoscan::IOSpec*>’ type and create a new input port with a specific label (‘<parameter name>:<index>’. e.g, ‘receivers:0’).

Parameters
  • op – The reference to the shared pointer of the operator.

  • receivers_name – The name of the receivers whose parameter type is ‘std::vector<holoscan::IOSpec*>’.

  • input_labels – The reference to the set of input port labels of the operator.

  • iospec_vector – The reference to the vector of IOSpec pointers.

Returns

true if the receivers are added successfully. Otherwise, false.

© Copyright 2022-2023, NVIDIA. Last updated on Jul 28, 2023.