Skip to content

manylinux wheel file build update for TensorRT-10.0.1 #2868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,12 @@ To build wheel files for different python versions, first build the Dockerfile i
command

```
docker run -it -v$(pwd)/..:/workspace/Torch-TensorRT build_torch_tensorrt_wheel /bin/bash /workspace/Torch-TensorRT/py/build_whl.sh
# build the build_torch_tensorrt_wheel docker image
docker build --no-cache -t build_torch_tensorrt_wheel -f py/ci/Dockerfile.ci .

# build the wheel files for different python versions
docker run -it -v$(pwd):/workspace/TensorRT build_torch_tensorrt_wheel /bin/bash /workspace/TensorRT/py/ci/build_whl.sh

```

Python compilation expects using the tarball based compilation strategy from above.
Expand Down
9 changes: 6 additions & 3 deletions py/ci/Dockerfile.ci
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
FROM pytorch/manylinux-builder:cuda12.1
ARG trt_version

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

RUN yum install -y ninja-build tensorrt-${trt_version}.*
# download TensorRT tarball
RUN wget 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 \
&& gunzip TensorRT-10.0.1.6.Linux.x86_64-gnu.cuda-12.4.tar.gz \
&& tar -xvf TensorRT-10.0.1.6.Linux.x86_64-gnu.cuda-12.4.tar \
&& rm TensorRT-10.0.1.6.Linux.x86_64-gnu.cuda-12.4.tar

RUN wget https://github.com/bazelbuild/bazelisk/releases/download/v1.17.0/bazelisk-linux-amd64 \
&& mv bazelisk-linux-amd64 /usr/bin/bazel \
Expand Down
29 changes: 16 additions & 13 deletions py/ci/build_whl.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash

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

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

rm -rf /usr/local/cuda

Expand All @@ -19,6 +19,8 @@ fi

build_wheel() {
$1/bin/python -m pip install --upgrade pip setuptools
$1/bin/python -m pip install /TensorRT-10.0.1.6/python/tensorrt-10.0.1-${2}-none-linux_x86_64.whl

$1/bin/python -m pip install -r py/requirements.txt
#$1/bin/python -m pip wheel . -w dist
export BUILD_VERSION=$(cd ${PROJECT_DIR} && $1/bin/python3 -c "import versions; versions.torch_tensorrt_version_release()")
Expand All @@ -27,22 +29,23 @@ build_wheel() {

patch_wheel() {
$2/bin/python -m pip install auditwheel
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
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/TensorRT-10.0.1.6/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
}

py38() {
cd /workspace/project
cd ${PROJECT_DIR}
PY_BUILD_CODE=cp38-cp38
PY_SINGLE_BUILD_CODE=cp38
PY_VERSION=3.8
PY_NAME=python${PY_VERSION}
PY_DIR=/opt/python/${PY_BUILD_CODE}
PY_PKG_DIR=${PY_DIR}/lib/${PY_NAME}/site-packages/
build_wheel ${PY_DIR}
build_wheel ${PY_DIR} ${PY_SINGLE_BUILD_CODE}
patch_wheel ${PY_PKG_DIR} ${PY_DIR} ${PY_BUILD_CODE}
}

py39() {
cd /workspace/project
cd ${PROJECT_DIR}
PY_BUILD_CODE=cp39-cp39
PY_VERSION=3.9
PY_NAME=python${PY_VERSION}
Expand All @@ -53,7 +56,7 @@ py39() {
}

py310() {
cd /workspace/project
cd ${PROJECT_DIR}
PY_BUILD_CODE=cp310-cp310
PY_VERSION=3.10
PY_NAME=python${PY_VERSION}
Expand All @@ -64,7 +67,7 @@ py310() {
}

py311() {
cd /workspace/project
cd ${PROJECT_DIR}
PY_BUILD_CODE=cp311-cp311
PY_VERSION=3.11
PY_NAME=python${PY_VERSION}
Expand All @@ -75,7 +78,7 @@ py311() {
}

py312() {
cd /workspace/project
cd ${PROJECT_DIR}
PY_BUILD_CODE=cp312-cp312
PY_VERSION=3.12
PY_NAME=python${PY_VERSION}
Expand All @@ -86,8 +89,8 @@ py312() {
}

libtorchtrt() {
cd /workspace/project
mkdir -p /workspace/project/py/wheelhouse
cd ${PROJECT_DIR}
mkdir -p ${PROJECT_DIR}/py/wheelhouse
PY_BUILD_CODE=cp310-cp310
PY_VERSION=3.10
PY_NAME=python${PY_VERSION}
Expand All @@ -105,8 +108,8 @@ libtorchtrt() {
}

libtorchtrt_pre_cxx11_abi() {
cd /workspace/project/py
mkdir -p /workspace/project/py/wheelhouse
cd ${PROJECT_DIR}/py
mkdir -p ${PROJECT_DIR}/py/wheelhouse
PY_BUILD_CODE=cp310-cp310
PY_VERSION=3.10
PY_NAME=python${PY_VERSION}
Expand Down
8 changes: 7 additions & 1 deletion py/ci/soname_excludes.params
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,10 @@
--exclude libcublas.so.12.1.3.1
--exclude libcublasLt.so.12.1.3.1
--exclude libcudart.so.11.8.89
--exclude libcudart.so.11
--exclude libcudart.so.11
--exclude libcudart.so.12
--exclude libnvinfer.so.10
--exclude libnvinfer_plugin.so.10
--exclude libnvinfer-ea523553.so.10.0.1
--exclude libcudart-9335f6a2.so.12.1.105
--exclude libnvinfer_plugin-24528888.so.10.0.1
Loading