Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ target_compile_features(triton-onnxruntime-backend PRIVATE cxx_std_${TRITON_MIN_
target_compile_options(
triton-onnxruntime-backend PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wextra -Wno-unused-parameter -Wno-type-limits -Werror>
-Wall -Wextra -Wno-unused-parameter -Wno-type-limits>
$<$<CXX_COMPILER_ID:MSVC>:/Wall /D_WIN32_WINNT=0x0A00 /EHsc /Zc:preprocessor>
)

Expand Down
39 changes: 14 additions & 25 deletions tools/gen_ort_dockerfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def dockerfile_for_linux(output_file):
df += """
# Ensure apt-get won't prompt for selecting options
ENV DEBIAN_FRONTEND=noninteractive
ENV PIP_BREAK_SYSTEM_PACKAGES=1

# The Onnx Runtime dockerfile is the collection of steps in
# https://github.com/microsoft/onnxruntime/tree/master/dockerfiles
Expand All @@ -105,7 +106,7 @@ def dockerfile_for_linux(output_file):
df += """
# The manylinux container defaults to Python 3.7, but some feature installation
# requires a higher version.
ARG PYVER=3.10
ARG PYVER=3.12
ENV PYTHONPATH=/opt/python/v
RUN ln -sf /opt/python/cp${PYVER/./}* ${PYTHONPATH}

Expand Down Expand Up @@ -153,19 +154,11 @@ def dockerfile_for_linux(output_file):
&& . /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* \\
&& apt-get install -y --no-install-recommends cmake=3.28.3* cmake-data=3.28.3* \\
&& cmake --version

"""
if FLAGS.enable_gpu:
df += """
# 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
RUN python3 -m pip install psutil

"""

if FLAGS.ort_openvino is not None:
Expand All @@ -185,10 +178,10 @@ def dockerfile_for_linux(output_file):
df += """
# 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 && \
RUN curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/${OPENVINO_SHORT_VERSION}/linux/l_openvino_toolkit_ubuntu24_${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} && \
mv l_openvino_toolkit_ubuntu24_${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) && \
Expand All @@ -197,9 +190,9 @@ def dockerfile_for_linux(output_file):
# 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 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
ENV PYTHONPATH=$INTEL_OPENVINO_DIR/python/python3.12:$INTEL_OPENVINO_DIR/python/python3:$PYTHONPATH
"""

## TEMPORARY: Using the tensorrt-8.0 branch until ORT 1.9 release to enable ORT backend with TRT 8.0 support.
Expand Down Expand Up @@ -287,7 +280,7 @@ def dockerfile_for_linux(output_file):
df += """
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='{}' "
--compile_no_warning_as_error --build_dir /workspace/build --cmake_extra_defines CMAKE_CUDA_ARCHITECTURES='{}' "
""".format(
cuda_archs
)
Expand Down Expand Up @@ -358,7 +351,7 @@ def dockerfile_for_linux(output_file):
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 apt-get update && apt-get install -y --no-install-recommends libtbb12

RUN cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/libonnxruntime_providers_openvino.so \
/opt/onnxruntime/lib && \
Expand Down Expand Up @@ -394,7 +387,7 @@ def dockerfile_for_linux(output_file):
"""
df += """
RUN cd /opt/onnxruntime/lib && \
for i in `find . -mindepth 1 -maxdepth 1 -type f -name '*\.so*'`; do \
for i in `find . -mindepth 1 -maxdepth 1 -type f -name '*\\.so*'`; do \
patchelf --set-rpath '$ORIGIN' $i; \
done

Expand Down Expand Up @@ -475,7 +468,7 @@ def dockerfile_for_windows(output_file):

df += """
WORKDIR /workspace/onnxruntime
ARG VS_DEVCMD_BAT="\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
ARG VS_DEVCMD_BAT="\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat"
RUN powershell Set-Content 'build.bat' -value 'call %VS_DEVCMD_BAT%',(Get-Content 'build.bat')
RUN build.bat --cmake_generator "Visual Studio 17 2022" --config Release --cmake_extra_defines "CMAKE_CUDA_ARCHITECTURES=75;80;86;90" --skip_submodule_sync --parallel --build_shared_lib --compile_no_warning_as_error --skip_tests --update --build --build_dir /workspace/build {}
""".format(
Expand Down Expand Up @@ -558,12 +551,8 @@ def preprocess_gpu_flags():
FLAGS.tensorrt_home = "/tensorrt"
else:
if "CUDNN_VERSION" in os.environ:
version = None
m = re.match(r"([0-9]\.[0-9])\.[0-9]\.[0-9]", os.environ["CUDNN_VERSION"])
if m:
version = m.group(1)
if FLAGS.cudnn_home is None:
FLAGS.cudnn_home = "/usr/local/cudnn-{}/cuda".format(version)
FLAGS.cudnn_home = "/usr"

if FLAGS.cuda_home is None:
FLAGS.cuda_home = "/usr/local/cuda"
Expand Down
Loading