Skip to content

Commit

Permalink
fix: Upgrade main to TRT 8.6, CUDA 11.8, Torch Dev
Browse files Browse the repository at this point in the history
- Upgrade versions, make required code edits for functionality and
coverage for tests and CI
  • Loading branch information
gs-olive committed Apr 24, 2023
1 parent 2dc510b commit 8c71910
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 37 deletions.
17 changes: 10 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,19 @@ commands:
parameters:
torch-build:
type: string
default: "2.1.0.dev20230421+cu118"
default: "2.1.0.dev20230419+cu118"
torchvision-build:
type: string
default: "0.16.0.dev20230419+cu118"
torch-build-index:
type: string
default: "https://download.pytorch.org/whl/cu118"
default: "https://download.pytorch.org/whl/nightly/cu118"
steps:
- run:
name: Install Torch
command: |
pip3 install --upgrade pip
pip3 install torch==<< parameters.torch-build >> torchvision torchaudio --extra-index-url << parameters.torch-build-index >>
pip3 install torch==<< parameters.torch-build >> torchvision==<< parameters.torchvision-build >> --extra-index-url << parameters.torch-build-index >>
build-py:
description: "Build the torch-tensorrt python release (pre-cxx11-abi)"
Expand Down Expand Up @@ -1205,16 +1208,16 @@ parameters:
# Nightly platform config
torch-build:
type: string
default: "2.1.0.dev20230421+cu118"
default: "2.1.0.dev20230419+cu118"
torch-build-index:
type: string
default: "https://download.pytorch.org/whl/cu118"
default: "https://download.pytorch.org/whl/nightly/cu118"
torch-build-legacy:
type: string
default: "1.13.1+cu118"
default: "1.13.1+cu117"
torch-build-index-legacy:
type: string
default: "https://download.pytorch.org/whl/cu118"
default: "https://download.pytorch.org/whl/cu117"
cudnn-version:
type: string
default: "8.5.0.96"
Expand Down
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@ In the case of building on top of a custom base container, you first must determ
version of the PyTorch C++ ABI. If your source of PyTorch is pytorch.org, likely this is the pre-cxx11-abi in which case you must modify `//docker/dist-build.sh` to not build the
C++11 ABI version of Torch-TensorRT.

You can then build the container using:


