Skip to content

Commit 93f4be4

Browse files
authored
fix: Upgrade release/1.4 to Torch 2.0.1 + TensorRT 8.6.1 (#1896)
1 parent e84f43b commit 93f4be4

File tree

11 files changed

+139
-46
lines changed

11 files changed

+139
-46
lines changed

.circleci/config.yml

+96-15
Large diffs are not rendered by default.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ These are the following dependencies used to verify the testcases. Torch-TensorR
119119
- Libtorch 2.0.1 (built with CUDA 11.8)
120120
- CUDA 11.8
121121
- cuDNN 8.8.0
122-
- TensorRT 8.6.0
122+
- TensorRT 8.6.1
123123

124124
## Prebuilt Binaries and Wheel files
125125

WORKSPACE

+7-7
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@ new_local_repository(
5151
http_archive(
5252
name = "libtorch",
5353
build_file = "@//third_party/libtorch:BUILD",
54-
sha256 = "c5174f18c0866421a5738d389aaea0c02f32a1a5be5f0747dc8dd0d96034c9b0",
54+
sha256 = "843ad19e769a189758fd6a21bfced9024494b52344f4bc4fb75f75d36e6ea0c7",
5555
strip_prefix = "libtorch",
56-
urls = ["https://download.pytorch.org/libtorch/test/cu118/libtorch-cxx11-abi-shared-with-deps-latest.zip"],
56+
urls = ["https://download.pytorch.org/libtorch/cu118/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Bcu118.zip"],
5757
)
5858

5959
http_archive(
6060
name = "libtorch_pre_cxx11_abi",
6161
build_file = "@//third_party/libtorch:BUILD",
62-
sha256 = "cc19b398cf435e0e34f347ef90fc11c2a42703998330a9c4a9fb0d2291737df7",
62+
sha256 = "668a5816ee588e5d96be4803cbbd34263314197cbbb320f43ad25a8c626c02e1",
6363
strip_prefix = "libtorch",
64-
urls = ["https://download.pytorch.org/libtorch/test/cu118/libtorch-shared-with-deps-latest.zip"],
64+
urls = ["https://download.pytorch.org/libtorch/cu118/libtorch-shared-with-deps-2.0.1%2Bcu118.zip"],
6565
)
6666

6767
# Download these tarballs manually from the NVIDIA website
@@ -81,10 +81,10 @@ http_archive(
8181
http_archive(
8282
name = "tensorrt",
8383
build_file = "@//third_party/tensorrt/archive:BUILD",
84-
sha256 = "c1732a1093c57ab79fa0b687f061be369e449c9c17792b660f3663ecd8fa7b63",
85-
strip_prefix = "TensorRT-8.6.0.12",
84+
sha256 = "15bfe6053d45feec45ecc7123a9106076b0b43fa0435f242d89dca0778337759",
85+
strip_prefix = "TensorRT-8.6.1.6",
8686
urls = [
87-
"https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/secure/8.6.0/tars/TensorRT-8.6.0.12.Linux.x86_64-gnu.cuda-11.8.tar.gz",
87+
"https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/secure/8.6.1/tars/TensorRT-8.6.1.6.Linux.x86_64-gnu.cuda-11.8.tar.gz",
8888
],
8989
)
9090

docker/Dockerfile

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# Base image starts with CUDA
22
ARG BASE_IMG=nvidia/cuda:11.8.0-devel-ubuntu22.04
33
FROM ${BASE_IMG} as base
4+
ENV BASE_IMG=nvidia/cuda:11.8.0-devel-ubuntu22.04
45

56
ARG TENSORRT_VERSION
7+
ENV TENSORRT_VERSION=${TENSORRT_VERSION}
68
RUN test -n "$TENSORRT_VERSION" || (echo "No tensorrt version specified, please use --build-arg TENSORRT_VERSION=x.y.z to specify a version." && exit 1)
79
ARG CUDNN_VERSION
10+
ENV CUDNN_VERSION=${CUDNN_VERSION}
811
RUN test -n "$CUDNN_VERSION" || (echo "No cudnn version specified, please use --build-arg CUDNN_VERSION=x.y.z to specify a version." && exit 1)
912

1013
ARG PYTHON_VERSION=3.10
@@ -44,7 +47,7 @@ RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/
4447
RUN add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /"
4548
RUN apt-get update
4649

47-
RUN apt-get install -y libnvinfer8=${TENSORRT_VERSION}* libnvinfer-plugin8=${TENSORRT_VERSION}* libnvinfer-dev=${TENSORRT_VERSION}* libnvinfer-plugin-dev=${TENSORRT_VERSION}* libnvonnxparsers8=${TENSORRT_VERSION}-1* libnvonnxparsers-dev=${TENSORRT_VERSION}-1* libnvparsers8=${TENSORRT_VERSION}-1* libnvparsers-dev=${TENSORRT_VERSION}-1*
50+
RUN apt-get install -y libnvinfer8=${TENSORRT_VERSION}.* libnvinfer-plugin8=${TENSORRT_VERSION}.* libnvinfer-dev=${TENSORRT_VERSION}.* libnvinfer-plugin-dev=${TENSORRT_VERSION}.* libnvonnxparsers8=${TENSORRT_VERSION}.* libnvonnxparsers-dev=${TENSORRT_VERSION}.* libnvparsers8=${TENSORRT_VERSION}.* libnvparsers-dev=${TENSORRT_VERSION}.*
4851

4952
# Setup Bazel via Bazelisk
5053
RUN wget -q https://github.com/bazelbuild/bazelisk/releases/download/v1.16.0/bazelisk-linux-amd64 -O /usr/bin/bazel &&\
@@ -71,7 +74,18 @@ WORKDIR /workspace/torch_tensorrt/src
7174
RUN cp ./docker/WORKSPACE.docker WORKSPACE
7275

7376
# Symlink the path pyenv is using for python with the /opt directory for package sourcing
74-
RUN ln -s "`pyenv which python | xargs dirname | xargs dirname`/lib/python$PYTHON_VERSION/site-packages" "/opt/python3"
77+
RUN mkdir -p "/opt/python3/" &&\
78+
ln -s "`pyenv which python | xargs dirname | xargs dirname`/lib/python$PYTHON_VERSION/site-packages" "/opt/python3/"
79+
80+
# Extract base image cuda version (everything after :, before -, before final ., in BASE_IMG)
81+
# Ensure the default cuda folder agrees with the version in the base image
82+
RUN CUDA_BASE_IMG_VERSION_INTERMEDIATE=`echo ${BASE_IMG#*:}` &&\
83+
CUDA_BASE_IMG_VERSION=`echo ${CUDA_BASE_IMG_VERSION_INTERMEDIATE%%-*}` &&\
84+
CUDA_MAJOR_MINOR_VERSION=`echo ${CUDA_BASE_IMG_VERSION%.*}` &&\
85+
rm -fr /usr/local/cuda &&\
86+
ln -s /usr/local/cuda-${CUDA_MAJOR_MINOR_VERSION} /usr/local/cuda
87+
88+
ENV CUDA_HOME=/usr/local/cuda
7589

7690
# This script builds both libtorchtrt bin/lib/include tarball and the Python wheel, in dist/
7791
RUN bash ./docker/dist-build.sh

docker/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Use `Dockerfile` to build a container which provides the exact development environment that our master branch is usually tested against.
44

55
* The `Dockerfile` currently uses <a href="https://github.com/bazelbuild/bazelisk">Bazelisk</a> to select the Bazel version, and uses the exact library versions of Torch and CUDA listed in <a href="https://github.com/pytorch/TensorRT#dependencies">dependencies</a>.
6-
* The desired versions of CUDNN and TensorRT must be specified as build-args, with major, minor, and patch versions as in: `--build-arg TENSORRT_VERSION=a.b.c --build-arg CUDNN_VERSION=x.y.z`
6+
* The desired versions of CUDNN and TensorRT must be specified as build-args, with major and minor versions as in: `--build-arg TENSORRT_VERSION=a.b --build-arg CUDNN_VERSION=x.y`
77
* [**Optional**] The desired base image be changed by explicitly setting a base image, as in `--build-arg BASE_IMG=nvidia/cuda:11.8.0-devel-ubuntu22.04`, though this is optional
88
* [**Optional**] Additionally, the desired Python version can be changed by explicitly setting a version, as in `--build-arg PYTHON_VERSION=3.10`, though this is optional as well.
99

@@ -17,14 +17,14 @@ Note: By default the container uses the `pre-cxx11-abi` version of Torch + Torch
1717

1818
### Instructions
1919

20-
- The example below uses CUDNN 8.8.0 and TensorRT 8.6.0
20+
- The example below uses CUDNN 8.8 and TensorRT 8.6
2121
- See <a href="https://github.com/pytorch/TensorRT#dependencies">dependencies</a> for a list of current default dependencies.
2222

2323
> From root of Torch-TensorRT repo
2424
2525
Build:
2626
```
27-
DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=8.6.0 --build-arg CUDNN_VERSION=8.8.0 -f docker/Dockerfile -t torch_tensorrt:latest .
27+
DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=8.6 --build-arg CUDNN_VERSION=8.8 -f docker/Dockerfile -t torch_tensorrt:latest .
2828
```
2929

3030
Run:

docker/dist-build.sh

+4-6
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33
TOP_DIR=$(cd $(dirname $0); pwd)/..
44

55
if [[ -z "${USE_CXX11}" ]]; then
6-
BUILD_CMD="python3 setup.py bdist_wheel"
6+
BUILD_CMD="python setup.py bdist_wheel"
77
else
8-
BUILD_CMD="python3 setup.py bdist_wheel --use-cxx11-abi"
8+
BUILD_CMD="python setup.py bdist_wheel --use-cxx11-abi"
99
fi
1010

1111
cd ${TOP_DIR} \
1212
&& mkdir -p dist && cd py \
13-
&& pip install -r requirements.txt
14-
15-
# Symlink the path pyenv is using for python with the /opt directory for package sourcing
16-
ln -s "`pyenv which python | xargs dirname | xargs dirname`/lib/python$PYTHON_VERSION/site-packages" "/opt/python3"
13+
&& pip install -r requirements.txt \
14+
&& pip install wheel
1715

1816
# Build Torch-TRT
1917
MAX_JOBS=1 LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 ${BUILD_CMD} $* || exit 1

py/requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
numpy
22
packaging
33
pybind11==2.6.2
4-
--extra-index-url https://download.pytorch.org/whl/test/cu118
4+
--extra-index-url https://download.pytorch.org/whl/cu118
55
torch==2.0.1
66
torchvision==0.15.2
77
--extra-index-url https://pypi.ngc.nvidia.com
8-
tensorrt==8.6.0
8+
tensorrt==8.6.1

py/torch_tensorrt/fx/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ FX2TRT is merged as FX module in Torch-TensorRT
1212
$ conda install pytorch torchvision torchtext cudatoolkit=11.8 -c pytorch-nightly
1313
# Install TensorRT python package
1414
$ pip3 install nvidia-pyindex
15-
$ pip3 install tensorrt==8.6.0.12
15+
$ pip3 install tensorrt==8.6.1
1616
$ git clone https://github.com/pytorch/TensorRT.git
1717
$ cd TensorRT/py && python setup.py install --fx-only && cd ..
1818
$ python -c "import torch_tensorrt.fx"

py/versions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "1.4.0.rc0"
1+
__version__ = "1.4.0"
22
__cuda_version__ = "11.8"
33
__cudnn_version__ = "8.8"
44
__tensorrt_version__ = "8.6"

toolchains/ci_workspaces/WORKSPACE.x86_64.release.rhel

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ new_local_repository(
5656
http_archive(
5757
name = "libtorch",
5858
build_file = "@//third_party/libtorch:BUILD",
59-
sha256 = "c5174f18c0866421a5738d389aaea0c02f32a1a5be5f0747dc8dd0d96034c9b0",
59+
sha256 = "843ad19e769a189758fd6a21bfced9024494b52344f4bc4fb75f75d36e6ea0c7",
6060
strip_prefix = "libtorch",
61-
urls = ["https://download.pytorch.org/libtorch/test/cu118/libtorch-cxx11-abi-shared-with-deps-latest.zip"],
61+
urls = ["https://download.pytorch.org/libtorch/cu118/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Bcu118.zip"],
6262
)
6363

6464
http_archive(
6565
name = "libtorch_pre_cxx11_abi",
6666
build_file = "@//third_party/libtorch:BUILD",
67-
sha256 = "cc19b398cf435e0e34f347ef90fc11c2a42703998330a9c4a9fb0d2291737df7",
67+
sha256 = "668a5816ee588e5d96be4803cbbd34263314197cbbb320f43ad25a8c626c02e1",
6868
strip_prefix = "libtorch",
69-
urls = ["https://download.pytorch.org/libtorch/test/cu118/libtorch-shared-with-deps-latest.zip"],
69+
urls = ["https://download.pytorch.org/libtorch/cu118/libtorch-shared-with-deps-2.0.1%2Bcu118.zip"],
7070
)
7171

7272
####################################################################################

toolchains/ci_workspaces/WORKSPACE.x86_64.release.ubuntu

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ new_local_repository(
5656
http_archive(
5757
name = "libtorch",
5858
build_file = "@//third_party/libtorch:BUILD",
59-
sha256 = "c5174f18c0866421a5738d389aaea0c02f32a1a5be5f0747dc8dd0d96034c9b0",
59+
sha256 = "843ad19e769a189758fd6a21bfced9024494b52344f4bc4fb75f75d36e6ea0c7",
6060
strip_prefix = "libtorch",
61-
urls = ["https://download.pytorch.org/libtorch/test/cu118/libtorch-cxx11-abi-shared-with-deps-latest.zip"],
61+
urls = ["https://download.pytorch.org/libtorch/cu118/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Bcu118.zip"],
6262
)
6363

6464
http_archive(
6565
name = "libtorch_pre_cxx11_abi",
6666
build_file = "@//third_party/libtorch:BUILD",
67-
sha256 = "cc19b398cf435e0e34f347ef90fc11c2a42703998330a9c4a9fb0d2291737df7",
67+
sha256 = "668a5816ee588e5d96be4803cbbd34263314197cbbb320f43ad25a8c626c02e1",
6868
strip_prefix = "libtorch",
69-
urls = ["https://download.pytorch.org/libtorch/test/cu118/libtorch-shared-with-deps-latest.zip"],
69+
urls = ["https://download.pytorch.org/libtorch/cu118/libtorch-shared-with-deps-2.0.1%2Bcu118.zip"],
7070
)
7171

7272
####################################################################################

0 commit comments

Comments
 (0)