From 553a8c4aa7c899cc29c2036bad598541871de3e3 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Mon, 3 Nov 2025 11:47:23 -0800 Subject: [PATCH 1/3] initial checckin --- .github/scripts/install-torch-tensorrt.sh | 2 ++ packaging/pre_build_script.sh | 15 +++++++++++---- packaging/pre_build_script_windows.sh | 8 ++++++-- setup.py | 3 +++ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/scripts/install-torch-tensorrt.sh b/.github/scripts/install-torch-tensorrt.sh index 7d0b7a5947..8bfee5ba05 100755 --- a/.github/scripts/install-torch-tensorrt.sh +++ b/.github/scripts/install-torch-tensorrt.sh @@ -12,6 +12,8 @@ if [[ $(uname -m) == "aarch64" ]]; then install_cuda_aarch64 fi +pip install cuda-toolkit + # Install all the dependencies required for Torch-TensorRT pip install --pre -r ${PWD}/tests/py/requirements.txt # dependencies in the tests/py/requirements.txt might install a different version of torch or torchvision diff --git a/packaging/pre_build_script.sh b/packaging/pre_build_script.sh index 2bc0fdc0f1..d884f1f42d 100755 --- a/packaging/pre_build_script.sh +++ b/packaging/pre_build_script.sh @@ -5,6 +5,13 @@ set -x # Install dependencies python3 -m pip install pyyaml +# CU_VERSION: cu130, cu129, etc. +# CU_MAJOR_VERSION: 13, 12, etc. +# CU_MINOR_VERSION: 0, 9, etc. +CU_MAJOR_VERSION=${CU_VERSION:2:4} +CU_MINOR_VERSION=${CU_VERSION:4:5} +ctk_name="cuda-toolkit-${CU_MAJOR_VERSION}-${CU_MINOR_VERSION}" + if [[ $(uname -m) == "aarch64" ]]; then IS_AARCH64=true BAZEL_PLATFORM=arm64 @@ -12,15 +19,15 @@ if [[ $(uname -m) == "aarch64" ]]; then if [[ ${os_name} == "ubuntu" ]]; then IS_JETPACK=true apt-get update - apt-get install -y ninja-build gettext curl libopenblas-dev zip unzip libfmt-dev + apt-get install -y ninja-build gettext curl libopenblas-dev zip unzip libfmt-dev ${ctk_name} else IS_SBSA=true yum install -y ninja-build gettext zip unzip - yum install -y fmt-devel + yum install -y fmt-devel ${ctk_name} fi else BAZEL_PLATFORM="amd64" - yum install -y fmt-devel + yum install -y fmt-devel ${ctk_name} fi @@ -62,7 +69,7 @@ export TORCH_INSTALL_PATH=$(python -c "import torch, os; print(os.path.dirname(t # CU_UPPERBOUND eg:13.0 or 12.9 # tensorrt tar for linux and windows are different across cuda version # for sbsa it is the same tar across cuda version -if [[ ${CU_VERSION:2:2} == "13" ]]; then +if [[ ${CU_MAJOR_VERSION} == "13" ]]; then export CU_UPPERBOUND="13.0" else export CU_UPPERBOUND="12.9" diff --git a/packaging/pre_build_script_windows.sh b/packaging/pre_build_script_windows.sh index 90024d9d2b..55931a7286 100644 --- a/packaging/pre_build_script_windows.sh +++ b/packaging/pre_build_script_windows.sh @@ -2,7 +2,11 @@ set -x pip install -U numpy packaging pyyaml setuptools wheel fmt -choco install bazelisk -y +CU_MAJOR_VERSION=${CU_VERSION:2:4} +CU_MINOR_VERSION=${CU_VERSION:4:5} +ctk_name="cuda-toolkit-${CU_MAJOR_VERSION}-${CU_MINOR_VERSION}" + +choco install bazelisk ${ctk_name} -y echo TENSORRT_VERSION=${TENSORRT_VERSION} @@ -38,7 +42,7 @@ ls -lart $TORCH_INSTALL_PATH/include/fmt/ # CU_UPPERBOUND eg:13.0 or 12.9 # tensorrt tar for linux and windows are different across cuda version # for sbsa it is the same tar across cuda version -if [[ ${CU_VERSION:2:2} == "13" ]]; then +if [[ ${CU_MAJOR_VERSION} == "13" ]]; then export CU_UPPERBOUND="13.0" else export CU_UPPERBOUND="12.9" diff --git a/setup.py b/setup.py index d487530626..3f13305cc6 100644 --- a/setup.py +++ b/setup.py @@ -729,6 +729,8 @@ def run(self): "packaging>=23", "typing-extensions>=4.7.0", "dllist", + # dummy package as a WAR for the tensorrt dependency on nvidia-cuda-runtime-cu13 + "nvidia-cuda-runtime-cu13==0.0.0a0", ] cuda_version = torch.version.cuda @@ -761,6 +763,7 @@ def get_requirements(): f"{tensorrt_prefix}-bindings>=10.13.0,<10.14.0", f"{tensorrt_prefix}-libs>=10.13.0,<10.14.0", ] + print(f"{requirements=}") return requirements From 9e00147e3e50fff28cad115729c844ee94c2fd21 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Tue, 4 Nov 2025 09:30:01 -0800 Subject: [PATCH 2/3] revert ctk installation --- .github/scripts/install-torch-tensorrt.sh | 2 -- packaging/pre_build_script.sh | 4 ++-- packaging/pre_build_script_windows.sh | 8 ++------ 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/scripts/install-torch-tensorrt.sh b/.github/scripts/install-torch-tensorrt.sh index 8bfee5ba05..7d0b7a5947 100755 --- a/.github/scripts/install-torch-tensorrt.sh +++ b/.github/scripts/install-torch-tensorrt.sh @@ -12,8 +12,6 @@ if [[ $(uname -m) == "aarch64" ]]; then install_cuda_aarch64 fi -pip install cuda-toolkit - # Install all the dependencies required for Torch-TensorRT pip install --pre -r ${PWD}/tests/py/requirements.txt # dependencies in the tests/py/requirements.txt might install a different version of torch or torchvision diff --git a/packaging/pre_build_script.sh b/packaging/pre_build_script.sh index e4015e8245..c5b8749021 100755 --- a/packaging/pre_build_script.sh +++ b/packaging/pre_build_script.sh @@ -8,8 +8,8 @@ python3 -m pip install pyyaml # CU_VERSION: cu130, cu129, etc. # CU_MAJOR_VERSION: 13, 12, etc. # CU_MINOR_VERSION: 0, 9, etc. -CU_MAJOR_VERSION=${CU_VERSION:2:4} -CU_MINOR_VERSION=${CU_VERSION:4:5} +CU_MAJOR_VERSION=${CU_VERSION:2:2} +CU_MINOR_VERSION=${CU_VERSION:4:1} ctk_name="cuda-toolkit-${CU_MAJOR_VERSION}-${CU_MINOR_VERSION}" if [[ $(uname -m) == "aarch64" ]]; then diff --git a/packaging/pre_build_script_windows.sh b/packaging/pre_build_script_windows.sh index 55931a7286..90024d9d2b 100644 --- a/packaging/pre_build_script_windows.sh +++ b/packaging/pre_build_script_windows.sh @@ -2,11 +2,7 @@ set -x pip install -U numpy packaging pyyaml setuptools wheel fmt -CU_MAJOR_VERSION=${CU_VERSION:2:4} -CU_MINOR_VERSION=${CU_VERSION:4:5} -ctk_name="cuda-toolkit-${CU_MAJOR_VERSION}-${CU_MINOR_VERSION}" - -choco install bazelisk ${ctk_name} -y +choco install bazelisk -y echo TENSORRT_VERSION=${TENSORRT_VERSION} @@ -42,7 +38,7 @@ ls -lart $TORCH_INSTALL_PATH/include/fmt/ # CU_UPPERBOUND eg:13.0 or 12.9 # tensorrt tar for linux and windows are different across cuda version # for sbsa it is the same tar across cuda version -if [[ ${CU_MAJOR_VERSION} == "13" ]]; then +if [[ ${CU_VERSION:2:2} == "13" ]]; then export CU_UPPERBOUND="13.0" else export CU_UPPERBOUND="12.9" From 456c0b9c467d300fb04a69e073cc58fb67edfec4 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Tue, 4 Nov 2025 10:22:21 -0800 Subject: [PATCH 3/3] remove print --- packaging/pre_build_script.sh | 15 ++++----------- setup.py | 1 - 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/packaging/pre_build_script.sh b/packaging/pre_build_script.sh index c5b8749021..4c21fd6fda 100755 --- a/packaging/pre_build_script.sh +++ b/packaging/pre_build_script.sh @@ -5,13 +5,6 @@ set -x # Install dependencies python3 -m pip install pyyaml -# CU_VERSION: cu130, cu129, etc. -# CU_MAJOR_VERSION: 13, 12, etc. -# CU_MINOR_VERSION: 0, 9, etc. -CU_MAJOR_VERSION=${CU_VERSION:2:2} -CU_MINOR_VERSION=${CU_VERSION:4:1} -ctk_name="cuda-toolkit-${CU_MAJOR_VERSION}-${CU_MINOR_VERSION}" - if [[ $(uname -m) == "aarch64" ]]; then IS_AARCH64=true BAZEL_PLATFORM=arm64 @@ -19,15 +12,15 @@ if [[ $(uname -m) == "aarch64" ]]; then if [[ ${os_name} == "ubuntu" ]]; then IS_JETPACK=true apt-get update - apt-get install -y ninja-build gettext curl libopenblas-dev zip unzip libfmt-dev libopenblas-dev ${ctk_name} + apt-get install -y ninja-build gettext curl libopenblas-dev zip unzip libfmt-dev libopenblas-dev else IS_SBSA=true yum install -y ninja-build gettext zip unzip - yum install -y fmt-devel ${ctk_name} + yum install -y fmt-devel fi else BAZEL_PLATFORM="amd64" - yum install -y fmt-devel ${ctk_name} + yum install -y fmt-devel fi @@ -69,7 +62,7 @@ export TORCH_INSTALL_PATH=$(python -c "import torch, os; print(os.path.dirname(t # CU_UPPERBOUND eg:13.0 or 12.9 # tensorrt tar for linux and windows are different across cuda version # for sbsa it is the same tar across cuda version -if [[ ${CU_MAJOR_VERSION} == "13" ]]; then +if [[ ${CU_VERSION:2:2} == "13" ]]; then export CU_UPPERBOUND="13.0" else export CU_UPPERBOUND="12.9" diff --git a/setup.py b/setup.py index 3f13305cc6..2a5f65c61a 100644 --- a/setup.py +++ b/setup.py @@ -763,7 +763,6 @@ def get_requirements(): f"{tensorrt_prefix}-bindings>=10.13.0,<10.14.0", f"{tensorrt_prefix}-libs>=10.13.0,<10.14.0", ] - print(f"{requirements=}") return requirements