```bash
docker build --build-arg BASE_IMG=<IMAGE> -f docker/Dockerfile -t torch_tensorrt:latest .
```
You can then build the container using the build command in the [docker README](docker/README.md#instructions)

If you would like to build outside a docker container, please follow the section [Compiling Torch-TensorRT](#compiling-torch-tensorrt)

Expand Down Expand Up @@ -121,10 +116,10 @@ torch.jit.save(trt_ts_module, "trt_torchscript_module.ts") # save the TRT embedd
These are the following dependencies used to verify the testcases. Torch-TensorRT can work with other versions, but the tests are not guaranteed to pass.

- Bazel 5.2.0
- Libtorch 2.1.0.dev20230314 (built with CUDA 11.7)
- CUDA 11.7
- Libtorch 2.1.0.dev20230419 (built with CUDA 11.8)
- CUDA 11.8
- cuDNN 8.5.0
- TensorRT 8.5.1.7
- TensorRT 8.6.0

## Prebuilt Binaries and Wheel files

Expand Down
8 changes: 4 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ new_local_repository(
http_archive(
name = "libtorch",
build_file = "@//third_party/libtorch:BUILD",
sha256 = "486aeb5cf498f3df8713a96a0d178660828fc579e740c39b054bef0adef6315b",
sha256 = "1a526a9cd19c1015674d26921dbb94bcd2d632a6f9c431a21c43f4e24768d834",
strip_prefix = "libtorch",
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-cxx11-abi-shared-with-deps-2.1.0.dev20230421%2Bcu118.zip"],
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-cxx11-abi-shared-with-deps-2.1.0.dev20230419%2Bcu118.zip"],
)

http_archive(
name = "libtorch_pre_cxx11_abi",
build_file = "@//third_party/libtorch:BUILD",
sha256 = "03b1c29a2a2e412ab6cdb957b5fd48a64aeed1b3551ee7679908c4ac177b89ab",
sha256 = "60c5912a5085a6a7073b3804b10d41d6cc054693bbeb7a45e0247050c2837bac",
strip_prefix = "libtorch",
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-shared-with-deps-2.1.0.dev20230421%2Bcu118.zip"],
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-shared-with-deps-2.1.0.dev20230419%2Bcu118.zip"],
)

# Download these tarballs manually from the NVIDIA website
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Base image starts with CUDA
ARG BASE_IMG=nvidia/cuda:11.7.1-devel-ubuntu22.04
ARG BASE_IMG=nvidia/cuda:11.8.0-devel-ubuntu22.04
FROM ${BASE_IMG} as base

ARG TENSORRT_VERSION
Expand Down
6 changes: 3 additions & 3 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

* 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>.
* 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`
* [**Optional**] The desired base image be changed by explicitly setting a base image, as in `--build-arg BASE_IMG=nvidia/cuda:11.7.1-devel-ubuntu22.04`, though this is optional
* [**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
* [**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.

* This `Dockerfile` installs `pre-cxx11-abi` versions of Pytorch and builds Torch-TRT using `pre-cxx11-abi` libtorch as well.
Expand All @@ -17,14 +17,14 @@ Note: By default the container uses the `pre-cxx11-abi` version of Torch + Torch

### Instructions

- The example below uses CUDNN 8.5.0 and TensorRT 8.5.1
- The example below uses CUDNN 8.5.0 and TensorRT 8.6.0
- See <a href="https://github.com/pytorch/TensorRT#dependencies">dependencies</a> for a list of current default dependencies.

> From root of Torch-TensorRT repo
Build:
```
DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=8.5.1 --build-arg CUDNN_VERSION=8.5.0 -f docker/Dockerfile -t torch_tensorrt:latest .
DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=8.6.0 --build-arg CUDNN_VERSION=8.5.0 -f docker/Dockerfile -t torch_tensorrt:latest .
```

Run:
Expand Down
4 changes: 2 additions & 2 deletions py/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ numpy
packaging
pybind11==2.6.2
--extra-index-url https://download.pytorch.org/whl/nightly/cu118
torch==2.1.0.dev20230421+cu118
torchvision==0.16.0.dev20230421+cu118
torch==2.1.0.dev20230419+cu118
torchvision==0.16.0.dev20230419+cu118
--extra-index-url https://pypi.ngc.nvidia.com
tensorrt==8.6.0
2 changes: 1 addition & 1 deletion py/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def run(self):
long_description=long_description,
ext_modules=ext_modules,
install_requires=[
"torch==2.0.0",
"torch>=1.13.1",
],
setup_requires=[],
cmdclass={
Expand Down
4 changes: 2 additions & 2 deletions py/versions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.4.0.dev0"
__cuda_version__ = "11.7"
__cuda_version__ = "11.8"
__cudnn_version__ = "8.5"
__tensorrt_version__ = "8.5"
__tensorrt_version__ = "8.6"
8 changes: 4 additions & 4 deletions toolchains/ci_workspaces/WORKSPACE.x86_64.release.rhel
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ new_local_repository(
http_archive(
name = "libtorch",
build_file = "@//third_party/libtorch:BUILD",
sha256 = "486aeb5cf498f3df8713a96a0d178660828fc579e740c39b054bef0adef6315b",
sha256 = "1a526a9cd19c1015674d26921dbb94bcd2d632a6f9c431a21c43f4e24768d834",
strip_prefix = "libtorch",
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-cxx11-abi-shared-with-deps-2.1.0.dev20230421%2Bcu118.zip"],
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-cxx11-abi-shared-with-deps-2.1.0.dev20230419%2Bcu118.zip"],
)

http_archive(
name = "libtorch_pre_cxx11_abi",
build_file = "@//third_party/libtorch:BUILD",
sha256 = "03b1c29a2a2e412ab6cdb957b5fd48a64aeed1b3551ee7679908c4ac177b89ab",
sha256 = "60c5912a5085a6a7073b3804b10d41d6cc054693bbeb7a45e0247050c2837bac",
strip_prefix = "libtorch",
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-shared-with-deps-2.1.0.dev20230421%2Bcu118.zip"],
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-shared-with-deps-2.1.0.dev20230419%2Bcu118.zip"],
)

####################################################################################
Expand Down
8 changes: 4 additions & 4 deletions toolchains/ci_workspaces/WORKSPACE.x86_64.release.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ new_local_repository(
http_archive(
name = "libtorch",
build_file = "@//third_party/libtorch:BUILD",
sha256 = "486aeb5cf498f3df8713a96a0d178660828fc579e740c39b054bef0adef6315b",
sha256 = "1a526a9cd19c1015674d26921dbb94bcd2d632a6f9c431a21c43f4e24768d834",
strip_prefix = "libtorch",
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-cxx11-abi-shared-with-deps-2.1.0.dev20230421%2Bcu118.zip"],
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-cxx11-abi-shared-with-deps-2.1.0.dev20230419%2Bcu118.zip"],
)

http_archive(
name = "libtorch_pre_cxx11_abi",
build_file = "@//third_party/libtorch:BUILD",
sha256 = "03b1c29a2a2e412ab6cdb957b5fd48a64aeed1b3551ee7679908c4ac177b89ab",
sha256 = "60c5912a5085a6a7073b3804b10d41d6cc054693bbeb7a45e0247050c2837bac",
strip_prefix = "libtorch",
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-shared-with-deps-2.1.0.dev20230421%2Bcu118.zip"],
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-shared-with-deps-2.1.0.dev20230419%2Bcu118.zip"],
)

####################################################################################
Expand Down

0 comments on commit 8c71910

Please sign in to comment.