Skip to content

Commit e2061b7

Browse files
krishung5mc-nv
andauthored
Remove openvino hard-coded versioning in onnxruntime backend build (#254)
* Remove hard-coded openvino version * Format * Change default flag value for OpenVINO (#252) * Change default flag value for OpenVINO * Change default flag value for OpenVINO * Test with OV 2024 --------- Co-authored-by: Misha Chornyi <99709299+mc-nv@users.noreply.github.com>
1 parent 6c3ae0b commit e2061b7

File tree

1 file changed

+49
-34
lines changed

1 file changed

+49
-34
lines changed

tools/gen_ort_dockerfile.py

Lines changed: 49 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# Copyright 2020-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# Copyright 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
33
#
44
# Redistribution and use in source and binary forms, with or without
55
# modification, are permitted provided that the following conditions
@@ -43,6 +43,17 @@
4343
),
4444
}
4545

46+
OPENVINO_VERSION_MAP = {
47+
"2024.0.0": (
48+
"2024.0", # OpenVINO short version
49+
"2024.0.0.14509.34caeefd078", # OpenVINO version with build number
50+
),
51+
"2024.1.0": (
52+
"2024.1", # OpenVINO short version
53+
"2024.1.0.15008.f4afc983258", # OpenVINO version with build number
54+
),
55+
}
56+
4657

