Skip to content

Commit 2159e9c

Browse files
committed
flip use_cxx11_abi naming
1 parent eff9b26 commit 2159e9c

File tree

12 files changed

+58
-60
lines changed

12 files changed

+58
-60
lines changed

.github/workflows/docgen.yml

+1-1
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

+1-1
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

+2-2
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

+6-6
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

+2-2
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

+6-6
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

+1-1
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

+6-6
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

+1-2
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"

py/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ torch.jit.save(trt_ts_module, "trt_torchscript_module.ts") # save the TRT embedd
2929

3030
## Installation
3131

32-
| ABI / Platform | Installation command |
33-
| --------------------------------------- | ------------------------------------------------------------ |
34-
| Pre CXX11 ABI (Linux x86_64) | python3 setup.py install |
35-
| CXX ABI (Linux x86_64) | python3 setup.py install --use-cxx11-abi |
36-
| Pre CXX11 ABI (Jetson platform aarch64) | python3 setup.py install --jetpack-version 4.6 |
37-
| CXX11 ABI (Jetson platform aarch64) | python3 setup.py install --jetpack-version 4.6 --use-cxx11-abi |
32+
| ABI / Platform | Installation command |
33+
| --------------------------------------- | ----------------------------------------------------------------- |
34+
| Pre CXX11 ABI (Linux x86_64) | python3 setup.py install --use-pre-cxx11-abi |
35+
| CXX ABI (Linux x86_64) | python3 setup.py install |
36+
| Pre CXX11 ABI (Jetson platform aarch64) | python3 setup.py install --jetpack-version 4.6 --use-pre-cxx11-abi|
37+
| CXX11 ABI (Jetson platform aarch64) | python3 setup.py install --jetpack-version 4.6 |
3838

3939
For Linux x86_64 platform, Pytorch libraries default to pre cxx11 abi. So, please use `python3 setup.py install`.
4040

41-
On Jetson platforms, NVIDIA hosts <a href="https://forums.developer.nvidia.com/t/pytorch-for-jetson-version-1-10-now-available/72048">pre-built Pytorch wheel files</a>. These wheel files are built with CXX11 ABI. So on jetson platforms, please use `python3 setup.py install --jetpack-version 4.6 --use-cxx11-abi`
41+
On Jetson platforms, NVIDIA hosts <a href="https://forums.developer.nvidia.com/t/pytorch-for-jetson-version-1-10-now-available/72048">pre-built Pytorch wheel files</a>. These wheel files are built with CXX11 ABI. So on jetson platforms, please use `python3 setup.py install --jetpack-version 4.6`
4242

4343
## Under the Hood
4444

py/ci/Dockerfile.ci

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ RUN wget -q https://developer.nvidia.com/downloads/compute/machine-learning/tens
1010

1111
ENV TENSORRT_DIR=/TensorRT-10.7.0.23
1212
ENV TENSORRT_VERSION=10.7.0
13-
ENV USE_CXX11_ABI=1
1413

1514
RUN wget https://github.com/bazelbuild/bazelisk/releases/download/v1.17.0/bazelisk-linux-amd64 \
1615
&& mv bazelisk-linux-amd64 /usr/bin/bazel \

setup.py

+25-25
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def load_dep_info():
7878

7979
dir_path = os.path.join(str(get_root_dir()), "py")
8080

81-
CXX11_ABI = IS_WINDOWS
81+
PRE_CXX11_ABI = False
8282
JETPACK_VERSION = None
8383
PY_ONLY = False
8484
NO_TS = False
@@ -136,13 +136,13 @@ def load_dep_info():
136136
if ci_env_var == "1":
137137
CI_BUILD = True
138138

139-
if "--use-cxx11-abi" in sys.argv:
140-
sys.argv.remove("--use-cxx11-abi")
141-
CXX11_ABI = True
139+
if "--use-pre-cxx11-abi" in sys.argv:
140+
sys.argv.remove("--use-pre-cxx11-abi")
141+
PRE_CXX11_ABI = True
142142

143-
if (cxx11_abi_env_var := os.environ.get("USE_CXX11_ABI")) is not None:
144-
if cxx11_abi_env_var == "1":
145-
CXX11_ABI = True
143+
if (pre_cxx11_abi_env_var := os.environ.get("USE_PRE_CXX11_ABI")) is not None:
144+
if pre_cxx11_abi_env_var == "1":
145+
PRE_CXX11_ABI = True
146146

147147
if platform.uname().processor == "aarch64":
148148
if "--jetpack-version" in sys.argv:
@@ -165,9 +165,9 @@ def load_dep_info():
165165
)
166166
JETPACK_VERSION = "6.1"
167167

