Skip to content

Commit cfdb585

Browse files
authored
chore: flip use_cxx11_abi naming (#3361)
1 parent 31b6dff commit cfdb585

File tree

13 files changed

+77
-68
lines changed

13 files changed

+77
-68
lines changed

.bazelrc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ build:windows --cxxopt="/GS-" --cxxopt="/std:c++17" --cxxopt="/permissive-"
3030
build:windows --cxxopt="/wd4244" --cxxopt="/wd4267" --cxxopt="/wd4819"
3131
build:windows --features=windows_export_all_symbols
3232

33-
build:python --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"
34-
build:python --linkopt="-D_GLIBCXX_USE_CXX11_ABI=0"
35-
build:python --define=abi=pre_cxx11_abi
3633
build:python --define=target_lang=python
3734

35+
build:cxx11_abi --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=1"
36+
build:cxx11_abi --linkopt="-D_GLIBCXX_USE_CXX11_ABI=1"
37+
build:cxx11_abi --define=abi=cxx11_abi
38+
3839
build:pre_cxx11_abi --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"
3940
build:pre_cxx11_abi --linkopt="-D_GLIBCXX_USE_CXX11_ABI=0"
4041
build:pre_cxx11_abi --define=abi=pre_cxx11_abi

.github/workflows/docgen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
4343
- name: Build Python Package
4444
env:
45-
USE_CXX11_ABI: 1
45+
USE_PRE_CXX11_ABI: 0
4646
run: |
4747
python3 -m pip install --pre . --extra-index-url https://download.pytorch.org/whl/nightly/cu126
4848
- name: Generate New Docs

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Environment variables supported by nox
7575
```
7676
PYT_PATH - To use different PYTHONPATH than system installed Python packages
7777
TOP_DIR - To set the root directory of the noxfile
78-
USE_CXX11 - To use cxx11_abi (Defaults to 0)
78+
USE_PRE_CXX11 - To use pre_cxx11_abi (Defaults to 0)
7979
USE_HOST_DEPS - To use host dependencies for tests (Defaults to 0)
8080
```
8181

docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ RUN test -n "$TENSORRT_VERSION" || (echo "No tensorrt version specified, please
1212
ARG PYTHON_VERSION=3.10
1313
ENV PYTHON_VERSION=${PYTHON_VERSION}
1414

15-
ARG USE_CXX11_ABI
16-
ENV USE_CXX11=${USE_CXX11_ABI}
15+
ARG USE_PRE_CXX11_ABI
16+
ENV USE_PRE_CXX11=${USE_PRE_CXX11_ABI}
1717
ENV DEBIAN_FRONTEND=noninteractive
1818

1919
# Install basic dependencies

docker/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
# Building a Torch-TensorRT container
22

3-
* Use `Dockerfile` to build a container which provides the exact development environment that our master branch is usually tested against.
3+
* Use `Dockerfile` to build a container which provides the exact development environment that our main 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>.
66
* The desired versions of TensorRT must be specified as build-args, with major and minor versions as in: `--build-arg TENSORRT_VERSION=a.b`
7-
* [**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
7+
* [**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

10-
* This `Dockerfile` installs `pre-cxx11-abi` versions of Pytorch and builds Torch-TRT using `pre-cxx11-abi` libtorch as well.
10+
* This `Dockerfile` installs `cxx11-abi` versions of Pytorch and builds Torch-TRT using `cxx11-abi` libtorch as well. As of torch 2.7, torch requires `cxx11-abi` for all CUDA 11.8, 12.4, and 12.6.
1111

12-
Note: By default the container uses the `pre-cxx11-abi` version of Torch + Torch-TRT. If you are using a workflow that requires a build of PyTorch on the CXX11 ABI (e.g. using the PyTorch NGC containers as a base image), add the Docker build argument: `--build-arg USE_CXX11_ABI=1`
12+
Note: By default the container uses the `cxx11-abi` version of Torch + Torch-TRT. If you are using a workflow that requires a build of PyTorch on the PRE CXX11 ABI, please add the Docker build argument: `--build-arg USE_PRE_CXX11_ABI=1`
1313

1414
### Dependencies
1515

1616
* Install nvidia-docker by following https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker
1717

1818
### Instructions
1919

20-
- The example below uses TensorRT 10.6.0.26
20+
- The example below uses TensorRT 10.7.0.23
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=10.6.0 -f docker/Dockerfile -t torch_tensorrt:latest .
27+
DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=10.7.0 -f docker/Dockerfile -t torch_tensorrt:latest .
2828
```
2929

3030
Run:

docker/dist-build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ set -x
44

55
TOP_DIR=$(cd $(dirname $0); pwd)/..
66

7-
if [[ -z "${USE_CXX11}" ]]; then
7+
if [[ -z "${USE_PRE_CXX11}" ]]; then
88
BUILD_CMD="python -m pip wheel . --extra-index-url https://download.pytorch.org/whl/nightly/cu124 -w dist"
99
else
10-
BUILD_CMD="python -m pip wheel . --config-setting="--build-option=--use-cxx11-abi" --extra-index-url https://download.pytorch.org/whl/nightly/cu124 -w dist"
10+
BUILD_CMD="python -m pip wheel . --config-setting="--build-option=--use-pre-cxx11-abi" --extra-index-url https://download.pytorch.org/whl/nightly/cu124 -w dist"
1111
fi
1212

1313
# TensorRT restricts our pip version

docsrc/getting_started/installation.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,13 @@ recommended commands:
235235
+-------------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------------------+
236236
| libtorch-shared-with-deps-*.zip from PyTorch.org | python -m pip install . | bazel build //:libtorchtrt -c opt \-\-config pre_cxx11_abi |
237237
+-------------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------------------+
238-
| libtorch-cxx11-abi-shared-with-deps-*.zip from PyTorch.org | python setup.py bdist_wheel --use-cxx11-abi | bazel build //:libtorchtrt -c opt |
238+
| libtorch-cxx11-abi-shared-with-deps-*.zip from PyTorch.org | python setup.py bdist_wheel | bazel build //:libtorchtrt -c opt |
239239
+-------------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------------------+
240-
| PyTorch preinstalled in an NGC container | python setup.py bdist_wheel --use-cxx11-abi | bazel build //:libtorchtrt -c opt |
240+
| PyTorch preinstalled in an NGC container | python setup.py bdist_wheel | bazel build //:libtorchtrt -c opt |
241241
+-------------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------------------+
242-
| PyTorch from the NVIDIA Forums for Jetson | python setup.py bdist_wheel --use-cxx11-abi | bazel build //:libtorchtrt -c opt |
242+
| PyTorch from the NVIDIA Forums for Jetson | python setup.py bdist_wheel | bazel build //:libtorchtrt -c opt |
243243
+-------------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------------------+
244-
| PyTorch built from Source | python setup.py bdist_wheel --use-cxx11-abi | bazel build //:libtorchtrt -c opt |
244+
| PyTorch built from Source | python setup.py bdist_wheel | bazel build //:libtorchtrt -c opt |
245245
+-------------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------------------+
246246

247247
NOTE: For all of the above cases you must correctly declare the source of PyTorch you intend to use in your WORKSPACE file for both Python and C++ builds. See below for more information
@@ -383,8 +383,8 @@ Compile the Python API using the following command from the ``//py`` directory:
383383

384384
.. code-block:: shell
385385
386-
python3 setup.py install --use-cxx11-abi
386+
python3 setup.py install
387387
388-
If you have a build of PyTorch that uses Pre-CXX11 ABI drop the ``--use-cxx11-abi`` flag
388+
If you have a build of PyTorch that uses Pre-CXX11 ABI drop the ``--use-pre-cxx11-abi`` flag
389389

390390
If you are building for Jetpack 4.5 add the ``--jetpack-version 5.0`` flag

docsrc/getting_started/jetpack.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,5 @@ Please make sure to build torch_tensorrt wheel file from source release/2.5 bran
115115
# replace the MODULE.bazel with the jetpack one
116116
cat toolchains/jp_workspaces/MODULE.bazel.tmpl | envsubst > MODULE.bazel
117117
# build and install torch_tensorrt wheel file
118-
python setup.py --use-cxx11-abi install --user
118+
python setup.py install --user
119119

noxfile.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
)
2222
print(f"Test root directory {TOP_DIR}")
2323

24-
# Set the USE_CXX11=1 to use cxx11_abi
25-
USE_CXX11 = 0 if not "USE_CXX11" in os.environ else os.environ["USE_CXX11"]
26-
if USE_CXX11:
27-
print("Using cxx11 abi")
24+
# Set the USE_PRE_CXX11=1 to use pre_cxx11_abi
25+
USE_PRE_CXX11 = 0 if not "USE_PRE_CXX11" in os.environ else os.environ["USE_PRE_CXX11"]
26+
if USE_PRE_CXX11:
27+
print("Using pre cxx11 abi")
2828

2929
# Set the USE_HOST_DEPS=1 to use host dependencies for tests
3030
USE_HOST_DEPS = 0 if not "USE_HOST_DEPS" in os.environ else os.environ["USE_HOST_DEPS"]
@@ -61,8 +61,8 @@ def download_models(session):
6161
def install_torch_trt(session):
6262
print("Installing latest torch-tensorrt build")
6363
session.chdir(os.path.join(TOP_DIR, "py"))
64-
if USE_CXX11:
65-
session.run("python", "setup.py", "develop", "--use-cxx11-abi")
64+
if USE_PRE_CXX11:
65+
session.run("python", "setup.py", "develop", "--use-pre-cxx11-abi")
6666
else:
6767
session.run("python", "setup.py", "develop")
6868

packaging/env_vars.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
export CI_BUILD="1"
2-
export RELEASE="1"
3-
export USE_CXX11_ABI="1"
2+
export RELEASE="1"

0 commit comments

Comments
 (0)