Skip to content

Commit

Permalink
upgrade tensorrt dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
lanluo-nvidia committed Nov 9, 2024
1 parent 1f92a78 commit 6018cb4
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 198 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-test-tensorrt-linux.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Build and Test Torch-TensorRT on Linux with Future TensorRT Versions

on:
pull_request:
workflow_dispatch:

permissions:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-linux.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Release Linux wheels and tarball artifacts

on:
pull_request:
push:
tags:
# NOTE: Binary build pipelines should only get triggered on release candidate builds
Expand Down
12 changes: 6 additions & 6 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,20 @@ http_archive(
http_archive(
name = "tensorrt",
build_file = "@//third_party/tensorrt/archive:BUILD",
sha256 = "adff1cd5abe5d87013806172351e58fd024e5bf0fc61d49ef4b84cd38ed99081",
strip_prefix = "TensorRT-10.3.0.26",
sha256 = "33d3c2f3f4c84dc7991a4337a6fde9ed33f5c8e5c4f03ac2eb6b994a382b03a0",
strip_prefix = "TensorRT-10.6.0.26",
urls = [
"https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.3.0/tars/TensorRT-10.3.0.26.Linux.x86_64-gnu.cuda-12.5.tar.gz",
"https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.6.0/tars/TensorRT-10.6.0.26.Linux.x86_64-gnu.cuda-12.6.tar.gz",
],
)

http_archive(
name = "tensorrt_win",
build_file = "@//third_party/tensorrt/archive:BUILD",
sha256 = "2bb4bcb79e8c33575816d874b0512ea28c302af1c06ee6d224da71aa182f75e0",
strip_prefix = "TensorRT-10.3.0.26",
sha256 = "6c6d92c108a1b3368423e8f69f08d31269830f1e4c9da43b37ba34a176797254",
strip_prefix = "TensorRT-10.6.0.26",
urls = [
"https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.3.0/zip/TensorRT-10.3.0.26.Windows.win10.cuda-12.5.zip",
"https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.6.0/zip/TensorRT-10.6.0.26.Windows.win10.cuda-12.6.zip",
],
)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ These are the following dependencies used to verify the testcases. Torch-TensorR
- Bazel 6.3.2
- Libtorch 2.5.0.dev (latest nightly) (built with CUDA 12.4)
- CUDA 12.4
- TensorRT 10.3.0.26
- TensorRT 10.6.0.26
## Deprecation Policy
Expand Down
2 changes: 1 addition & 1 deletion dev_dep_versions.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__cuda_version__: "12.4"
__tensorrt_version__: "10.3.0"
__tensorrt_version__: ">=10.3.0,<=10.6.0"
4 changes: 2 additions & 2 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ Note: By default the container uses the `pre-cxx11-abi` version of Torch + Torch

### Instructions

- The example below uses TensorRT 10.3.0.26
- The example below uses TensorRT 10.6.0.26
- 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=10.3.0 -f docker/Dockerfile -t torch_tensorrt:latest .
DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=10.6.0 -f docker/Dockerfile -t torch_tensorrt:latest .
```

Run:
Expand Down
14 changes: 8 additions & 6 deletions packaging/pre_build_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,20 @@ export TORCH_INSTALL_PATH=$(python -c "import torch, os; print(os.path.dirname(t

if [[ ${TENSORRT_VERSION} != "" ]]; then
# this is the upgraded TensorRT version, replace current tensorrt version to the upgrade tensorRT version in the pyproject.toml
# example: __tensorrt_version__: ">=10.3.0,<=10.6.0"
# replace: tensorrt-cu12>=10.3.0,<=10.6.0 to tensorrt-cu12==10.7.0
current_version=$(cat dev_dep_versions.yml | grep __tensorrt_version__ | sed 's/__tensorrt_version__: //g' | sed 's/"//g')
sed -i -e "s/tensorrt-cu12==${current_version}/tensorrt-cu12==${TENSORRT_VERSION}/g" \
-e "s/tensorrt-cu12-bindings==${current_version}/tensorrt-cu12-bindings==${TENSORRT_VERSION}/g" \
-e "s/tensorrt-cu12-libs==${current_version}/tensorrt-cu12-libs==${TENSORRT_VERSION}/g" \
sed -i -e "s/tensorrt-cu12${current_version}/tensorrt-cu12==${TENSORRT_VERSION}/g" \
-e "s/tensorrt-cu12-bindings${current_version}/tensorrt-cu12-bindings==${TENSORRT_VERSION}/g" \
-e "s/tensorrt-cu12-libs${current_version}/tensorrt-cu12-libs==${TENSORRT_VERSION}/g" \
pyproject.toml
fi

if [[ "${CU_VERSION::4}" < "cu12" ]]; then
# replace dependencies from tensorrt-cu12-bindings/libs to tensorrt-cu11-bindings/libs
sed -i -e "s/tensorrt-cu12==/tensorrt-${CU_VERSION::4}==/g" \
-e "s/tensorrt-cu12-bindings==/tensorrt-${CU_VERSION::4}-bindings==/g" \
-e "s/tensorrt-cu12-libs==/tensorrt-${CU_VERSION::4}-libs==/g" \
sed -i -e "s/tensorrt-cu12/tensorrt-${CU_VERSION::4}/g" \
-e "s/tensorrt-cu12-bindings/tensorrt-${CU_VERSION::4}-bindings/g" \
-e "s/tensorrt-cu12-libs/tensorrt-${CU_VERSION::4}-libs/g" \
pyproject.toml
fi

Expand Down
8 changes: 3 additions & 5 deletions packaging/pre_build_script_windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ choco install bazelisk -y

if [[ "${CU_VERSION::4}" < "cu12" ]]; then
# replace dependencies from tensorrt-cu12-bindings/libs to tensorrt-cu11-bindings/libs
sed -i -e "s/tensorrt-cu12==/tensorrt-${CU_VERSION::4}==/g" \
-e "s/tensorrt-cu12-bindings==/tensorrt-${CU_VERSION::4}-bindings==/g" \
-e "s/tensorrt-cu12-libs==/tensorrt-${CU_VERSION::4}-libs==/g" \
sed -i -e "s/tensorrt-cu12>=/tensorrt-${CU_VERSION::4}>=/g" \
-e "s/tensorrt-cu12-bindings>=/tensorrt-${CU_VERSION::4}-bindings>=/g" \
-e "s/tensorrt-cu12-libs>=/tensorrt-${CU_VERSION::4}-libs>=/g" \
pyproject.toml
fi

#curl -Lo TensorRT.zip https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.3.0/zip/TensorRT-10.3.0.26.Windows.win10.cuda-12.5.zip
#unzip -o TensorRT.zip -d C:/
TORCH_TORCHVISION=$(grep "^torch" py/requirements.txt)
INDEX_URL=https://download.pytorch.org/whl/${CHANNEL}/${CU_VERSION}

Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ requires = [
"cffi>=1.15.1",
"typing-extensions>=4.7.0",
"future>=0.18.3",
"tensorrt-cu12==10.3.0",
"tensorrt-cu12>=10.3.0,<=10.6.0",
"torch>=2.6.0.dev,<2.7.0",
"pybind11==2.6.2",
"numpy",
Expand Down Expand Up @@ -55,9 +55,9 @@ keywords = [
]
dependencies = [
"torch>=2.6.0.dev,<2.7.0",
"tensorrt-cu12==10.3.0",
"tensorrt-cu12-bindings==10.3.0",
"tensorrt-cu12-libs==10.3.0",
"tensorrt-cu12>=10.3.0,<=10.6.0",
"tensorrt-cu12-bindings>=10.3.0,<=10.6.0",
"tensorrt-cu12-libs>=10.3.0,<=10.6.0",
"packaging>=23",
"numpy",
"typing-extensions>=4.7.0",
Expand Down
12 changes: 6 additions & 6 deletions toolchains/ci_workspaces/MODULE.bazel.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,20 @@ http_archive(
http_archive(
name = "tensorrt",
build_file = "@//third_party/tensorrt/archive:BUILD",
sha256 = "adff1cd5abe5d87013806172351e58fd024e5bf0fc61d49ef4b84cd38ed99081",
strip_prefix = "TensorRT-10.3.0.26",
sha256 = "33d3c2f3f4c84dc7991a4337a6fde9ed33f5c8e5c4f03ac2eb6b994a382b03a0",
strip_prefix = "TensorRT-10.6.0.26",
urls = [
"https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.3.0/tars/TensorRT-10.3.0.26.Linux.x86_64-gnu.cuda-12.5.tar.gz",
"https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.6.0/tars/TensorRT-10.6.0.26.Linux.x86_64-gnu.cuda-12.6.tar.gz",
],
)

http_archive(
name = "tensorrt_win",
build_file = "@//third_party/tensorrt/archive:BUILD",
sha256 = "2bb4bcb79e8c33575816d874b0512ea28c302af1c06ee6d224da71aa182f75e0",
strip_prefix = "TensorRT-10.3.0.26",
sha256 = "6c6d92c108a1b3368423e8f69f08d31269830f1e4c9da43b37ba34a176797254",
strip_prefix = "TensorRT-10.6.0.26",
urls = [
"https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.3.0/zip/TensorRT-10.3.0.26.Windows.win10.cuda-12.5.zip",
"https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.6.0/zip/TensorRT-10.6.0.26.Windows.win10.cuda-12.6.zip",
],
)

Expand Down
Loading

0 comments on commit 6018cb4

Please sign in to comment.