From 7cfd030f7aade9b8465b2b06886e3b1eeaa8ebbf Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Mon, 24 Feb 2025 13:11:02 -0800 Subject: [PATCH 1/6] Update instructions for DDS Video Signed-off-by: Victor Chang --- .gitignore | 2 + applications/dds_video/Dockerfile | 92 ++++++++++++++++++++++++++++ applications/dds_video/README.md | 15 ++++- applications/dds_video/bootstrap.sh | 7 +++ applications/dds_video/metadata.json | 17 +++-- 5 files changed, 126 insertions(+), 7 deletions(-) create mode 100644 applications/dds_video/Dockerfile create mode 100755 applications/dds_video/bootstrap.sh diff --git a/.gitignore b/.gitignore index cca4f7101..5779eea2c 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,5 @@ ngc-cli/ .local/ tmp/ +# Licenses +rti_license.dat \ No newline at end of file diff --git a/applications/dds_video/Dockerfile b/applications/dds_video/Dockerfile new file mode 100644 index 000000000..db9cf47f1 --- /dev/null +++ b/applications/dds_video/Dockerfile @@ -0,0 +1,92 @@ +# syntax=docker/dockerfile:1 + +# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ARG BASE_IMAGE +ARG GPU_TYPE + +############################################################ +# Base image +############################################################ + +ARG BASE_IMAGE +ARG GPU_TYPE + +FROM ${BASE_IMAGE} AS base + +ARG DEBIAN_FRONTEND=noninteractive + +# -------------------------------------------------------------------------- +# +# Holohub run setup +# + +RUN mkdir -p /tmp/scripts +COPY run /tmp/scripts/ +RUN mkdir -p /tmp/scripts/utilities +COPY utilities/holohub_autocomplete /tmp/scripts/utilities/ +RUN chmod +x /tmp/scripts/run +RUN /tmp/scripts/run setup + +# Enable autocomplete +RUN echo ". /etc/bash_completion.d/holohub_autocomplete" >> /etc/bash.bashrc + +# - This variable is consumed by all dependencies below as an environment variable (CMake 3.22+) +# - We use ARG to only set it at docker build time, so it does not affect cmake builds +# performed at docker run time in case users want to use a different BUILD_TYPE +ARG CMAKE_BUILD_TYPE=Release + +# Qcap dependency +RUN apt update \ + && apt install --no-install-recommends -y \ + libgstreamer1.0-0 \ + libgstreamer-plugins-base1.0-0 \ + libgles2 \ + libopengl0 + +# For benchmarking +RUN apt update \ + && apt install --no-install-recommends -y \ + libcairo2-dev \ + libgirepository1.0-dev \ + gobject-introspection \ + libgtk-3-dev \ + libcanberra-gtk-module \ + graphviz\ + ninja-build + +RUN pip install meson + +RUN if ! grep -q "VERSION_ID=\"22.04\"" /etc/os-release; then \ + pip install setuptools; \ + fi +COPY benchmarks/holoscan_flow_benchmarking/requirements.txt /tmp/benchmarking_requirements.txt +RUN pip install -r /tmp/benchmarking_requirements.txt + +# For RTI Connext DDS +RUN apt update \ + && apt install --no-install-recommends -y \ + openjdk-21-jre +RUN echo 'export JREHOME=$(readlink /etc/alternatives/java | sed -e "s/\/bin\/java//")' >> /etc/bash.bashrc + +# Set default Holohub data directory +ENV HOLOSCAN_INPUT_PATH=/workspace/holohub/data + +COPY rti_license.dat /opt/rti.com/rti_license.dat + +COPY applications/dds_video/bootstrap.sh /opt/rti.com/boostrap.sh + +ENTRYPOINT ["/bin/bash", "-c", "/opt/rti.com/boostrap.sh"] \ No newline at end of file diff --git a/applications/dds_video/README.md b/applications/dds_video/README.md index 3e46d978f..446ff92ab 100644 --- a/applications/dds_video/README.md +++ b/applications/dds_video/README.md @@ -32,7 +32,7 @@ up to, and including, step 5 (Installing Java and setting JREHOME). To build the application, the `RTI_CONNEXT_DDS_DIR` CMake variable must point to the installation path for RTI Connext. This can be done automatically by setting the `NDDSHOME` environment variable to the RTI Connext installation directory -(such as when using the RTI `setenv` scripts), or manually at build time, e.g.: +(such as when using the RTI `rtienv` scripts), or manually at build time, e.g.: ```sh $ ./run build dds_video --configure-args -DRTI_CONNEXT_DDS_DIR=~/rti/rti_connext_dds-7.3.0 @@ -45,10 +45,19 @@ install RTI Connext into a development container. Instead, Connext should be installed onto the host as above and then the development container can be launched with the RTI Connext folder mounted at runtime. To do so, ensure that the `NDDSHOME` and `CONNEXTDDS_ARCH` environment variables are set (which can be -done using the RTI `setenv` script) and use the following: +done using the RTI `rtienv` script) and use the following: ```sh -./dev_container launch --docker_opts "-v $NDDSHOME:/opt/dds -e NDDSHOME=/opt/dds -e CONNEXTDDS_ARCH=$CONNEXTDDS_ARCH" +# 1. Copy the RTI Connext DDS license file to the root of the Holohub repository +cp [path/to/rti_license.dat] ./rti_license.dat +# 2. Build the container +./dev_container build --docker_file applications/dds_video/Dockerfile +# 3. Configure RTI Environment +eval $(rtienv -l rti_license.dat) +# 4. Launch the container +./dev_container launch --docker_opts "-v /usr/bin:/host/bin -v $NDDSHOME:/opt/rti.com/rti_connext_dds-7.3.0/" +# 5. Build the application +./run build dds_video ``` ## Running the Application diff --git a/applications/dds_video/bootstrap.sh b/applications/dds_video/bootstrap.sh new file mode 100755 index 000000000..18a2862b7 --- /dev/null +++ b/applications/dds_video/bootstrap.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +/host/bin/rtienv-7.3.0 -l /opt/rti.com/rti_license.dat >> /tmp/rtienv.sh +chmod +x /tmp/rtienv.sh + +source /tmp/rtienv.sh +exec /bin/bash \ No newline at end of file diff --git a/applications/dds_video/metadata.json b/applications/dds_video/metadata.json index e15595e55..65fe69569 100644 --- a/applications/dds_video/metadata.json +++ b/applications/dds_video/metadata.json @@ -7,19 +7,28 @@ "affiliation": "NVIDIA" } ], - "language": "C++", + "language": "C++", "version": "1.0", "changelog": { "1.0": "Initial Release" }, + "dockerfile": "applications/dds_video/Dockerfile", "holoscan_sdk": { "minimum_required_version": "2.0.0", "tested_versions": [ "2.0.0" ] }, - "platforms": ["amd64", "arm64"], - "tags": ["DDS", "RTI Connext", "Video", "Shapes"], + "platforms": [ + "amd64", + "arm64" + ], + "tags": [ + "DDS", + "RTI Connext", + "Video", + "Shapes" + ], "ranking": 2, "dependencies": { "packages": [ @@ -37,4 +46,4 @@ "workdir": "holohub_app_bin" } } -} +} \ No newline at end of file From 8765ce7ecff4ba3df69df8e2fca289991a5b3e14 Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Mon, 24 Feb 2025 13:19:22 -0800 Subject: [PATCH 2/6] Fix typo Signed-off-by: Victor Chang --- applications/dds_video/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/dds_video/Dockerfile b/applications/dds_video/Dockerfile index db9cf47f1..74506ebc1 100644 --- a/applications/dds_video/Dockerfile +++ b/applications/dds_video/Dockerfile @@ -87,6 +87,6 @@ ENV HOLOSCAN_INPUT_PATH=/workspace/holohub/data COPY rti_license.dat /opt/rti.com/rti_license.dat -COPY applications/dds_video/bootstrap.sh /opt/rti.com/boostrap.sh +COPY applications/dds_video/bootstrap.sh /opt/rti.com/bootstrap.sh -ENTRYPOINT ["/bin/bash", "-c", "/opt/rti.com/boostrap.sh"] \ No newline at end of file +ENTRYPOINT ["/bin/bash", "-c", "/opt/rti.com/bootstrap.sh"] \ No newline at end of file From 6e4e9e1bec7908b2667302d6cca26f7f23f164dd Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Mon, 24 Feb 2025 13:27:01 -0800 Subject: [PATCH 3/6] Move dds_video into dds subdirectory Signed-off-by: Victor Chang --- applications/CMakeLists.txt | 5 +--- applications/dds/CMakeLists.txt | 23 ++++++++++++++++++ .../{ => dds}/dds_video/CMakeLists.txt | 0 applications/{ => dds}/dds_video/Dockerfile | 2 +- applications/{ => dds}/dds_video/README.md | 0 applications/{ => dds}/dds_video/bootstrap.sh | 0 .../{ => dds}/dds_video/dds_video.cpp | 0 .../dds_video/docs/workflow_dds_video_app.png | Bin .../{ => dds}/dds_video/metadata.json | 0 .../{ => dds}/dds_video/qos_profiles.xml | 0 .../dds_video/set_socket_buffer_sizes.sh | 0 11 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 applications/dds/CMakeLists.txt rename applications/{ => dds}/dds_video/CMakeLists.txt (100%) rename applications/{ => dds}/dds_video/Dockerfile (97%) rename applications/{ => dds}/dds_video/README.md (100%) rename applications/{ => dds}/dds_video/bootstrap.sh (100%) rename applications/{ => dds}/dds_video/dds_video.cpp (100%) rename applications/{ => dds}/dds_video/docs/workflow_dds_video_app.png (100%) rename applications/{ => dds}/dds_video/metadata.json (100%) rename applications/{ => dds}/dds_video/qos_profiles.xml (100%) rename applications/{ => dds}/dds_video/set_socket_buffer_sizes.sh (100%) diff --git a/applications/CMakeLists.txt b/applications/CMakeLists.txt index 1f36a3907..b6c3548f8 100644 --- a/applications/CMakeLists.txt +++ b/applications/CMakeLists.txt @@ -30,10 +30,7 @@ add_holohub_application(colonoscopy_segmentation DEPENDS OPERATORS aja_source) add_holohub_application(cvcuda_basic DEPENDS OPERATORS cvcuda_holoscan_interop) -add_holohub_application(dds_video DEPENDS - OPERATORS dds_shapes_subscriber - dds_video_publisher - dds_video_subscriber) +add_subdirectory(dds) add_holohub_application(deltacast_transmitter DEPENDS OPERATORS deltacast_videomaster diff --git a/applications/dds/CMakeLists.txt b/applications/dds/CMakeLists.txt new file mode 100644 index 000000000..70ddad607 --- /dev/null +++ b/applications/dds/CMakeLists.txt @@ -0,0 +1,23 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cmake_minimum_required(VERSION 3.20) +project(distributed_applications LANGUAGES NONE) + + +add_holohub_application(dds_video DEPENDS + OPERATORS dds_shapes_subscriber + dds_video_publisher + dds_video_subscriber) diff --git a/applications/dds_video/CMakeLists.txt b/applications/dds/dds_video/CMakeLists.txt similarity index 100% rename from applications/dds_video/CMakeLists.txt rename to applications/dds/dds_video/CMakeLists.txt diff --git a/applications/dds_video/Dockerfile b/applications/dds/dds_video/Dockerfile similarity index 97% rename from applications/dds_video/Dockerfile rename to applications/dds/dds_video/Dockerfile index 74506ebc1..88ed29bb6 100644 --- a/applications/dds_video/Dockerfile +++ b/applications/dds/dds_video/Dockerfile @@ -87,6 +87,6 @@ ENV HOLOSCAN_INPUT_PATH=/workspace/holohub/data COPY rti_license.dat /opt/rti.com/rti_license.dat -COPY applications/dds_video/bootstrap.sh /opt/rti.com/bootstrap.sh +COPY applications/dds/dds_video/bootstrap.sh /opt/rti.com/bootstrap.sh ENTRYPOINT ["/bin/bash", "-c", "/opt/rti.com/bootstrap.sh"] \ No newline at end of file diff --git a/applications/dds_video/README.md b/applications/dds/dds_video/README.md similarity index 100% rename from applications/dds_video/README.md rename to applications/dds/dds_video/README.md diff --git a/applications/dds_video/bootstrap.sh b/applications/dds/dds_video/bootstrap.sh similarity index 100% rename from applications/dds_video/bootstrap.sh rename to applications/dds/dds_video/bootstrap.sh diff --git a/applications/dds_video/dds_video.cpp b/applications/dds/dds_video/dds_video.cpp similarity index 100% rename from applications/dds_video/dds_video.cpp rename to applications/dds/dds_video/dds_video.cpp diff --git a/applications/dds_video/docs/workflow_dds_video_app.png b/applications/dds/dds_video/docs/workflow_dds_video_app.png similarity index 100% rename from applications/dds_video/docs/workflow_dds_video_app.png rename to applications/dds/dds_video/docs/workflow_dds_video_app.png diff --git a/applications/dds_video/metadata.json b/applications/dds/dds_video/metadata.json similarity index 100% rename from applications/dds_video/metadata.json rename to applications/dds/dds_video/metadata.json diff --git a/applications/dds_video/qos_profiles.xml b/applications/dds/dds_video/qos_profiles.xml similarity index 100% rename from applications/dds_video/qos_profiles.xml rename to applications/dds/dds_video/qos_profiles.xml diff --git a/applications/dds_video/set_socket_buffer_sizes.sh b/applications/dds/dds_video/set_socket_buffer_sizes.sh similarity index 100% rename from applications/dds_video/set_socket_buffer_sizes.sh rename to applications/dds/dds_video/set_socket_buffer_sizes.sh From dc152d6af7fc8fc4673441862ada685d0681069b Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Mon, 24 Feb 2025 13:39:45 -0800 Subject: [PATCH 4/6] Update app path Signed-off-by: Victor Chang --- applications/dds/dds_video/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/dds/dds_video/README.md b/applications/dds/dds_video/README.md index 446ff92ab..96da10d5b 100644 --- a/applications/dds/dds_video/README.md +++ b/applications/dds/dds_video/README.md @@ -51,7 +51,7 @@ done using the RTI `rtienv` script) and use the following: # 1. Copy the RTI Connext DDS license file to the root of the Holohub repository cp [path/to/rti_license.dat] ./rti_license.dat # 2. Build the container -./dev_container build --docker_file applications/dds_video/Dockerfile +./dev_container build --docker_file applications/dds/dds_video/Dockerfile # 3. Configure RTI Environment eval $(rtienv -l rti_license.dat) # 4. Launch the container From 0992f15d6b0f442ae873d6aab2c2386ef0003996 Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Mon, 24 Feb 2025 14:48:18 -0800 Subject: [PATCH 5/6] Update dockerfile path Signed-off-by: Victor Chang --- applications/dds/dds_video/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/dds/dds_video/metadata.json b/applications/dds/dds_video/metadata.json index 65fe69569..832ae9803 100644 --- a/applications/dds/dds_video/metadata.json +++ b/applications/dds/dds_video/metadata.json @@ -12,7 +12,7 @@ "changelog": { "1.0": "Initial Release" }, - "dockerfile": "applications/dds_video/Dockerfile", + "dockerfile": "applications/dds/dds_video/Dockerfile", "holoscan_sdk": { "minimum_required_version": "2.0.0", "tested_versions": [ From bf51a532523fc9ff8cb797746b742556b9a12524 Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Mon, 24 Feb 2025 17:11:10 -0800 Subject: [PATCH 6/6] Rewrite instructions with .run installer Signed-off-by: Victor Chang --- applications/dds/dds_video/Dockerfile | 7 ++-- applications/dds/dds_video/README.md | 45 ++++++++++++++++++------- applications/dds/dds_video/bootstrap.sh | 5 +-- dev_container | 2 +- 4 files changed, 38 insertions(+), 21 deletions(-) diff --git a/applications/dds/dds_video/Dockerfile b/applications/dds/dds_video/Dockerfile index 88ed29bb6..88ec3c2ba 100644 --- a/applications/dds/dds_video/Dockerfile +++ b/applications/dds/dds_video/Dockerfile @@ -85,8 +85,7 @@ RUN echo 'export JREHOME=$(readlink /etc/alternatives/java | sed -e "s/\/bin\/ja # Set default Holohub data directory ENV HOLOSCAN_INPUT_PATH=/workspace/holohub/data -COPY rti_license.dat /opt/rti.com/rti_license.dat +ENV NDDSHOME=/opt/rti.com/rti_connext_dds-7.3.0 +ENV RTI_CONNEXT_DDS_DIR=$NDDSHOME -COPY applications/dds/dds_video/bootstrap.sh /opt/rti.com/bootstrap.sh - -ENTRYPOINT ["/bin/bash", "-c", "/opt/rti.com/bootstrap.sh"] \ No newline at end of file +CMD ["/bin/bash", "-c", "source $NDDSHOME/resource/scripts/rtisetenv_x64Linux4gcc7.3.0.bash && exec /bin/bash"] \ No newline at end of file diff --git a/applications/dds/dds_video/README.md b/applications/dds/dds_video/README.md index 96da10d5b..abb402a43 100644 --- a/applications/dds/dds_video/README.md +++ b/applications/dds/dds_video/README.md @@ -21,10 +21,31 @@ Holoviz output. ![DDS Video Application Workflow](docs/workflow_dds_video_app.png) +## Prerequisites + +- This application requires [RTI Connext](https://content.rti.com/l/983311/2024-04-30/pz1wms) +be installed and configured with a valid RTI Connext license prior to use. +- V4L2 capable device + +> [!NOTE] +> Instructions below are based on the `.run' installer from RTI Connext. Refer to the +> [Linux installation](https://community.rti.com/static/documentation/developers/get-started/full-install.html) +> for details. + + +## Quick Start + +```bash +# Start the publisher +./dev_container build_and_run dds_video --container_args "-v $HOME/rti_connext_dds-7.3.0:/opt/rti.com/rti_connext_dds-7.3.0/" --run_args "-p" + +# Start the subscriber +./dev_container build_and_run dds_video --container_args "-v $HOME/rti_connext_dds-7.3.0:/opt/rti.com/rti_connext_dds-7.3.0/" --run_args "-s" +``` + + ## Building the Application -This application requires [RTI Connext](https://content.rti.com/l/983311/2024-04-30/pz1wms) -be installed and configured with a valid RTI Connext license prior to use. To build on an IGX devkit (using the `armv8` architecture), follow the [instructions to build Connext DDS applications for embedded Arm targets](https://community.rti.com/kb/how-do-i-create-connext-dds-application-rti-code-generator-and-build-it-my-embedded-target-arm) up to, and including, step 5 (Installing Java and setting JREHOME). @@ -32,7 +53,7 @@ up to, and including, step 5 (Installing Java and setting JREHOME). To build the application, the `RTI_CONNEXT_DDS_DIR` CMake variable must point to the installation path for RTI Connext. This can be done automatically by setting the `NDDSHOME` environment variable to the RTI Connext installation directory -(such as when using the RTI `rtienv` scripts), or manually at build time, e.g.: +(such as when using the RTI `setenv` scripts), or manually at build time, e.g.: ```sh $ ./run build dds_video --configure-args -DRTI_CONNEXT_DDS_DIR=~/rti/rti_connext_dds-7.3.0 @@ -45,21 +66,21 @@ install RTI Connext into a development container. Instead, Connext should be installed onto the host as above and then the development container can be launched with the RTI Connext folder mounted at runtime. To do so, ensure that the `NDDSHOME` and `CONNEXTDDS_ARCH` environment variables are set (which can be -done using the RTI `rtienv` script) and use the following: +done using the RTI `setenv` script) and use the following: ```sh -# 1. Copy the RTI Connext DDS license file to the root of the Holohub repository -cp [path/to/rti_license.dat] ./rti_license.dat -# 2. Build the container +# 1. Build the container ./dev_container build --docker_file applications/dds/dds_video/Dockerfile -# 3. Configure RTI Environment -eval $(rtienv -l rti_license.dat) -# 4. Launch the container -./dev_container launch --docker_opts "-v /usr/bin:/host/bin -v $NDDSHOME:/opt/rti.com/rti_connext_dds-7.3.0/" -# 5. Build the application +# 2. Launch the container +./dev_container launch --docker_opts "-v $HOME/rti_connext_dds-7.3.0:/opt/rti.com/rti_connext_dds-7.3.0/" +# 3. Build the application ./run build dds_video +# Continue to the next section to run the application with the publisher. +# Open a new terminal to repeat step #2 and launch a new container for the subscriber. ``` + + ## Running the Application Both a publisher and subscriber process must be launched to see the result of diff --git a/applications/dds/dds_video/bootstrap.sh b/applications/dds/dds_video/bootstrap.sh index 18a2862b7..c2dcdc251 100755 --- a/applications/dds/dds_video/bootstrap.sh +++ b/applications/dds/dds_video/bootstrap.sh @@ -1,7 +1,4 @@ #!/bin/bash -/host/bin/rtienv-7.3.0 -l /opt/rti.com/rti_license.dat >> /tmp/rtienv.sh -chmod +x /tmp/rtienv.sh - -source /tmp/rtienv.sh +source /opt/rti.com/rti_connext_dds-7.3.0/resource/scripts/rtisetenv_x64Linux4gcc7.3.0.bash exec /bin/bash \ No newline at end of file diff --git a/dev_container b/dev_container index b59a73bc2..29cee5501 100755 --- a/dev_container +++ b/dev_container @@ -919,7 +919,7 @@ build_and_run() { local app_language="" local container_build_args=() local container_launch_args="" - local docker_opts="--entrypoint=bash" + local docker_opts="--entrypoint=bash " local build_app=1 local image_name="" local docker_file=""