Skip to content

Downgrade patchelf version from 0.18.0 to 0.17.2 #295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions tools/Dockerfile.ort
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@

ARG BASE_IMAGE=gitlab-master.nvidia.com:5005/dl/dgx/cuda:12.6-devel-ubuntu22.04--24.10
ARG ONNXRUNTIME_VERSION=1.19.2
ARG ONNXRUNTIME_REPO=https://github.com/microsoft/onnxruntime
ARG ONNXRUNTIME_BUILD_CONFIG=Release

ARG ONNXRUNTIME_OPENVINO_VERSION=2024.4.0

FROM ${BASE_IMAGE}
WORKDIR /workspace

# Ensure apt-get won't prompt for selecting options
ENV DEBIAN_FRONTEND=noninteractive

# The Onnx Runtime dockerfile is the collection of steps in
# https://github.com/microsoft/onnxruntime/tree/master/dockerfiles



RUN apt-get update && apt-get install -y --no-install-recommends software-properties-common wget zip ca-certificates build-essential curl libcurl4-openssl-dev libssl-dev patchelf python3-dev python3-pip git gnupg gnupg1

# Install dependencies from
# onnxruntime/dockerfiles/scripts/install_common_deps.sh.
RUN apt update -q=2 \
&& apt install -y gpg wget \
&& wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null \
&& . /etc/os-release \
&& echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $UBUNTU_CODENAME main" | tee /etc/apt/sources.list.d/kitware.list >/dev/null \
&& apt-get update -q=2 \
&& apt-get install -y --no-install-recommends cmake=3.27.7* cmake-data=3.27.7* \
&& cmake --version


# Allow configure to pick up cuDNN where it expects it.
# (Note: $CUDNN_VERSION is defined by base image)
RUN _CUDNN_VERSION=$(echo $CUDNN_VERSION | cut -d. -f1-2) && mkdir -p /usr/local/cudnn-$_CUDNN_VERSION/cuda/include && ln -s /usr/include/cudnn.h /usr/local/cudnn-$_CUDNN_VERSION/cuda/include/cudnn.h && mkdir -p /usr/local/cudnn-$_CUDNN_VERSION/cuda/lib64 && ln -s /etc/alternatives/libcudnn_so /usr/local/cudnn-$_CUDNN_VERSION/cuda/lib64/libcudnn.so

# Install OpenVINO
ARG ONNXRUNTIME_OPENVINO_VERSION
ENV INTEL_OPENVINO_DIR /opt/intel/openvino_${ONNXRUNTIME_OPENVINO_VERSION}

ARG OPENVINO_SHORT_VERSION=2024.4
ARG OPENVINO_VERSION_WITH_BUILD_NUMBER=2024.4.0.16579.c3152d32c9c

