onnxruntime/dockerfiles/Dockerfile.tensorrt
Olivia Jain 49d7050b88
Create Checkout Submodules Script (#11344)
* move all logic for ubuntu dockerfiles

* pass in trt version

* update trt 8.0 file

* downgrade protobuf

* uncomment

* and

* change to 8.0

* update dockerfiles

* checkout protobuf based on version

* adding last dockerfile:
:

* checkout 3.10 protobuf

* fix checkout version

* update to 8.2

* keep only one submodule sync

* cleanup

* Delete Dockerfile.custom-trt-perf

* create checkout submodules script

* properly compare decimals in bin/sh

* combine build ort paths

* deprecate TRT 7.2

* only checkout protobuf if we checkout older onnx-tensorrt

* only pull nvidia container if true, update image

* downgrade protobuf only if we checkout onnx-trt

* Update linux-gpu-tensorrt-daily-perf-pipeline.yml for Azure Pipelines

* Update linux-gpu-tensorrt-daily-perf-pipeline.yml for Azure Pipelines

* Add quotes to avoid path splitting

* address shellcheck

* use shellcheck suggestions
2022-04-29 13:04:26 -07:00

30 lines
1.5 KiB
Text

# --------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------
# Dockerfile to run ONNXRuntime with TensorRT integration
# nVidia TensorRT Base Image
ARG TRT_CONTAINER_VERSION=21.12
FROM nvcr.io/nvidia/tensorrt:${TRT_CONTAINER_VERSION}-py3
ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
ARG ONNXRUNTIME_BRANCH=master
ARG CMAKE_CUDA_ARCHITECTURES=37;50;52;60;61;70;75;80
RUN apt-get update &&\
apt-get install -y sudo git bash unattended-upgrades
RUN unattended-upgrade
WORKDIR /code
ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:/code/cmake-3.21.0-linux-x86_64/bin:/opt/miniconda/bin:${PATH}
# Prepare onnxruntime repository & build onnxruntime with TensorRT
RUN git clone --single-branch --branch ${ONNXRUNTIME_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime &&\
/bin/sh onnxruntime/dockerfiles/scripts/install_common_deps.sh &&\
trt_version=${TRT_VERSION:0:3} &&\
/bin/sh onnxruntime/dockerfiles/scripts/checkout_submodules.sh ${trt_version} &&\
cd onnxruntime &&\
/bin/sh build.sh --parallel --build_shared_lib --cuda_home /usr/local/cuda --cudnn_home /usr/lib/x86_64-linux-gnu/ --use_tensorrt --tensorrt_home /usr/lib/x86_64-linux-gnu/ --config Release --build_wheel --skip_tests --skip_submodule_sync --cmake_extra_defines '"CMAKE_CUDA_ARCHITECTURES='${CMAKE_CUDA_ARCHITECTURES}'"' &&\
pip install /code/onnxruntime/build/Linux/Release/dist/*.whl &&\
cd ..