Inference Example
🚧 Documentation is under development
The Holoscan SDK guide is currently under active development. Some sections may be incomplete or change without notice.
Questions? Contact RidgeRun or email to support@ridgerun.com.
-
Overview
-
Build, Run, and Validate
-
Core Concepts
-
Operators and Graphs
-
Tensor Data and Memory
-
Interprocess Communication
-
-
Application and Operator Development
- Building an HSDK Application
- Writing a Minimal Operator
- Typed Parameters and Configuration
- Reading, Writing, and Forwarding Data
- Writing Tensor Operators
- Complete Operator Patterns
- Authoring Runtime Behavior
- Runtime Parameter Updates
- Lifecycle Callbacks and Restart Control
- Performance and Debugging
- SDK Source Map
-
Operator Reference
-
Core Operators
-
Holoscan Camera
-
Holoscan RidgeRun
- Overview
- Build and Installation
- ArgusCameraOp
- V4L2SourceOp
- V4L2UserPtrSourceOp
- BgraToPlanarTensorOp
- RawBayerToBgraOp
- RawBayerToYoloTensorOp
- YuyvToBgraOp
- TensorRtInferenceOp
- DrmDisplayOp
- DrmBgraDisplayOp
- X11DisplayOp
- CudaCompositorOp
- DepthColorizerOp
- FakesinkOp
- FrameSkipperOp
- InterprocessSrcOp
- TestPatternOp
-
-
Migration from Holoscan 4.x
-
Examples
-
Core
-
Holoscan Camera
-
Holoscan RidgeRun
-
-
Benchmark and Use Cases
-
Holoscan vs GStreamer
- Overview
-
Capture and Display
-
Capture and Inference
- Compare the workloads
- Implemented Applications
- Framework Selection
- Interprocess
-
Inference Example
Run a TensorRT model through InferenceOp using synthetic device Tensors. The example starts with one model, then provides configurations for independent models, chained models, concurrent dispatch, CUDA Graphs, context isolation, and dynamic input shapes.
The application is a compact way to understand the configuration boundary around inference. It does not require a camera or display, but it does require CUDA, TensorRT, enough GPU memory to build an engine, and a writable model cache.
What you will learn
- How a YAML file supplies model, input, and output configuration.
- How one inference operator can represent a single model or several model stages.
- How device residency and staging flags affect the Tensor path.
- How to treat concurrency and context requests as configuration choices that still need runtime evidence.
Build and run
Build the inference examples through the shared SDK build page. Then run the first configuration from the installed example directory:
WORKSPACE="$HOME/holoscan-5.0" cd "$WORKSPACE/holoscan-sdk" INSTALL_DIR="$(./run get_install_dir)" RUN_BIN="/workspace/holoscan-sdk/$INSTALL_DIR/lib/holoscan/examples/inference/cpp/holoinfer_example" CONFIG_DIR="/workspace/holoscan-sdk/$INSTALL_DIR/lib/holoscan/examples/inference/configs" ./run launch "$INSTALL_DIR" --run-cmd "$RUN_BIN --config $CONFIG_DIR/01_single_model.yaml --ticks 10"
The first run can take longer while TensorRT creates an engine cache.
Follow the workflow
Operators used
| Operator | Role in this example |
|---|---|
TensorFeeder
|
Creates the synthetic device Tensors used as model inputs. |
| InferenceOp | Loads the configured TensorRT model or model chain and produces inference outputs. |
TensorSink
|
Receives the inference outputs and reports the run summary. |
The YAML root is one inference parameter block. model_path_map names the model files, while input_map and output_map connect model names to Tensor names. The driver creates a feeder for the external inputs and a sink for the external outputs.
Use the configuration files as a set of focused variations:
| Configuration group | What it explores |
|---|---|
| Single and independent models | One model or several models with no internal handoff. |
| Chained models | One model's output Tensor becomes the next model's input inside the inference stage. |
| Concurrent models | Independent models request parallel dispatch and can also request CUDA Graphs. |
| Context-isolated models | Concurrent configurations request separate CUDA resource partitions when the device supports them. |
| Dynamic-shape models | The configuration enables the dynamic input path used by the bundled model. |
The supplied feeder uses device Tensors. The placement fields input_on_cuda, output_on_cuda, and transmit_on_cuda describe the internal input, internal output, and emitted output locations. Device residency does not by itself prove that an inference path has no copies; inspect the configured path and runtime evidence.
Expected result
A completed run prints a summary similar to:
Config: 01_single_model.yaml Summary: 10 ticks in ... ms
The timing values depend on the target and include application observation effects. They are not a TensorRT kernel benchmark. A requested Green Context or CUDA Graph path can be unavailable or fall back, so check initialization messages before interpreting a configuration as isolated or concurrent.