holoscan 2.6.0__cp312-cp312-manylinux_2_35_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. holoscan-2.6.0.data/purelib/holoscan/__init__.py +133 -0
  2. holoscan-2.6.0.data/purelib/holoscan/cli/__init__.py +32 -0
  3. holoscan-2.6.0.data/purelib/holoscan/cli/__main__.py +159 -0
  4. holoscan-2.6.0.data/purelib/holoscan/cli/common/argparse_types.py +153 -0
  5. holoscan-2.6.0.data/purelib/holoscan/cli/common/artifact_sources.py +149 -0
  6. holoscan-2.6.0.data/purelib/holoscan/cli/common/constants.py +119 -0
  7. holoscan-2.6.0.data/purelib/holoscan/cli/common/dockerutils.py +509 -0
  8. holoscan-2.6.0.data/purelib/holoscan/cli/common/enum_types.py +52 -0
  9. holoscan-2.6.0.data/purelib/holoscan/cli/common/exceptions.py +130 -0
  10. holoscan-2.6.0.data/purelib/holoscan/cli/common/sdk_utils.py +180 -0
  11. holoscan-2.6.0.data/purelib/holoscan/cli/common/utils.py +130 -0
  12. holoscan-2.6.0.data/purelib/holoscan/cli/logging.json +37 -0
  13. holoscan-2.6.0.data/purelib/holoscan/cli/nics/__init__.py +18 -0
  14. holoscan-2.6.0.data/purelib/holoscan/cli/nics/nics.py +34 -0
  15. holoscan-2.6.0.data/purelib/holoscan/cli/packager/__init__.py +18 -0
  16. holoscan-2.6.0.data/purelib/holoscan/cli/packager/arguments.py +137 -0
  17. holoscan-2.6.0.data/purelib/holoscan/cli/packager/config_reader.py +181 -0
  18. holoscan-2.6.0.data/purelib/holoscan/cli/packager/container_builder.py +368 -0
  19. holoscan-2.6.0.data/purelib/holoscan/cli/packager/manifest_files.py +220 -0
  20. holoscan-2.6.0.data/purelib/holoscan/cli/packager/models.py +93 -0
  21. holoscan-2.6.0.data/purelib/holoscan/cli/packager/package_command.py +189 -0
  22. holoscan-2.6.0.data/purelib/holoscan/cli/packager/packager.py +122 -0
  23. holoscan-2.6.0.data/purelib/holoscan/cli/packager/parameters.py +558 -0
  24. holoscan-2.6.0.data/purelib/holoscan/cli/packager/platforms.py +402 -0
  25. holoscan-2.6.0.data/purelib/holoscan/cli/packager/templates/Dockerfile.jinja2 +470 -0
  26. holoscan-2.6.0.data/purelib/holoscan/cli/packager/templates/dockerignore +93 -0
  27. holoscan-2.6.0.data/purelib/holoscan/cli/packager/templates/tools.sh +416 -0
  28. holoscan-2.6.0.data/purelib/holoscan/cli/py.typed +0 -0
  29. holoscan-2.6.0.data/purelib/holoscan/cli/runner/__init__.py +18 -0
  30. holoscan-2.6.0.data/purelib/holoscan/cli/runner/resources.py +174 -0
  31. holoscan-2.6.0.data/purelib/holoscan/cli/runner/run_command.py +203 -0
  32. holoscan-2.6.0.data/purelib/holoscan/cli/runner/runner.py +306 -0
  33. holoscan-2.6.0.data/purelib/holoscan/cli/version/__init__.py +18 -0
  34. holoscan-2.6.0.data/purelib/holoscan/cli/version/version.py +50 -0
  35. holoscan-2.6.0.data/purelib/holoscan/conditions/__init__.py +57 -0
  36. holoscan-2.6.0.data/purelib/holoscan/core/__init__.py +430 -0
  37. holoscan-2.6.0.data/purelib/holoscan/decorator.py +592 -0
  38. holoscan-2.6.0.data/purelib/holoscan/executors/__init__.py +26 -0
  39. holoscan-2.6.0.data/purelib/holoscan/graphs/__init__.py +32 -0
  40. holoscan-2.6.0.data/purelib/holoscan/gxf/__init__.py +57 -0
  41. holoscan-2.6.0.data/purelib/holoscan/lib/gxf_extensions/libgxf_holoscan_wrapper.so +0 -0
  42. holoscan-2.6.0.data/purelib/holoscan/lib/gxf_extensions/libgxf_holoscan_wrapper_lib.so +0 -0
  43. holoscan-2.6.0.data/purelib/holoscan/lib/gxf_extensions/libgxf_ucx_holoscan.so +0 -0
  44. holoscan-2.6.0.data/purelib/holoscan/lib/gxf_extensions/libgxf_ucx_holoscan_lib.so +0 -0
  45. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_app.so +0 -0
  46. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_core.so +0 -0
  47. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_cuda.so +0 -0
  48. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_logger.so +0 -0
  49. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_multimedia.so +0 -0
  50. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_rmm.so +0 -0
  51. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_sample.so +0 -0
  52. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_serialization.so +0 -0
  53. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_std.so +0 -0
  54. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_ucx.so +0 -0
  55. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_core.so.2.6.0 +0 -0
  56. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_infer.so.2.6.0 +0 -0
  57. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_infer_onnx_runtime.so.2.6.0 +0 -0
  58. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_infer_torch.so.2.6.0 +0 -0
  59. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_infer_utils.so.2.6.0 +0 -0
  60. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_logger.so.2.6.0 +0 -0
  61. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_aja.so.2.6.0 +0 -0
  62. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_async_ping_rx.so.2.6.0 +0 -0
  63. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_async_ping_tx.so.2.6.0 +0 -0
  64. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_bayer_demosaic.so.2.6.0 +0 -0
  65. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_format_converter.so.2.6.0 +0 -0
  66. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_gxf_codelet.so.2.6.0 +0 -0
  67. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_holoviz.so.2.6.0 +0 -0
  68. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_inference.so.2.6.0 +0 -0
  69. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_inference_processor.so.2.6.0 +0 -0
  70. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_ping_rx.so.2.6.0 +0 -0
  71. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_ping_tensor_rx.so.2.6.0 +0 -0
  72. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_ping_tensor_tx.so.2.6.0 +0 -0
  73. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_ping_tx.so.2.6.0 +0 -0
  74. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_segmentation_postprocessor.so.2.6.0 +0 -0
  75. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_v4l2.so.2.6.0 +0 -0
  76. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_video_stream_recorder.so.2.6.0 +0 -0
  77. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_video_stream_replayer.so.2.6.0 +0 -0
  78. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_profiler.so.2.6.0 +0 -0
  79. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_spdlog_logger.so.2.6.0 +0 -0
  80. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_viz.so.2.6.0 +0 -0
  81. holoscan-2.6.0.data/purelib/holoscan/lib/libucm.so.0.0.0 +0 -0
  82. holoscan-2.6.0.data/purelib/holoscan/lib/libucp.so.0.0.0 +0 -0
  83. holoscan-2.6.0.data/purelib/holoscan/lib/libucs.so.0.0.0 +0 -0
  84. holoscan-2.6.0.data/purelib/holoscan/lib/libucs_signal.so.0.0.0 +0 -0
  85. holoscan-2.6.0.data/purelib/holoscan/lib/libuct.so.0.0.0 +0 -0
  86. holoscan-2.6.0.data/purelib/holoscan/lib/libyaml-cpp.so.0.7.0 +0 -0
  87. holoscan-2.6.0.data/purelib/holoscan/lib/ucx/libucm_cuda.so.0.0.0 +0 -0
  88. holoscan-2.6.0.data/purelib/holoscan/lib/ucx/libucs_fuse.so.0.0.0 +0 -0
  89. holoscan-2.6.0.data/purelib/holoscan/lib/ucx/libuct_cma.so.0.0.0 +0 -0
  90. holoscan-2.6.0.data/purelib/holoscan/lib/ucx/libuct_cuda.so.0.0.0 +0 -0
  91. holoscan-2.6.0.data/purelib/holoscan/lib/ucx/libuct_cuda_gdrcopy.so.0.0.0 +0 -0
  92. holoscan-2.6.0.data/purelib/holoscan/lib/ucx/libuct_ib.so.0.0.0 +0 -0
  93. holoscan-2.6.0.data/purelib/holoscan/lib/ucx/libuct_rdmacm.so.0.0.0 +0 -0
  94. holoscan-2.6.0.data/purelib/holoscan/lib/ucx/libuct_xpmem.so.0.0.0 +0 -0
  95. holoscan-2.6.0.data/purelib/holoscan/lib/ucx/libucx_perftest_cuda.so.0.0.0 +0 -0
  96. holoscan-2.6.0.data/purelib/holoscan/logger/__init__.py +37 -0
  97. holoscan-2.6.0.data/purelib/holoscan/network_contexts/__init__.py +28 -0
  98. holoscan-2.6.0.data/purelib/holoscan/operators/__init__.py +97 -0
  99. holoscan-2.6.0.data/purelib/holoscan/operators/aja_source/__init__.py +22 -0
  100. holoscan-2.6.0.data/purelib/holoscan/operators/bayer_demosaic/__init__.py +24 -0
  101. holoscan-2.6.0.data/purelib/holoscan/operators/format_converter/__init__.py +23 -0
  102. holoscan-2.6.0.data/purelib/holoscan/operators/gxf_codelet/__init__.py +67 -0
  103. holoscan-2.6.0.data/purelib/holoscan/operators/holoviz/__init__.py +424 -0
  104. holoscan-2.6.0.data/purelib/holoscan/operators/inference/__init__.py +23 -0
  105. holoscan-2.6.0.data/purelib/holoscan/operators/inference_processor/__init__.py +23 -0
  106. holoscan-2.6.0.data/purelib/holoscan/operators/ping_rx/__init__.py +45 -0
  107. holoscan-2.6.0.data/purelib/holoscan/operators/ping_tensor_rx/__init__.py +22 -0
  108. holoscan-2.6.0.data/purelib/holoscan/operators/ping_tensor_tx/__init__.py +22 -0
  109. holoscan-2.6.0.data/purelib/holoscan/operators/ping_tx/__init__.py +46 -0
  110. holoscan-2.6.0.data/purelib/holoscan/operators/segmentation_postprocessor/__init__.py +23 -0
  111. holoscan-2.6.0.data/purelib/holoscan/operators/v4l2_video_capture/__init__.py +23 -0
  112. holoscan-2.6.0.data/purelib/holoscan/operators/video_stream_recorder/__init__.py +22 -0
  113. holoscan-2.6.0.data/purelib/holoscan/operators/video_stream_replayer/__init__.py +22 -0
  114. holoscan-2.6.0.data/purelib/holoscan/resources/__init__.py +147 -0
  115. holoscan-2.6.0.data/purelib/holoscan/schedulers/__init__.py +32 -0
  116. holoscan-2.6.0.data/purelib/holoscan-2.6.0.pth +1 -0
  117. holoscan-2.6.0.dist-info/LICENSE.txt +202 -0
  118. holoscan-2.6.0.dist-info/METADATA +125 -0
  119. holoscan-2.6.0.dist-info/NOTICE.txt +174 -0
  120. holoscan-2.6.0.dist-info/NVIDIA-AI-PRODUCT-EULA.txt +243 -0
  121. holoscan-2.6.0.dist-info/RECORD +126 -0
  122. holoscan-2.6.0.dist-info/WHEEL +5 -0
  123. holoscan-2.6.0.dist-info/axle.lck +0 -0
  124. holoscan-2.6.0.dist-info/entry_points.txt +3 -0
  125. holoscan-2.6.0.dist-info/symlinks.txt +82 -0
  126. holoscan-2.6.0.dist-info/top_level.txt +3 -0
