Skip to content

Commit 88dca04

Browse files
manylinux wheel file build update for TensorRT-10.0.1 (#2868)
1 parent 36e48f2 commit 88dca04

File tree

4 files changed

+38
-18
lines changed

4 files changed

+38
-18
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,12 @@ To build wheel files for different python versions, first build the Dockerfile i
243243
command
244244

245245
```
246-
docker run -it -v$(pwd)/..:/workspace/Torch-TensorRT build_torch_tensorrt_wheel /bin/bash /workspace/Torch-TensorRT/py/build_whl.sh
246+
# build the build_torch_tensorrt_wheel docker image
247+
docker build --no-cache -t build_torch_tensorrt_wheel -f py/ci/Dockerfile.ci .
248+
249+
# build the wheel files for different python versions
250+
docker run -it -v$(pwd):/workspace/TensorRT build_torch_tensorrt_wheel /bin/bash /workspace/TensorRT/py/ci/build_whl.sh
251+
247252
```
248253

249254
Python compilation expects using the tarball based compilation strategy from above.

py/ci/Dockerfile.ci

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
FROM pytorch/manylinux-builder:cuda12.1
2-
ARG trt_version
32

4-
RUN echo -e "Installing with TensorRT ${trt_version}"
3+
RUN yum install -y ninja-build
54

6-
RUN yum install -y ninja-build tensorrt-${trt_version}.*
5+
# download TensorRT tarball
6+
RUN wget -q https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.0.1/tars/TensorRT-10.0.1.6.Linux.x86_64-gnu.cuda-12.4.tar.gz \
7+
&& gunzip TensorRT-10.0.1.6.Linux.x86_64-gnu.cuda-12.4.tar.gz \
8+
&& tar -xvf TensorRT-10.0.1.6.Linux.x86_64-gnu.cuda-12.4.tar \
9+
&& rm TensorRT-10.0.1.6.Linux.x86_64-gnu.cuda-12.4.tar
10+
11+
ENV TENSORRT_DIR=/TensorRT-10.0.1.6
12+
ENV TENSORRT_VERSION=10.0.1
713

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

py/ci/build_whl.sh

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/bin/bash
22

3-
# Example usage: docker run -it -v$(pwd)/..:/workspace/TRTorch build_trtorch_wheel /bin/bash /workspace/TRTorch/py/build_whl.sh
3+
# Example usage: docker run -it -v$(pwd):/workspace/TensorRT build_torch_tensorrt_wheel /bin/bash /workspace/TensorRT/py/ci/build_whl.sh
44

55
export CXX=g++
66
export CUDA_HOME=/usr/local/cuda-12.1
7-
export PROJECT_DIR=/workspace/project
7+
export PROJECT_DIR=/workspace/TensorRT
88

99
rm -rf /usr/local/cuda
1010

@@ -19,6 +19,8 @@ fi
1919

2020
build_wheel() {
2121
$1/bin/python -m pip install --upgrade pip setuptools
22+
$1/bin/python -m pip install ${TENSORRT_DIR}/python/tensorrt-${TENSORRT_VERSION}-${2}-none-linux_x86_64.whl
23+
2224
$1/bin/python -m pip install -r py/requirements.txt
2325
#$1/bin/python -m pip wheel . -w dist
2426
export BUILD_VERSION=$(cd ${PROJECT_DIR} && $1/bin/python3 -c "import versions; versions.torch_tensorrt_version_release()")
@@ -27,22 +29,23 @@ build_wheel() {
2729

2830
patch_wheel() {
2931
$2/bin/python -m pip install auditwheel
30-
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$1/torch/lib:$1/tensorrt/:${CUDA_HOME}/lib64:${CUDA_HOME}/lib64/stubs $2/bin/python -m auditwheel repair $(cat ${PROJECT_DIR}/py/ci/soname_excludes.params) --plat manylinux_2_34_x86_64 dist/torch_tensorrt-*-$3-linux_x86_64.whl
32+
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${TENSERRT_DIR}/lib:$1/torch/lib:$1/tensorrt/:${CUDA_HOME}/lib64:${CUDA_HOME}/lib64/stubs $2/bin/python -m auditwheel repair $(cat ${PROJECT_DIR}/py/ci/soname_excludes.params) --plat manylinux_2_34_x86_64 dist/torch_tensorrt-*-$3-linux_x86_64.whl
3133
}
3234

3335
py38() {
34-
cd /workspace/project
36+
cd ${PROJECT_DIR}
3537
PY_BUILD_CODE=cp38-cp38
38+
PY_SINGLE_BUILD_CODE=cp38
3639
PY_VERSION=3.8
3740
PY_NAME=python${PY_VERSION}
3841
PY_DIR=/opt/python/${PY_BUILD_CODE}
3942
PY_PKG_DIR=${PY_DIR}/lib/${PY_NAME}/site-packages/
40-
build_wheel ${PY_DIR}
43+
build_wheel ${PY_DIR} ${PY_SINGLE_BUILD_CODE}
4144
patch_wheel ${PY_PKG_DIR} ${PY_DIR} ${PY_BUILD_CODE}
4245
}
4346

4447
py39() {
45-
cd /workspace/project
48+
cd ${PROJECT_DIR}
4649
PY_BUILD_CODE=cp39-cp39
4750
PY_VERSION=3.9
4851
PY_NAME=python${PY_VERSION}
@@ -53,7 +56,7 @@ py39() {
5356
}
5457

5558
py310() {
56-
cd /workspace/project
59+
cd ${PROJECT_DIR}
5760
PY_BUILD_CODE=cp310-cp310
5861
PY_VERSION=3.10
5962
PY_NAME=python${PY_VERSION}
@@ -64,7 +67,7 @@ py310() {
6467
}
6568

6669
py311() {
67-
cd /workspace/project
70+
cd ${PROJECT_DIR}
6871
PY_BUILD_CODE=cp311-cp311
6972
PY_VERSION=3.11
7073
PY_NAME=python${PY_VERSION}
@@ -75,7 +78,7 @@ py311() {
7578
}
7679

7780
py312() {
78-
cd /workspace/project
81+
cd ${PROJECT_DIR}
7982
PY_BUILD_CODE=cp312-cp312
8083
PY_VERSION=3.12
8184
PY_NAME=python${PY_VERSION}
@@ -86,8 +89,8 @@ py312() {
8689
}
8790

8891
libtorchtrt() {
89-
cd /workspace/project
90-
mkdir -p /workspace/project/py/wheelhouse
92+
cd ${PROJECT_DIR}
93+
mkdir -p ${PROJECT_DIR}/py/wheelhouse
9194
PY_BUILD_CODE=cp310-cp310
9295
PY_VERSION=3.10
9396
PY_NAME=python${PY_VERSION}
@@ -105,8 +108,8 @@ libtorchtrt() {
105108
}
106109

107110
libtorchtrt_pre_cxx11_abi() {
108-
cd /workspace/project/py
109-
mkdir -p /workspace/project/py/wheelhouse
111+
cd ${PROJECT_DIR}/py
112+
mkdir -p ${PROJECT_DIR}/py/wheelhouse
110113
PY_BUILD_CODE=cp310-cp310
111114
PY_VERSION=3.10
112115
PY_NAME=python${PY_VERSION}

py/ci/soname_excludes.params

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,10 @@
3535
--exclude libcublas.so.12.1.3.1
3636
--exclude libcublasLt.so.12.1.3.1
3737
--exclude libcudart.so.11.8.89
38-
--exclude libcudart.so.11
38+
--exclude libcudart.so.11
39+
--exclude libcudart.so.12
40+
--exclude libnvinfer.so.10
41+
--exclude libnvinfer_plugin.so.10
42+
--exclude libnvinfer-ea523553.so.10.0.1
43+
--exclude libcudart-9335f6a2.so.12.1.105
44+
--exclude libnvinfer_plugin-24528888.so.10.0.1

0 commit comments

Comments
 (0)