168-
if not CXX11_ABI:
168+
if PRE_CXX11_ABI:
169169
warnings.warn(
170-
"Jetson platform detected but did not see --use-cxx11-abi option, if using a pytorch distribution provided by NVIDIA include this flag"
170+
"Jetson platform detected. Please remove --use-pre-cxx11-abi flag if you are using it."
171171
)
172172

173173

@@ -182,7 +182,7 @@ def load_dep_info():
182182

183183

184184
def build_libtorchtrt_pre_cxx11_abi(
185-
develop=True, use_dist_dir=True, cxx11_abi=False, rt_only=False
185+
develop=True, use_dist_dir=True, pre_cxx11_abi=True, rt_only=False
186186
):
187187
cmd = [BAZEL_EXE, "build"]
188188
if rt_only:
@@ -196,7 +196,7 @@ def build_libtorchtrt_pre_cxx11_abi(
196196
cmd.append("--compilation_mode=opt")
197197
if use_dist_dir:
198198
cmd.append("--distdir=third_party/dist_dir/x86_64-linux-gnu")
199-
if not cxx11_abi:
199+
if pre_cxx11_abi:
200200
cmd.append("--config=python")
201201
else:
202202
print("using CXX11 ABI build")
@@ -292,9 +292,9 @@ def finalize_options(self):
292292
def run(self):
293293

294294
if not PY_ONLY:
295-
global CXX11_ABI
295+
global PRE_CXX11_ABI
296296
build_libtorchtrt_pre_cxx11_abi(
297-
develop=True, cxx11_abi=CXX11_ABI, rt_only=NO_TS
297+
develop=True, pre_cxx11_abi=PRE_CXX11_ABI, rt_only=NO_TS
298298
)
299299
copy_libtorchtrt(rt_only=NO_TS)
300300

@@ -316,9 +316,9 @@ def finalize_options(self):
316316
def run(self):
317317

318318
if not PY_ONLY:
319-
global CXX11_ABI
319+
global PRE_CXX11_ABI
320320
build_libtorchtrt_pre_cxx11_abi(
321-
develop=False, cxx11_abi=CXX11_ABI, rt_only=NO_TS
321+
develop=False, pre_cxx11_abi=PRE_CXX11_ABI, rt_only=NO_TS
322322
)
323323
copy_libtorchtrt(rt_only=NO_TS)
324324

@@ -339,9 +339,9 @@ def finalize_options(self):
339339

340340
def run(self):
341341
if not PY_ONLY:
342-
global CXX11_ABI
342+
global PRE_CXX11_ABI
343343
build_libtorchtrt_pre_cxx11_abi(
344-
develop=False, cxx11_abi=CXX11_ABI, rt_only=NO_TS
344+
develop=False, pre_cxx11_abi=PRE_CXX11_ABI, rt_only=NO_TS
345345
)
346346
copy_libtorchtrt(rt_only=NO_TS)
347347

@@ -365,9 +365,9 @@ def run(self):
365365
gen_version_file()
366366
editable_wheel.run(self)
367367
else:
368-
global CXX11_ABI
368+
global PRE_CXX11_ABI
369369
build_libtorchtrt_pre_cxx11_abi(
370-
develop=True, cxx11_abi=CXX11_ABI, rt_only=NO_TS
370+
develop=True, pre_cxx11_abi=PRE_CXX11_ABI, rt_only=NO_TS
371371
)
372372
gen_version_file()
373373
copy_libtorchtrt(rt_only=NO_TS)
@@ -561,9 +561,9 @@ def run(self):
561561
"-Wno-deprecated-declarations",
562562
]
563563
+ (
564-
["-D_GLIBCXX_USE_CXX11_ABI=1"]
565-
if CXX11_ABI
566-
else ["-D_GLIBCXX_USE_CXX11_ABI=0"]
564+
["-D_GLIBCXX_USE_CXX11_ABI=0"]
565+
if PRE_CXX11_ABI
566+
else ["-D_GLIBCXX_USE_CXX11_ABI=1"]
567567
)
568568
),
569569
extra_link_args=(
@@ -584,9 +584,9 @@ def run(self):
584584
"-export-dynamic",
585585
]
586586
+ (
587-
["-D_GLIBCXX_USE_CXX11_ABI=1"]
588-
if CXX11_ABI
589-
else ["-D_GLIBCXX_USE_CXX11_ABI=0"]
587+
["-D_GLIBCXX_USE_CXX11_ABI=0"]
588+
if PRE_CXX11_ABI
589+
else ["-D_GLIBCXX_USE_CXX11_ABI=1"]
590590
)
591591
),
592592
undef_macros=["NDEBUG"],

0 commit comments

Comments
 (0)