4
4
5
5
CURRENT_DIR=` pwd`
6
6
7
- ls
8
-
9
- python -m pip list | grep torch
10
-
11
- python -m pip list | grep tensorrt
12
-
13
7
if [[ " ${PYTHON_VERSION} " == " 3.8" ]]; then
14
8
PY_BUILD_CODE=cp38-cp38
15
9
elif [[ " ${PYTHON_VERSION} " == " 3.9" ]]; then
25
19
26
20
python -m pip install auditwheel
27
21
22
+ # Setup Bazel via Bazelisk
23
+ wget -q https://github.com/bazelbuild/bazelisk/releases/download/v1.17.0/bazelisk-linux-amd64 -O /usr/bin/bazel && \
24
+ chmod a+x /usr/bin/bazel
25
+
26
+ which bazel
27
+
28
28
# download TensorRT tarball
29
+ TRT_VERSION=10.0.1
29
30
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 \
30
31
&& gunzip TensorRT-10.0.1.6.Linux.x86_64-gnu.cuda-12.4.tar.gz \
31
32
&& tar -xvf TensorRT-10.0.1.6.Linux.x86_64-gnu.cuda-12.4.tar \
@@ -37,20 +38,13 @@ SITE_PKG_DIR=`python -c 'import sysconfig; print(sysconfig.get_paths()["purelib
37
38
38
39
LD_LIBRARY_PATH=$LD_LIBRARY_PATH :${TENSERRT_DIR} /lib:${SITE_PKG_DIR} /torch/lib:${SITE_PKG_DIR} /tensorrt/:${CUDA_HOME} /lib64:${CUDA_HOME} /lib64/stubs \
39
40
40
- python -m auditwheel repair \
41
- $( cat py/ci/soname_excludes.params) \
42
- --plat manylinux_2_34_x86_64 \
43
- /opt/torch-tensorrt-builds/torch_tensorrt-* -${PY_BUILD_CODE} -linux_x86_64.whl
44
-
45
41
if [[ ! -d dist ]]; then
46
42
mkdir dist
47
43
fi
48
- cp wheelhouse/torch_tensorrt* x86_64.whl dist/
49
44
50
- CUDA_VERSION=$( python -c " import versions; versions.cuda_version()" )
51
- TORCHTRT_VERSION=$( python -c " import versions; versions.torch_tensorrt_version_release()" )
52
- TRT_VERSION=$( python -c " import versions; versions.tensorrt_version()" )
53
- TORCH_VERSION=$( python -c " from torch import __version__;print(__version__.split('+')[0])" )
45
+ # BUILD_VERSION is 2.3.0+cu121
46
+ # but we don't want the +cu121 in the wheel file name
47
+ TORCHTRT_VERSION=${BUILD_VERSION% +* }
54
48
55
49
libtorchtrt () {
56
50
pre_cxx11_abi=${1}
@@ -62,18 +56,29 @@ libtorchtrt() {
62
56
PY_DIR=/opt/python/${PY_BUILD_CODE}
63
57
64
58
python -m pip install -r ${PROJECT_DIR} /py/requirements.txt
59
+
60
+ TORCH_VERSION=$( python -c " from torch import __version__;print(__version__.split('+')[0])" )
61
+
65
62
if [[ ' ${pre_cxx11_abi}' == ' true' ]]; then
66
63
bazel build //:libtorchtrt --config pre_cxx11_abi --platforms //toolchains:ci_rhel_x86_64_linux -c opt --noshow_progress
67
64
cp ${PROJECT_DIR} /bazel-bin/libtorchtrt.tar.gz \
68
- ${PROJECT_DIR} /dist/libtorchtrt-${TORCHTRT_VERSION} -pre-cxx11-abi-tensorrt${TRT_VERSION} -cuda${CUDA_VERSION } -libtorch${TORCH_VERSION} -x86_64-linux.tar.gz
65
+ ${PROJECT_DIR} /dist/libtorchtrt-${TORCHTRT_VERSION} -pre-cxx11-abi-tensorrt${TRT_VERSION} -cuda${CU_VERSION } -libtorch${TORCH_VERSION} -x86_64-linux.tar.gz
69
66
else
70
67
bazel build //:libtorchtrt --platforms //toolchains:ci_rhel_x86_64_linux -c opt --noshow_progress
71
68
cp ${PROJECT_DIR} /bazel-bin/libtorchtrt.tar.gz \
72
- ${PROJECT_DIR} /dist/libtorchtrt-${TORCHTRT_VERSION} -tensorrt${TRT_VERSION} -cuda${CUDA_VERSION } -libtorch${TORCH_VERSION} -x86_64-linux.tar.gz
69
+ ${PROJECT_DIR} /dist/libtorchtrt-${TORCHTRT_VERSION} -tensorrt${TRT_VERSION} -cuda${CU_VERSION } -libtorch${TORCH_VERSION} -x86_64-linux.tar.gz
73
70
fi
74
71
}
75
72
76
73
# build pre_cxx11_abi
77
74
libtorchtrt true
78
75
# build cxx11_abi
79
76
libtorchtrt false
77
+
78
+ # auditwheel repair
79
+ python -m auditwheel repair \
80
+ $( cat py/ci/soname_excludes.params) \
81
+ --plat manylinux_2_34_x86_64 \
82
+ /opt/torch-tensorrt-builds/torch_tensorrt-* -${PY_BUILD_CODE} -linux_x86_64.whl
83
+
84
+ cp wheelhouse/torch_tensorrt* x86_64.whl dist/
0 commit comments