For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
  • Introduction
    • Overview
    • Relevant Technologies
    • Getting Started
  • Setup
    • SDK Installation
    • Additional Setup
    • Third Party Hardware Setup
  • Using the SDK
    • Holoscan Core
    • GPU Resident Execution
    • Holoscan by Example
      • Hello World
      • Ping Simple
      • Ping Custom Op
      • Ping Multi Port
      • Video Replayer
      • Video Replayer Distributed
      • BYOM
      • Custom CUDA Kernel Sample
    • Create an Application
    • Create a Distributed Application
    • Create an Operator
    • Create an Operator via Decorator
    • Create a Condition
    • Dynamic Flow Control
    • CUDA Stream Handling
    • Logging
    • Data Logging
    • Debugging
    • Python Operator Bindings
  • Operators
    • Operators and Extensions
    • Visualization
    • Inference
    • Testing
    • Video I/O Vendor Implementation Guide
  • Components
    • Schedulers
    • Conditions
    • Resources
    • Analytics
  • AI Skills
    • Ai Skills
  • API reference
  • Performance
    • Performance Considerations
    • Flow Tracking
    • GXF Job Statistics
    • Nsight Profiling
  • HoloHub
    • HoloHub Overview
  • FAQ
    • FAQ
NVIDIANVIDIA
Developer-friendly docs for your API
Privacy Policy | Your Privacy Choices | Terms of Service | Accessibility | Corporate Policies | Product Security | Contact

Copyright © 2026, NVIDIA Corporation.

LogoLogoDocumentation
On this page
  • Operators and Workflow
  • Connecting Operators
  • Running the Application
Using the SDKHoloscan by Example

Ping Simple

||View as Markdown|
Previous

Hello World

Next

Ping Custom Op

Most applications will require more than one operator. In this example, we will create two operators where one operator will produce and send data while the other operator will receive and print the data. The code in this example makes use of the built-in PingTxOp and PingRxOp operators that are defined in the holoscan::ops namespace.

In this example we’ll cover:

  • How to use built-in operators.
  • How to use add_flow() to connect operators together.

The example source code and run instructions can be found in the examples directory on GitHub, or under /opt/nvidia/holoscan/examples in the NGC container and the Debian package, alongside their executables.

Operators and Workflow

Here is an example workflow involving two operators that are connected linearly.

A linear workflow

In this example, the source operator PingTxOp produces integers from 1 to 10 and passes it to the sink operator PingRxOp which prints the integers to standard output.

Connecting Operators

We can connect two operators by calling add_flow() (C++ (holoscan::Fragment::add_flow)/Python (holoscan.core.Fragment.add_flow)) in the application’s compose() method.

The add_flow() method (C++ (holoscan::Fragment::add_flow)/Python (holoscan.core.Fragment.add_flow)) takes the source operator, the destination operator, and the optional port name pairs. The port name pair is used to connect the output port of the source operator to the input port of the destination operator. The first element of the pair is the output port name of the upstream operator and the second element is the input port name of the downstream operator. An empty port name ("") can be used for specifying a port name if the operator has only one input/output port. If there is only one output port in the upstream operator and only one input port in the downstream operator, the port pairs can be omitted.

The following code shows how to define a linear workflow in the compose() method for our example. Note that when an operator appears in an add_flow() statement, it doesn’t need to be added into the workflow separately using add_operator().

C++
Python
1 #include <holoscan/holoscan.hpp>
2 #include <holoscan/operators/ping_tx/ping_tx.hpp>
3 #include <holoscan/operators/ping_rx/ping_rx.hpp>
4  
5 class MyPingApp : public holoscan::Application {
6 public:
7 void compose() override {
8 using namespace holoscan;
9 // Create the tx and rx operators
10 auto tx = make_operator&lt;ops::PingTxOp&gt;("tx", make_condition<CountCondition>(10));
11 auto rx = make_operator&lt;ops::PingRxOp&gt;("rx");
12  
13 // Connect the operators into the workflow: tx -> rx
14 add_flow(tx, rx);
15 }
16 };
17  
18 int main(int argc, char** argv) {
19 auto app = holoscan::make_application<MyPingApp>();
20 app->run();
21  
22 return 0;
23 }
  • The header files that define PingTxOp and PingRxOp are included on lines 2 and 3 respectively.
  • We create an instance of the PingTxOp using the make_operator() function (line 10) with the name “tx” and constrain its compute() method to execute 10 times.
  • We create an instance of the PingRxOp using the make_operator() function (line 11) with the name “rx.”
  • The tx and rx operators are connected using add_flow() (line 14).

Running the Application

Running the application should give you the following output in your terminal:

Rx message value: 1
Rx message value: 2
Rx message value: 3
Rx message value: 4
Rx message value: 5
Rx message value: 6
Rx message value: 7
Rx message value: 8
Rx message value: 9
Rx message value: 10