2
2
3
3
# Example usage: docker run -it -v$(pwd)/..:/workspace/TRTorch build_trtorch_wheel /bin/bash /workspace/TRTorch/py/build_whl.sh
4
4
5
- cd /workspace/project/py
6
-
7
5
export CXX=g++
8
- export CUDA_HOME=/usr/local/cuda-11.6
9
- PROJECT_DIR=/workspace/project
6
+ export CUDA_HOME=/usr/local/cuda-11.7
7
+ export PROJECT_DIR=/workspace/project
10
8
11
9
cp -r $CUDA_HOME /usr/local/cuda
12
10
13
- build_py37 () {
14
- /opt/python/cp37-cp37m/bin/python -m pip install -r requirements.txt
15
- /opt/python/cp37-cp37m/bin/python setup.py bdist_wheel --release --ci
16
- # auditwheel repair --plat manylinux2014_x86_64
11
+ py37 () {
12
+ cd /workspace/project/py
13
+ PY_BUILD_CODE=cp37-cp37m
14
+ PY_VERSION=3.7
15
+ PY_NAME=python${PY_VERSION}
16
+ PY_DIR=/opt/python/${PY_BUILD_CODE}
17
+ PY_PKG_DIR=${PY_DIR} /lib/${PY_NAME} /site-packages/
18
+ ${PY_DIR} /bin/python -m pip install --upgrade pip
19
+ ${PY_DIR} /bin/python -m pip install -r requirements.txt
20
+ ${PY_DIR} /bin/python -m pip install setuptools wheel auditwheel
21
+ ${PY_DIR} /bin/python setup.py bdist_wheel --release --ci
22
+ LD_LIBRARY_PATH=$LD_LIBRARY_PATH :${PY_PKG_DIR} /torch/lib:${PY_PKG_DIR} /tensorrt/:${CUDA_HOME} /lib64:${CUDA_HOME} /lib64/stubs ${PY_DIR} /bin/python -m auditwheel repair $( cat ${PROJECT_DIR} /py/ci/soname_excludes.params) --plat manylinux_2_17_x86_64 dist/torch_tensorrt-* -${PY_BUILD_CODE} -linux_x86_64.whl
17
23
}
18
24
19
- build_py38 () {
20
- /opt/python/cp38-cp38/bin/python -m pip install -r requirements.txt
21
- /opt/python/cp38-cp38/bin/python setup.py bdist_wheel --release --ci
22
- # auditwheel repair --plat manylinux2014_x86_64
25
+ py38 () {
26
+ cd /workspace/project/py
27
+ PY_BUILD_CODE=cp38-cp38
28
+ PY_VERSION=3.8
29
+ PY_NAME=python${PY_VERSION}
30
+ PY_DIR=/opt/python/${PY_BUILD_CODE}
31
+ PY_PKG_DIR=${PY_DIR} /lib/${PY_NAME} /site-packages/
32
+ ${PY_DIR} /bin/python -m pip install --upgrade pip
33
+ ${PY_DIR} /bin/python -m pip install -r requirements.txt
34
+ ${PY_DIR} /bin/python -m pip install setuptools wheel auditwheel
35
+ ${PY_DIR} /bin/python setup.py bdist_wheel --release --ci
36
+ LD_LIBRARY_PATH=$LD_LIBRARY_PATH :${PY_PKG_DIR} /torch/lib:${PY_PKG_DIR} /tensorrt/:${CUDA_HOME} /lib64:${CUDA_HOME} /lib64/stubs ${PY_DIR} /bin/python -m auditwheel repair $( cat ${PROJECT_DIR} /py/ci/soname_excludes.params) --plat manylinux_2_17_x86_64 dist/torch_tensorrt-* -${PY_BUILD_CODE} -linux_x86_64.whl
23
37
}
24
38
25
- build_py39 () {
26
- /opt/python/cp39-cp39/bin/python -m pip install -r requirements.txt
27
- /opt/python/cp39-cp39/bin/python setup.py bdist_wheel --release --ci
28
- # auditwheel repair --plat manylinux2014_x86_64
39
+ py39 () {
40
+ cd /workspace/project/py
41
+ PY_BUILD_CODE=cp39-cp39
42
+ PY_VERSION=3.9
43
+ PY_NAME=python${PY_VERSION}
44
+ PY_DIR=/opt/python/${PY_BUILD_CODE}
45
+ PY_PKG_DIR=${PY_DIR} /lib/${PY_NAME} /site-packages/
46
+ ${PY_DIR} /bin/python -m pip install --upgrade pip
47
+ ${PY_DIR} /bin/python -m pip install -r requirements.txt
48
+ ${PY_DIR} /bin/python -m pip install setuptools wheel auditwheel
49
+ ${PY_DIR} /bin/python setup.py bdist_wheel --release --ci
50
+ LD_LIBRARY_PATH=$LD_LIBRARY_PATH :${PY_PKG_DIR} /torch/lib:${PY_PKG_DIR} /tensorrt/:${CUDA_HOME} /lib64:${CUDA_HOME} /lib64/stubs ${PY_DIR} /bin/python -m auditwheel repair $( cat ${PROJECT_DIR} /py/ci/soname_excludes.params) --plat manylinux_2_17_x86_64 dist/torch_tensorrt-* -${PY_BUILD_CODE} -linux_x86_64.whl
29
51
}
30
52
31
- build_py310 () {
32
- /opt/python/cp310-cp310/bin/python -m pip install -r requirements.txt
33
- /opt/python/cp310-cp310/bin/python setup.py bdist_wheel --release --ci
34
- # auditwheel repair --plat manylinux2014_x86_64
53
+ py310 () {
54
+ cd /workspace/project/py
55
+ PY_BUILD_CODE=cp310-cp310
56
+ PY_VERSION=3.10
57
+ PY_NAME=python${PY_VERSION}
58
+ PY_DIR=/opt/python/${PY_BUILD_CODE}
59
+ PY_PKG_DIR=${PY_DIR} /lib/${PY_NAME} /site-packages/
60
+ ${PY_DIR} /bin/python -m pip install --upgrade pip
61
+ ${PY_DIR} /bin/python -m pip install -r requirements.txt
62
+ ${PY_DIR} /bin/python -m pip install setuptools wheel auditwheel
63
+ ${PY_DIR} /bin/python setup.py bdist_wheel --release --ci
64
+ LD_LIBRARY_PATH=$LD_LIBRARY_PATH :${PY_PKG_DIR} /torch/lib:${PY_PKG_DIR} /tensorrt/:${CUDA_HOME} /lib64:${CUDA_HOME} /lib64/stubs ${PY_DIR} /bin/python -m auditwheel repair $( cat ${PROJECT_DIR} /py/ci/soname_excludes.params) --plat manylinux_2_17_x86_64 dist/torch_tensorrt-* -${PY_BUILD_CODE} -linux_x86_64.whl
35
65
}
36
66
37
67
# build_py311() {
@@ -40,31 +70,42 @@ build_py310() {
40
70
# #auditwheel repair --plat manylinux2014_x86_64
41
71
# }
42
72
43
- build_libtorchtrt () {
44
- bazel clean
73
+ libtorchtrt () {
74
+ cd /workspace/project/py
75
+ mkdir -p /workspace/project/py/wheelhouse
76
+ PY_BUILD_CODE=cp310-cp310
77
+ PY_VERSION=3.10
78
+ PY_NAME=python${PY_VERSION}
79
+ PY_DIR=/opt/python/${PY_BUILD_CODE}
80
+ PY_PKG_DIR=${PY_DIR} /lib/${PY_NAME} /site-packages/
81
+ ${PY_DIR} /bin/python -m pip install --upgrade pip
82
+ ${PY_DIR} /bin/python -m pip install -r requirements.txt
83
+ ${PY_DIR} /bin/python -m pip install setuptools wheel auditwheel
45
84
bazel build //:libtorchtrt --platforms //toolchains:ci_rhel_x86_64_linux -c opt --noshow_progress
46
- CUDA_VERSION=$( cd ${PROJECT_DIR} /py/torch_tensorrt && python3 -c " from _version import __cuda_version__;print(__cuda_version__)" )
47
- TORCHTRT_VERSION=$( cd ${PROJECT_DIR} /py/torch_tensorrt && python3 -c " from _version import __version__;print(__version__)" )
48
- TRT_VERSION=$( cd ${PROJECT_DIR} /py/torch_tensorrt && python3 -c " from _version import __tensorrt_version__;print(__tensorrt_version__)" )
49
- CUDNN_VERSION=$( cd ${PROJECT_DIR} /py/torch_tensorrt && python3 -c " from _version import __cudnn_version__;print(__cudnn_version__)" )
50
- TORCH_VERSION=$( /opt/python/cp310-cp310 /bin/python -c " from torch import __version__;print(__version__.split('+')[0])" )
51
- cp ${PROJECT_DIR} /bazel-bin/libtorchtrt.tar.gz ${PROJECT_DIR} /py/dist /libtorchtrt-${TORCHTRT_VERSION} -cudnn${CUDNN_VERSION} -tensorrt${TRT_VERSION} -cuda${CUDA_VERSION} -libtorch${TORCH_VERSION} -x86_64-linux.tar.gz
85
+ CUDA_VERSION=$( cd ${PROJECT_DIR} /py && ${PY_DIR} /bin/ python3 -c " from versions import __cuda_version__;print(__cuda_version__)" )
86
+ TORCHTRT_VERSION=$( cd ${PROJECT_DIR} /py && ${PY_DIR} /bin/ python3 -c " from versions import __version__;print(__version__)" )
87
+ TRT_VERSION=$( cd ${PROJECT_DIR} /py && ${PY_DIR} /bin/ python3 -c " from versions import __tensorrt_version__;print(__tensorrt_version__)" )
88
+ CUDNN_VERSION=$( cd ${PROJECT_DIR} /py && ${PY_DIR} /bin/ python3 -c " from versions import __cudnn_version__;print(__cudnn_version__)" )
89
+ TORCH_VERSION=$( ${PY_DIR} /bin/python -c " from torch import __version__;print(__version__.split('+')[0])" )
90
+ cp ${PROJECT_DIR} /bazel-bin/libtorchtrt.tar.gz ${PROJECT_DIR} /py/wheelhouse /libtorchtrt-${TORCHTRT_VERSION} -cudnn${CUDNN_VERSION} -tensorrt${TRT_VERSION} -cuda${CUDA_VERSION} -libtorch${TORCH_VERSION} -x86_64-linux.tar.gz
52
91
}
53
92
54
- build_libtorchtrt_pre_cxx11_abi () {
93
+ libtorchtrt_pre_cxx11_abi () {
94
+ cd /workspace/project/py
95
+ mkdir -p /workspace/project/py/wheelhouse
96
+ PY_BUILD_CODE=cp310-cp310
97
+ PY_VERSION=3.10
98
+ PY_NAME=python${PY_VERSION}
99
+ PY_DIR=/opt/python/${PY_BUILD_CODE}
100
+ PY_PKG_DIR=${PY_DIR} /lib/${PY_NAME} /site-packages/
101
+ ${PY_DIR} /bin/python -m pip install --upgrade pip
102
+ ${PY_DIR} /bin/python -m pip install -r requirements.txt
103
+ ${PY_DIR} /bin/python -m pip install setuptools wheel auditwheel
55
104
bazel build //:libtorchtrt --config pre_cxx11_abi --platforms //toolchains:ci_rhel_x86_64_linux -c opt --noshow_progress
56
- CUDA_VERSION=$( cd ${PROJECT_DIR} /py/torch_tensorrt && python3 -c " from _version import __cuda_version__;print(__cuda_version__)" )
57
- TORCHTRT_VERSION=$( cd ${PROJECT_DIR} /py/torch_tensorrt && python3 -c " from _version import __version__;print(__version__)" )
58
- TRT_VERSION=$( cd ${PROJECT_DIR} /py/torch_tensorrt && python3 -c " from _version import __tensorrt_version__;print(__tensorrt_version__)" )
59
- CUDNN_VERSION=$( cd ${PROJECT_DIR} /py/torch_tensorrt && python3 -c " from _version import __cudnn_version__;print(__cudnn_version__)" )
60
- TORCH_VERSION=$( /opt/python/cp310-cp310/bin/python -c " from torch import __version__;print(__version__.split('+')[0])" )
61
- cp ${PROJECT_DIR} /bazel-bin/libtorchtrt.tar.gz ${PROJECT_DIR} /py/dist/libtorchtrt-${TORCHTRT_VERSION} -pre-cxx11-abi-cudnn${CUDNN_VERSION} -tensorrt${TRT_VERSION} -cuda${CUDA_VERSION} -libtorch${TORCH_VERSION} -x86_64-linux.tar.gz
62
- }
63
-
64
- build_py37
65
- build_py38
66
- build_py39
67
- build_py310
68
- # build_py311
69
- build_libtorchtrt_pre_cxx11_abi
70
- # build_libtorchtrt
105
+ CUDA_VERSION=$( cd ${PROJECT_DIR} /py && ${PY_DIR} /bin/python3 -c " from versions import __cuda_version__;print(__cuda_version__)" )
106
+ TORCHTRT_VERSION=$( cd ${PROJECT_DIR} /py && ${PY_DIR} /bin/python3 -c " from versions import __version__;print(__version__)" )
107
+ TRT_VERSION=$( cd ${PROJECT_DIR} /py && ${PY_DIR} /bin/python3 -c " from versions import __tensorrt_version__;print(__tensorrt_version__)" )
108
+ CUDNN_VERSION=$( cd ${PROJECT_DIR} /py && ${PY_DIR} /bin/python3 -c " from versions import __cudnn_version__;print(__cudnn_version__)" )
109
+ TORCH_VERSION=$( ${PY_DIR} /bin/python -c " from torch import __version__;print(__version__.split('+')[0])" )
110
+ cp ${PROJECT_DIR} /bazel-bin/libtorchtrt.tar.gz ${PROJECT_DIR} /py/wheelhouse/libtorchtrt-${TORCHTRT_VERSION} -pre-cxx11-abi-cudnn${CUDNN_VERSION} -tensorrt${TRT_VERSION} -cuda${CUDA_VERSION} -libtorch${TORCH_VERSION} -x86_64-linux.tar.gz
111
+ }
0 commit comments