4758
def target_platform():
4859
if FLAGS.target_platform is not None:
@@ -127,22 +138,29 @@ def dockerfile_for_linux(output_file):
127138
# Install OpenVINO
128139
ARG ONNXRUNTIME_OPENVINO_VERSION
129140
ENV INTEL_OPENVINO_DIR /opt/intel/openvino_${ONNXRUNTIME_OPENVINO_VERSION}
141+
"""
142+
df += """
143+
ARG OPENVINO_SHORT_VERSION={}
144+
ARG OPENVINO_VERSION_WITH_BUILD_NUMBER={}
145+
""".format(
146+
OPENVINO_VERSION_MAP[FLAGS.ort_openvino][0],
147+
OPENVINO_VERSION_MAP[FLAGS.ort_openvino][1],
148+
)
130149

150+
df += """
131151
# Step 1: Download and install core components
132-
# Ref: https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_from_archive_linux.html#step-1-download-and-install-the-openvino-core-components
133-
RUN curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.3/linux/l_openvino_toolkit_ubuntu22_2023.3.0.13775.ceeafaf64f3_x86_64.tgz --output openvino_${ONNXRUNTIME_OPENVINO_VERSION}.tgz && \
152+
# Ref: https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-archive-linux.html#step-1-download-and-install-the-openvino-core-components
153+
RUN curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/${OPENVINO_SHORT_VERSION}/linux/l_openvino_toolkit_ubuntu22_${OPENVINO_VERSION_WITH_BUILD_NUMBER}_x86_64.tgz --output openvino_${ONNXRUNTIME_OPENVINO_VERSION}.tgz && \
134154
tar -xf openvino_${ONNXRUNTIME_OPENVINO_VERSION}.tgz && \
135155
mkdir -p ${INTEL_OPENVINO_DIR} && \
136-
mv l_openvino_toolkit_ubuntu22_2023.3.0.13775.ceeafaf64f3_x86_64/* ${INTEL_OPENVINO_DIR} && \
156+
mv l_openvino_toolkit_ubuntu22_${OPENVINO_VERSION_WITH_BUILD_NUMBER}_x86_64/* ${INTEL_OPENVINO_DIR} && \
137157
rm openvino_${ONNXRUNTIME_OPENVINO_VERSION}.tgz && \
138158
(cd ${INTEL_OPENVINO_DIR}/install_dependencies && \
139159
./install_openvino_dependencies.sh -y) && \
140160
ln -s ${INTEL_OPENVINO_DIR} ${INTEL_OPENVINO_DIR}/../openvino_`echo ${ONNXRUNTIME_OPENVINO_VERSION} | awk '{print substr($0,0,4)}'`
141161
142162
# Step 2: Configure the environment
143-
# Ref: https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_from_archive_linux.html#step-2-configure-the-environment
144-
ENV InferenceEngine_DIR=$INTEL_OPENVINO_DIR/runtime/cmake
145-
ENV ngraph_DIR=$INTEL_OPENVINO_DIR/runtime/cmake
163+
# Ref: https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-archive-linux.html#step-2-configure-the-environment
146164
ENV OpenVINO_DIR=$INTEL_OPENVINO_DIR/runtime/cmake
147165
ENV LD_LIBRARY_PATH $INTEL_OPENVINO_DIR/runtime/lib/intel64:$LD_LIBRARY_PATH
148166
ENV PKG_CONFIG_PATH=$INTEL_OPENVINO_DIR/runtime/lib/intel64/pkgconfig
@@ -155,43 +173,40 @@ def dockerfile_for_linux(output_file):
155173
# From ORT 1.9 onwards we will switch back to using rel-* branches
156174
if FLAGS.ort_version == "1.8.1":
157175
df += """
158-
#
159-
# ONNX Runtime build
160-
#
161-
ARG ONNXRUNTIME_VERSION
162-
ARG ONNXRUNTIME_REPO
163-
ARG ONNXRUNTIME_BUILD_CONFIG
164-
165-
RUN git clone -b tensorrt-8.0 --recursive ${ONNXRUNTIME_REPO} onnxruntime && \
166-
(cd onnxruntime && git submodule update --init --recursive)
176+
#
177+
# ONNX Runtime build
178+
#
179+
ARG ONNXRUNTIME_VERSION
180+
ARG ONNXRUNTIME_REPO
181+
ARG ONNXRUNTIME_BUILD_CONFIG
167182
183+
RUN git clone -b tensorrt-8.0 --recursive ${ONNXRUNTIME_REPO} onnxruntime && \
184+
(cd onnxruntime && git submodule update --init --recursive)
168185
"""
169186
# Use the tensorrt-8.5ea branch to use Tensor RT 8.5a to use the built-in tensorrt parser
170187
elif FLAGS.ort_version == "1.12.1":
171188
df += """
172-
#
173-
# ONNX Runtime build
174-
#
175-
ARG ONNXRUNTIME_VERSION
176-
ARG ONNXRUNTIME_REPO
177-
ARG ONNXRUNTIME_BUILD_CONFIG
178-
179-
RUN git clone -b tensorrt-8.5ea --recursive ${ONNXRUNTIME_REPO} onnxruntime && \
180-
(cd onnxruntime && git submodule update --init --recursive)
189+
#
190+
# ONNX Runtime build
191+
#
192+
ARG ONNXRUNTIME_VERSION
193+
ARG ONNXRUNTIME_REPO
194+
ARG ONNXRUNTIME_BUILD_CONFIG
181195
196+
RUN git clone -b tensorrt-8.5ea --recursive ${ONNXRUNTIME_REPO} onnxruntime && \
197+
(cd onnxruntime && git submodule update --init --recursive)
182198
"""
183199
else:
184200
df += """
185-
#
186-
# ONNX Runtime build
187-
#
188-
ARG ONNXRUNTIME_VERSION
189-
ARG ONNXRUNTIME_REPO
190-
ARG ONNXRUNTIME_BUILD_CONFIG
191-
192-
RUN git clone -b rel-${ONNXRUNTIME_VERSION} --recursive ${ONNXRUNTIME_REPO} onnxruntime && \
193-
(cd onnxruntime && git submodule update --init --recursive)
201+
#
202+
# ONNX Runtime build
203+
#
204+
ARG ONNXRUNTIME_VERSION
205+
ARG ONNXRUNTIME_REPO
206+
ARG ONNXRUNTIME_BUILD_CONFIG
194207
208+
RUN git clone -b rel-${ONNXRUNTIME_VERSION} --recursive ${ONNXRUNTIME_REPO} onnxruntime && \
209+
(cd onnxruntime && git submodule update --init --recursive)
195210
"""
196211

197212
if FLAGS.onnx_tensorrt_tag != "":

0 commit comments

Comments
 (0)