# Step 1: Download and install core components
# Ref: https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-archive-linux.html#step-1-download-and-install-the-openvino-core-components
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 && tar -xf openvino_${ONNXRUNTIME_OPENVINO_VERSION}.tgz && mkdir -p ${INTEL_OPENVINO_DIR} && mv l_openvino_toolkit_ubuntu22_${OPENVINO_VERSION_WITH_BUILD_NUMBER}_x86_64/* ${INTEL_OPENVINO_DIR} && rm openvino_${ONNXRUNTIME_OPENVINO_VERSION}.tgz && (cd ${INTEL_OPENVINO_DIR}/install_dependencies && ./install_openvino_dependencies.sh -y) && ln -s ${INTEL_OPENVINO_DIR} ${INTEL_OPENVINO_DIR}/../openvino_`echo ${ONNXRUNTIME_OPENVINO_VERSION} | awk '{print substr($0,0,4)}'`

# Step 2: Configure the environment
# Ref: https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-archive-linux.html#step-2-configure-the-environment
ENV OpenVINO_DIR=$INTEL_OPENVINO_DIR/runtime/cmake
ENV LD_LIBRARY_PATH $INTEL_OPENVINO_DIR/runtime/lib/intel64:$LD_LIBRARY_PATH
ENV PKG_CONFIG_PATH=$INTEL_OPENVINO_DIR/runtime/lib/intel64/pkgconfig
ENV PYTHONPATH $INTEL_OPENVINO_DIR/python/python3.10:$INTEL_OPENVINO_DIR/python/python3:$PYTHONPATH

#
# ONNX Runtime build
#
ARG ONNXRUNTIME_VERSION
ARG ONNXRUNTIME_REPO
ARG ONNXRUNTIME_BUILD_CONFIG

RUN git clone -b rel-${ONNXRUNTIME_VERSION} --recursive ${ONNXRUNTIME_REPO} onnxruntime && (cd onnxruntime && git submodule update --init --recursive)

WORKDIR /workspace/onnxruntime
ARG COMMON_BUILD_ARGS="--config ${ONNXRUNTIME_BUILD_CONFIG} --skip_submodule_sync --parallel --build_shared_lib --build_dir /workspace/build --cmake_extra_defines CMAKE_CUDA_ARCHITECTURES='75;80;86;90' "

RUN ./build.sh ${COMMON_BUILD_ARGS} --update --build --use_cuda --cuda_home "/usr/lib" --cudnn_home "/usr/lib" --use_tensorrt --use_tensorrt_builtin_parser --tensorrt_home "/usr/src/tensorrt" --use_openvino CPU

#
# Copy all artifacts needed by the backend to /opt/onnxruntime
#
WORKDIR /opt/onnxruntime

RUN mkdir -p /opt/onnxruntime && cp /workspace/onnxruntime/LICENSE /opt/onnxruntime && cat /workspace/onnxruntime/cmake/external/onnx/VERSION_NUMBER > /opt/onnxruntime/ort_onnx_version.txt

# ONNX Runtime headers, libraries and binaries
RUN mkdir -p /opt/onnxruntime/include && cp /workspace/onnxruntime/include/onnxruntime/core/session/onnxruntime_c_api.h /opt/onnxruntime/include && cp /workspace/onnxruntime/include/onnxruntime/core/session/onnxruntime_session_options_config_keys.h /opt/onnxruntime/include && cp /workspace/onnxruntime/include/onnxruntime/core/providers/cpu/cpu_provider_factory.h /opt/onnxruntime/include

RUN mkdir -p /opt/onnxruntime/lib && cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/libonnxruntime_providers_shared.so /opt/onnxruntime/lib && cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/libonnxruntime.so /opt/onnxruntime/lib

RUN mkdir -p /opt/onnxruntime/bin && cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/onnxruntime_perf_test /opt/onnxruntime/bin && cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/onnx_test_runner /opt/onnxruntime/bin && (cd /opt/onnxruntime/bin && chmod a+x *)

RUN cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/libonnxruntime_providers_cuda.so /opt/onnxruntime/lib

# TensorRT specific headers and libraries
RUN cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/libonnxruntime_providers_tensorrt.so /opt/onnxruntime/lib

# OpenVino specific headers and libraries
RUN cp -r ${INTEL_OPENVINO_DIR}/docs/licensing /opt/onnxruntime/LICENSE.openvino

RUN cp /workspace/onnxruntime/include/onnxruntime/core/providers/openvino/openvino_provider_factory.h /opt/onnxruntime/include

RUN apt-get update && apt-get install -y --no-install-recommends libtbb2

RUN cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/libonnxruntime_providers_openvino.so /opt/onnxruntime/lib && cp ${INTEL_OPENVINO_DIR}/runtime/lib/intel64/libopenvino.so.${ONNXRUNTIME_OPENVINO_VERSION} /opt/onnxruntime/lib && cp ${INTEL_OPENVINO_DIR}/runtime/lib/intel64/libopenvino_c.so.${ONNXRUNTIME_OPENVINO_VERSION} /opt/onnxruntime/lib && cp ${INTEL_OPENVINO_DIR}/runtime/lib/intel64/libopenvino_intel_cpu_plugin.so /opt/onnxruntime/lib && cp ${INTEL_OPENVINO_DIR}/runtime/lib/intel64/libopenvino_ir_frontend.so.${ONNXRUNTIME_OPENVINO_VERSION} /opt/onnxruntime/lib && cp ${INTEL_OPENVINO_DIR}/runtime/lib/intel64/libopenvino_onnx_frontend.so.${ONNXRUNTIME_OPENVINO_VERSION} /opt/onnxruntime/lib && cp /usr/lib/x86_64-linux-gnu/libtbb.so.* /opt/onnxruntime/lib

RUN OV_SHORT_VERSION=`echo ${ONNXRUNTIME_OPENVINO_VERSION} | awk '{ split($0,a,"."); print substr(a[1],3) a[2] a[3] }'` && (cd /opt/onnxruntime/lib && chmod a-x * && ln -s libopenvino.so.${ONNXRUNTIME_OPENVINO_VERSION} libopenvino.so.${OV_SHORT_VERSION} && ln -s libopenvino.so.${ONNXRUNTIME_OPENVINO_VERSION} libopenvino.so && ln -s libopenvino_c.so.${ONNXRUNTIME_OPENVINO_VERSION} libopenvino_c.so.${OV_SHORT_VERSION} && ln -s libopenvino_c.so.${ONNXRUNTIME_OPENVINO_VERSION} libopenvino_c.so && ln -s libopenvino_ir_frontend.so.${ONNXRUNTIME_OPENVINO_VERSION} libopenvino_ir_frontend.so.${OV_SHORT_VERSION} && ln -s libopenvino_ir_frontend.so.${ONNXRUNTIME_OPENVINO_VERSION} libopenvino_ir_frontend.so && ln -s libopenvino_onnx_frontend.so.${ONNXRUNTIME_OPENVINO_VERSION} libopenvino_onnx_frontend.so.${OV_SHORT_VERSION} && ln -s libopenvino_onnx_frontend.so.${ONNXRUNTIME_OPENVINO_VERSION} libopenvino_onnx_frontend.so)

RUN cd /opt/onnxruntime/lib && ln -s libonnxruntime.so libonnxruntime.so.1 && ln -s libonnxruntime.so.1 libonnxruntime.so.${ONNXRUNTIME_VERSION}

RUN cd /opt/onnxruntime/lib && for i in `find . -mindepth 1 -maxdepth 1 -type f -name '*\.so*'`; do patchelf --set-rpath '$ORIGIN' $i; done

# For testing copy ONNX custom op library and model

RUN mkdir -p /opt/onnxruntime/test && cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/libcustom_op_library.so /opt/onnxruntime/test && cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/testdata/custom_op_library/custom_op_test.onnx /opt/onnxruntime/test
5 changes: 3 additions & 2 deletions tools/gen_ort_dockerfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ def dockerfile_for_linux(output_file):
zip \
ca-certificates \
curl \
patchelf \
python3-pip \
git \
gnupg \
gnupg1 \
openssl-devel

RUN pip3 install patchelf==0.17.2
"""
else:
df += """
Expand All @@ -143,13 +143,14 @@ def dockerfile_for_linux(output_file):
curl \
libcurl4-openssl-dev \
libssl-dev \
patchelf \
python3-dev \
python3-pip \
git \
gnupg \
gnupg1

RUN pip3 install patchelf==0.17.2

# Install dependencies from
# onnxruntime/dockerfiles/scripts/install_common_deps.sh.
RUN apt update -q=2 \\
Expand Down
Loading