@@ -0,0 +1,416 @@
1
+ #!/bin/bash
2
+
3
+ # SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+
19
+ #===============================================================================
20
+ # Default values for environment variables.
21
+ #===============================================================================
22
+
23
+ init_globals() {
24
+ if [ "$0" != "/bin/bash" ] && [ "$0" != "bash" ]; then
25
+ SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
26
+ export RUN_SCRIPT_FILE="$(readlink -f "$0")"
27
+ else
28
+ export RUN_SCRIPT_FILE="$(readlink -f "${BASH_SOURCE[0]}")"
29
+ fi
30
+
31
+ export TOP=$(dirname "${RUN_SCRIPT_FILE}")
32
+
33
+ export HOLOSCAN_APPLICATION="${HOLOSCAN_APPLICATION:=/opt/holoscan/app}"
34
+ export HOLOSCAN_INPUT_PATH="${HOLOSCAN_INPUT_PATH:=/var/holoscan/input}"
35
+ export HOLOSCAN_OUTPUT_PATH="${HOLOSCAN_OUTPUT_PATH:=/var/holoscan/output}"
36
+ export HOLOSCAN_WORKDIR="${HOLOSCAN_WORKDIR:=/var/holoscan/}"
37
+ export HOLOSCAN_MODEL_PATH="${HOLOSCAN_MODEL_PATH:=/opt/holoscan/models/}"
38
+ export HOLOSCAN_DOCS="${HOLOSCAN_DOCS:=/opt/holoscan/docs/}"
39
+ export HOLOSCAN_CONFIG_PATH="${HOLOSCAN_CONFIG_PATH:=/var/holoscan/app.config}"
40
+ export HOLOSCAN_APP_MANIFEST_PATH="${HOLOSCAN_APP_MANIFEST_PATH:=/etc/holoscan/app.json}"
41
+ export HOLOSCAN_PKG_MANIFEST_PATH="${HOLOSCAN_PKG_MANIFEST_PATH:=/etc/holoscan/pkg.json}"
42
+ }
43
+
44
+ ################################################################################
45
+ # Utility functions
46
+ ################################################################################
47
+
48
+
49
+ c_str() {
50
+ local old_color=39
51
+ local old_attr=0
52
+ local color=39
53
+ local attr=0
54
+ local text=""
55
+ local mode="color"
56
+ if [ "${1:-}" = "color" ]; then
57
+ mode="color"
58
+ shift
59
+ elif [ "${1:-}" = "nocolor" ]; then
60
+ mode="nocolor"
61
+ shift
62
+ fi
63
+
64
+ for i in "$@"; do
65
+ case "$i" in
66
+ r|R)
67
+ color=31
68
+ ;;
69
+ g|G)
70
+ color=32
71
+ ;;
72
+ y|Y)
73
+ color=33
74
+ ;;
75
+ b|B)
76
+ color=34
77
+ ;;
78
+ p|P)
79
+ color=35
80
+ ;;
81
+ c|C)
82
+ color=36
83
+ ;;
84
+ w|W)
85
+ color=37
86
+ ;;
87
+
88
+ z|Z)
89
+ color=0
90
+ ;;
91
+ esac
92
+ case "$i" in
93
+ l|L|R|G|Y|B|P|C|W)
94
+ attr=1
95
+ ;;
96
+ n|N|r|g|y|b|p|c|w)
97
+ attr=0
98
+ ;;
99
+ z|Z)
100
+ attr=0
101
+ ;;
102
+ *)
103
+ text="${text}$i"
104
+ esac
105
+ if [ "${mode}" = "color" ]; then
106
+ if [ ${old_color} -ne ${color} ] || [ ${old_attr} -ne ${attr} ]; then
107
+ text="${text}\033[${attr};${color}m"
108
+ old_color=$color
109
+ old_attr=$attr
110
+ fi
111
+ fi
112
+ done
113
+ /bin/echo -en "$text"
114
+ }
115
+
116
+ c_echo() {
117
+ # Select color/nocolor based on the first argument
118
+ local mode="color"
119
+ if [ "${1:-}" = "color" ]; then
120
+ mode="color"
121
+ shift
122
+ elif [ "${1:-}" = "nocolor" ]; then
123
+ mode="nocolor"
124
+ shift
125
+ else
126
+ if [ ! -t 1 ]; then
127
+ mode="nocolor"
128
+ fi
129
+ fi
130
+
131
+ local old_opt="$(shopt -op xtrace)" # save old xtrace option
132
+ set +x # unset xtrace
133
+
134
+ if [ "${mode}" = "color" ]; then
135
+ local text="$(c_str color "$@")"
136
+ /bin/echo -e "$text\033[0m"
137
+ else
138
+ local text="$(c_str nocolor "$@")"
139
+ /bin/echo -e "$text"
140
+ fi
141
+ eval "${old_opt}" # restore old xtrace option
142
+ }
143
+
144
+ echo_err() {
145
+ >&2 echo "$@"
146
+ }
147
+
148
+ c_echo_err() {
149
+ >&2 c_echo "$@"
150
+ }
151
+
152
+ newline() {
153
+ echo
154
+ }
155
+
156
+ info() {
157
+ c_echo_err W "$(date -u '+%Y-%m-%d %H:%M:%S') [INFO] " Z "$@"
158
+ }
159
+
160
+ error() {
161
+ c_echo_err R "$(date -u '+%Y-%m-%d %H:%M:%S') [ERROR] " Z "$@"
162
+ }
163
+
164
+ fatal() {
165
+ if [ -n "$*" ]; then
166
+ c_echo_err R "$(date -u '+%Y-%m-%d %H:%M:%S') [FATAL] " Z "$@"
167
+ echo_err
168
+ fi
169
+ if [ -n "${SCRIPT_DIR}" ]; then
170
+ exit 1
171
+ else
172
+ kill -INT $$ # kill the current process instead of exit in shell environment.
173
+ fi
174
+ }
175
+
176
+ run_command() {
177
+ local status=0
178
+ local cmd="$*"
179
+
180
+ [ "$(echo -n "$@")" = "" ] && return 1 # return 1 if there is no command available
181
+
182
+ if [ "${DO_DRY_RUN}" != "true" ]; then
183
+ "$@"
184
+ status=$?
185
+ fi
186
+
187
+ return $status
188
+ }
189
+
190
+
191
+ #===============================================================================
192
+ # Section: Show
193
+ #===============================================================================
194
+
195
+ print() {
196
+ # Parse CLI arguments next
197
+ ARGS=("$@")
198
+ if [ "$ARGS" = "" ]; then
199
+ ARGS=*
200
+ fi
201
+
202
+ local i
203
+ local arg
204
+ for i in "${!ARGS[@]}"; do
205
+ arg="${ARGS[i]}"
206
+ if [[ "$arg" = "*" || "$arg" = "" ]]; then
207
+ opt=all
208
+ fi
209
+ if [ "$arg" = "app" ]; then
210
+ opt=app
211
+ fi
212
+ if [ "$arg" = "pkg" ]; then
213
+ opt=pkg
214
+ fi
215
+ done
216
+ newline
217
+ if [[ "$opt" = "all" || "$opt" = "app" ]]; then
218
+ if [ -f "${HOLOSCAN_APP_MANIFEST_PATH}" ]; then
219
+ c_echo "============================== app.json =============================="
220
+ run_command cat ${HOLOSCAN_APP_MANIFEST_PATH} | jq
221
+ else
222
+ c_echo_err "${HOLOSCAN_APP_MANIFEST_PATH} does not exists!"
223
+ fi
224
+ fi
225
+ newline
226
+ if [[ "$opt" = "all" || "$opt" = "pkg" ]]; then
227
+ if [ -f "${HOLOSCAN_PKG_MANIFEST_PATH}" ]; then
228
+ c_echo "============================== pkg.json =============================="
229
+ run_command cat ${HOLOSCAN_PKG_MANIFEST_PATH} | jq
230
+ else
231
+ c_echo_err "${HOLOSCAN_PKG_MANIFEST_PATH} does not exists!"
232
+ fi
233
+ fi
234
+ newline
235
+ }
236
+
237
+ print_env() {
238
+ run_command env -0 | sort -z | tr '\0' '\n'
239
+ }
240
+ #===============================================================================
241
+ # Section: Export
242
+ #===============================================================================
243
+
244
+ copy_app() {
245
+ info "Copying application from ${HOLOSCAN_APPLICATION} to ${EXPORT_ROOT}/app"
246
+ if [ -d "${HOLOSCAN_APPLICATION}" ]; then
247
+ run_command cp -r ${HOLOSCAN_APPLICATION} ${EXPORT_ROOT}/app
248
+ else
249
+ info "'${HOLOSCAN_APPLICATION}' cannot be found."
250
+ fi
251
+ newline
252
+ }
253
+
254
+ copy_configs() {
255
+ if [ ! -d "${EXPORT_ROOT}/config/" ]
256
+ then
257
+ mkdir -p ${EXPORT_ROOT}/config/
258
+ fi
259
+
260
+ info "Copying application manifest file from ${HOLOSCAN_APP_MANIFEST_PATH} to ${EXPORT_ROOT}/config/app.json"
261
+ if [ -f "${HOLOSCAN_APP_MANIFEST_PATH}" ]; then
262
+ run_command cp ${HOLOSCAN_APP_MANIFEST_PATH} ${EXPORT_ROOT}/config/app.json
263
+ else
264
+ info "application manifest file '${HOLOSCAN_APP_MANIFEST_PATH}' cannot be found."
265
+ fi
266
+
267
+ info "Copying pkg manifest file from ${HOLOSCAN_PKG_MANIFEST_PATH} to ${EXPORT_ROOT}/config/pkg.json"
268
+ if [ -f "${HOLOSCAN_PKG_MANIFEST_PATH}" ]; then
269
+ run_command cp ${HOLOSCAN_PKG_MANIFEST_PATH} ${EXPORT_ROOT}/config/pkg.json
270
+ else
271
+ info "package manifest file '${HOLOSCAN_PKG_MANIFEST_PATH}' cannot be found."
272
+ fi
273
+
274
+ local CONFIG_FILE_NAME=$(basename ${HOLOSCAN_CONFIG_PATH})
275
+ info "Copying application configuration from ${HOLOSCAN_CONFIG_PATH} to ${EXPORT_ROOT}/config/$CONFIG_FILE_NAME"
276
+ if [ -f "${HOLOSCAN_CONFIG_PATH}" ]; then
277
+ run_command cp ${HOLOSCAN_CONFIG_PATH} ${EXPORT_ROOT}/config/$CONFIG_FILE_NAME
278
+ else
279
+ info "Application configuration'${HOLOSCAN_CONFIG_PATH}' cannot be found."
280
+ fi
281
+ newline
282
+ }
283
+
284
+ copy_models() {
285
+ info "Copying models from ${HOLOSCAN_MODEL_PATH} to ${EXPORT_ROOT}/models"
286
+ if [ -d "${HOLOSCAN_MODEL_PATH}" ]; then
287
+ run_command cp -r ${HOLOSCAN_MODEL_PATH} ${EXPORT_ROOT}/models
288
+ else
289
+ info "'${HOLOSCAN_MODEL_PATH}' cannot be found."
290
+ fi
291
+ newline
292
+ }
293
+
294
+ copy_docs() {
295
+ info "Copying documentation from ${HOLOSCAN_DOCS} to ${EXPORT_ROOT}/docs"
296
+ if [ -d "${HOLOSCAN_DOCS}" ]; then
297
+ run_command cp -r ${HOLOSCAN_DOCS} ${EXPORT_ROOT}/docs
298
+ else
299
+ info "'${HOLOSCAN_DOCS}' cannot be found."
300
+ fi
301
+ newline
302
+ }
303
+
304
+ check_permission(){
305
+ test -w $@
306
+ if [ $? -ne 0 ]; then
307
+ fatal "Permission error: ensure the directory is created on the host first before using the 'extract' command."
308
+ fi
309
+ }
310
+
311
+
312
+ copy() {
313
+ EXPORT_ROOT=/var/run/holoscan/export
314
+
315
+ if [ -d "${EXPORT_ROOT}" ]
316
+ then
317
+ if [ -d "${EXPORT_ROOT}/app" ]; then
318
+ check_permission "${EXPORT_ROOT}/app"
319
+ copy_app
320
+ elif [ -d "${EXPORT_ROOT}/config" ]; then
321
+ check_permission "${EXPORT_ROOT}/config"
322
+ copy_configs
323
+ elif [ -d "${EXPORT_ROOT}/models" ]; then
324
+ check_permission "${EXPORT_ROOT}/models"
325
+ copy_models
326
+ elif [ -d "${EXPORT_ROOT}/docs" ]; then
327
+ copy_docs "${EXPORT_ROOT}/docs"
328
+ else
329
+ check_permission "${EXPORT_ROOT}"
330
+ copy_app
331
+ copy_configs
332
+ copy_models
333
+ copy_docs
334
+ fi
335
+ else
336
+ fatal "No volume mount found ${EXPORT_ROOT}."
337
+ fi
338
+ }
339
+
340
+ #===============================================================================
341
+
342
+
343
+ print_usage() {
344
+ local YELLOW='\033[0;93m' # YELLOW
345
+ local RED='\033[0;91m' # YELLOW
346
+ local NC='\033[0m' # No Color
347
+ c_echo "USAGE: /var/holoscan/tools [command] [arguments]..."
348
+ c_echo " Command List"
349
+ c_echo " ${YELLOW}extract${NC} --------------------------- Extract data based on mounted volume paths."
350
+ c_echo " /var/run/holoscan/export/app extract the application"
351
+ c_echo " /var/run/holoscan/export/config extract app.json and pkg.json manifest files and application YAML."
352
+ c_echo " /var/run/holoscan/export/models extract models"
353
+ c_echo " /var/run/holoscan/export/docs extract documentation files"
354
+ c_echo " /var/run/holoscan/export extract all of the above"
355
+ c_echo " ${RED}IMPORTANT${NC}: ensure the directory to be mounted for data extraction is created first on the host system"
356
+ c_echo " and has the correct permissions. If the directory had been created by the container previously"
357
+ c_echo " with the user and group being root, please delete it and manually create it again."
358
+ c_echo " ${YELLOW}show${NC} ----------------------------- Print manifest file(s): [app|pkg] to the terminal."
359
+ c_echo " ${YELLOW}app${NC} print app.json"
360
+ c_echo " ${YELLOW}pkg${NC} print pkg.json"
361
+ c_echo " ${YELLOW}env${NC} ------------------------- Print all environment variables to the terminal."
362
+ }
363
+
364
+
365
+ main() {
366
+ if [ "$1" = "show" ]; then
367
+ shift
368
+ print "$@"
369
+ elif [ "$1" = "env" ]; then
370
+ shift
371
+ print_env
372
+ elif [ "$1" = "extract" ]; then
373
+ shift
374
+ copy
375
+ elif [ "$1" = "help" ]; then
376
+ shift
377
+ print_usage
378
+ else # all other commands will launch the application
379
+ local command=$(jq -r '.command | fromjson | join(" ")' ${HOLOSCAN_APP_MANIFEST_PATH} 2>/dev/null)
380
+ if [ -n "${command}" ]; then
381
+ args=$(printf " %s" "${@}")
382
+ info "Launching application ${command} ${args:1}..."
383
+ eval ${command} "$@"
384
+ exit_code=$?
385
+ if [ $exit_code -ne 0 ] && [ -f /.dockerenv ] && [ "$HOLOSCAN_HOSTING_SERVICE" != "HOLOSCAN_RUN" ]; then
386
+ newline
387
+ c_echo "================================================================================================"
388
+ c_echo "Application exited with ${exit_code}."
389
+ newline
390
+ newline
391
+ c_echo nocolor "When running inside docker, ensure that the runtime is set to nvidia with required arguments."
392
+ newline
393
+ c_echo nocolor "For example:"
394
+ c_echo nocolor "docker run --runtime nvidia \\"
395
+ c_echo nocolor " --gpus all \\"
396
+ c_echo nocolor " -it \\"
397
+ c_echo nocolor " -e NVIDIA_DRIVER_CAPABILITIES=all \\"
398
+ c_echo nocolor " -e DISPLAY=\$DISPLAY \\"
399
+ c_echo nocolor " -v /tmp/.X11-unix:/tmp/.X11-unix \\"
400
+ c_echo nocolor " -v \${MY-INPUT-DATA}:/var/holoscan/input \\"
401
+ c_echo nocolor " my-container-image[:tag]"
402
+ newline
403
+ c_echo "================================================================================================"
404
+ newline
405
+ fi
406
+ else
407
+ fatal "Failed to launch application; failed to read/parse command from ${HOLOSCAN_APP_MANIFEST_PATH}."
408
+ fi
409
+ fi
410
+ }
411
+
412
+ init_globals
413
+
414
+ if [ -n "${SCRIPT_DIR}" ]; then
415
+ main "$@"
416
+ fi
File without changes
@@ -0,0 +1,18 @@
1
+ """
2
+ SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ SPDX-License-Identifier: Apache-2.0
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ """ # noqa: E501
17
+
18
+ from .runner import execute_run_command # noqa: F401
@@ -0,0 +1,174 @@
1
+ """
2
+ SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ SPDX-License-Identifier: Apache-2.0
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ """ # noqa: E501
17
+
18
+ import logging
19
+ import re
20
+ from typing import Optional, Union
21
+
22
+ from ..common.constants import Constants, DefaultValues
23
+ from ..common.exceptions import InvalidSharedMemoryValueError
24
+
25
+ logger = logging.getLogger("runner")
26
+
27
+
28
+ def get_shared_memory_size(
29
+ pkg_info: dict, worker: bool, driver: bool, fragments: str, user_shm_size: Optional[str]
30
+ ) -> Optional[float]:
31
+ """Queries the pkg.json file for shared memory requirement of the application
32
+
33
+ Args:
34
+ pkg_info (dict): package manifest
35
+ worker (bool): start the application as App Worker
36
+ driver (bool): start the application as App Driver
37
+ fragments (str): comma-separated list of fragments
38
+ user_shm_size (Optional[str]): user provided share memory size
39
+
40
+ Returns:
41
+ float: shared memory value in bytes
42
+ """
43
+
44
+ if user_shm_size == "config":
45
+ return _read_shm_size_from_config(pkg_info, worker, driver, fragments)
46
+ elif user_shm_size is not None:
47
+ return _convert_to_bytes(user_shm_size)
48
+ else:
49
+ return None
50
+
51
+
52
+ def _read_shm_size_from_config(pkg_info: dict, worker: bool, driver: bool, fragments: str) -> float:
53
+ """Queries the pkg.json file for shared memory requirement of the application
54
+
55
+ Args:
56
+ pkg_info (dict): package manifest
57
+ worker (bool): start the application as App Worker
58
+ driver (bool): start the application as App Driver
59
+ fragments (str): comma-separated list of fragments
60
+
61
+ Returns:
62
+ float: shared memory value in bytes
63
+ """
64
+ resources = pkg_info.get("resources") if pkg_info is not None else None
65
+
66
+ if resources is None:
67
+ return DefaultValues.DEFAULT_SHM_SIZE
68
+
69
+ max_value: float = 0
70
+ global_shared_memory_size = _convert_to_bytes(
71
+ resources.get(Constants.RESOURCE_SHARED_MEMORY_KEY, DefaultValues.DEFAULT_SHM_SIZE)
72
+ )
73
+
74
+ resources_fragments = resources.get("fragments", {})
75
+ if worker:
76
+ if fragments is None or fragments.lower() == "all":
77
+ max_value = _find_maximum_shared_memory_value_from_all_fragments(resources_fragments)
78
+ else:
79
+ max_value = _find_maximum_shared_memory_value_from_matching_fragments(
80
+ resources_fragments, fragments
81
+ )
82
+ max_value = max(max_value, global_shared_memory_size)
83
+ else:
84
+ if driver:
85
+ max_value = global_shared_memory_size
86
+ else:
87
+ max_value = _find_maximum_shared_memory_value_from_all_fragments(resources_fragments)
88
+ max_value = max(max_value, global_shared_memory_size)
89
+
90
+ return max_value
91
+
92
+
93
+ def _find_maximum_shared_memory_value_from_matching_fragments(
94
+ resources_fragments: dict, fragments: str
95
+ ) -> Optional[float]:
96
+ """Scan matching fragments for the maximum shared memory value.
97
+
98
+ Args:
99
+ resources_fragments (Dict): fragment resources; resources->fragments
100
+ fragments (str): comma-separated list of fragments to match
101
+
102
+ Returns:
103
+ Optional[float]: maximum shred memory value or zero if no fragments found.
104
+ """
105
+ user_fragments = fragments.split(",")
106
+ fragment_values = [
107
+ _convert_to_bytes(val[Constants.RESOURCE_SHARED_MEMORY_KEY])
108
+ for key, val in resources_fragments.items()
109
+ if Constants.RESOURCE_SHARED_MEMORY_KEY in val and key in user_fragments
110
+ ]
111
+
112
+ if fragment_values:
113
+ return max(fragment_values)
114
+ else:
115
+ return 0
116
+
117
+
118
+ def _find_maximum_shared_memory_value_from_all_fragments(
119
+ resources_fragments: dict,
120
+ ) -> Optional[float]:
121
+ """Scan all fragments for the maximum shared memory value.
122
+
123
+ Args:
124
+ resources_fragments (Dict): fragment resources; resources->fragments
125
+
126
+ Returns:
127
+ Optional[float]: maximum shred memory value or zero if no fragments found.
128
+ """
129
+ fragment_values = [
130
+ _convert_to_bytes(val[Constants.RESOURCE_SHARED_MEMORY_KEY])
131
+ for _, val in resources_fragments.items()
132
+ if Constants.RESOURCE_SHARED_MEMORY_KEY in val
133
+ ]
134
+
135
+ if fragment_values:
136
+ return max(fragment_values)
137
+ else:
138
+ return 0
139
+
140
+
141
+ def _convert_to_bytes(raw_value: Union[str, float, int]) -> float:
142
+ """Converts data measurements in string to float.
143
+
144
+ Supported units are Mi|MiB (mebibytes), Gi|GiB (gibibytes), MB|m (megabytes) and
145
+ GB|g (gigabytes)
146
+
147
+ Args:
148
+ raw_value (str): data measurement with a number and a supporting unit.
149
+
150
+ Returns:
151
+ float: number of bytes
152
+ """
153
+
154
+ if type(raw_value) in [float, int]:
155
+ return raw_value
156
+
157
+ result = re.search(r"([.\d]+)\s*(Mi|MiB|Gi|GiB|MB|GB|m|g)", raw_value)
158
+
159
+ if result is not None:
160
+ value = float(result.group(1))
161
+ if result.group(2) in ["Mi", "MiB"]:
162
+ return value * 1048576
163
+ if result.group(2) in ["Gi", "GiB"]:
164
+ return value * 1073741824
165
+ if result.group(2) == "MB":
166
+ return value * 1000000
167
+ if result.group(2) == "GB":
168
+ return value * 1000000000
169
+ if result.group(2) == "m":
170
+ return value * 1000000
171
+ if result.group(2) == "g":
172
+ return value * 1000000000
173
+
174
+ raise InvalidSharedMemoryValueError(f"Invalid/unsupported shared memory value: {raw_value}. ")