@@ -8,84 +8,96 @@ export PROJECT_DIR=/workspace/project
8
8
9
9
cp -r $CUDA_HOME /usr/local/cuda
10
10
11
+ build_wheel () {
12
+ $1 /bin/python -m pip install --upgrade pip
13
+ $1 /bin/python -m pip wheel . --config-setting=" --build-option=--release" --config-setting=" --build-option=--ci" -w dist
14
+ }
15
+
16
+ patch_wheel () {
17
+ $2 /bin/python -m pip install auditwheel
18
+ 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
19
+ }
20
+
11
21
py37 () {
12
- cd /workspace/project/py
22
+ cd /workspace/project
13
23
PY_BUILD_CODE=cp37-cp37m
14
24
PY_VERSION=3.7
15
25
PY_NAME=python${PY_VERSION}
16
26
PY_DIR=/opt/python/${PY_BUILD_CODE}
17
27
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
28
+ build_wheel ${PY_DIR}
29
+ patch_wheel ${PY_PKG_DIR} ${PY_DIR} ${PY_BUILD_CODE}
23
30
}
24
31
25
32
py38 () {
26
- cd /workspace/project/py
33
+ cd /workspace/project
27
34
PY_BUILD_CODE=cp38-cp38
28
35
PY_VERSION=3.8
29
36
PY_NAME=python${PY_VERSION}
30
37
PY_DIR=/opt/python/${PY_BUILD_CODE}
31
38
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
39
+ build_wheel ${PY_DIR}
40
+ patch_wheel ${PY_PKG_DIR} ${PY_DIR} ${PY_BUILD_CODE}
37
41
}
38
42
39
43
py39 () {
40
- cd /workspace/project/py
44
+ cd /workspace/project
41
45
PY_BUILD_CODE=cp39-cp39
42
46
PY_VERSION=3.9
43
47
PY_NAME=python${PY_VERSION}
44
48
PY_DIR=/opt/python/${PY_BUILD_CODE}
45
49
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
50
+ build_wheel ${PY_DIR}
51
+ patch_wheel ${PY_PKG_DIR} ${PY_DIR} ${PY_BUILD_CODE}
51
52
}
52
53
53
54
py310 () {
54
- cd /workspace/project/py
55
+ cd /workspace/project
55
56
PY_BUILD_CODE=cp310-cp310
56
57
PY_VERSION=3.10
57
58
PY_NAME=python${PY_VERSION}
58
59
PY_DIR=/opt/python/${PY_BUILD_CODE}
59
60
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
61
+ build_wheel ${PY_DIR}
62
+ patch_wheel ${PY_PKG_DIR} ${PY_DIR} ${PY_BUILD_CODE}
63
+ }
64
+
65
+ py311 () {
66
+ cd /workspace/project
67
+ PY_BUILD_CODE=cp311-cp311
68
+ PY_VERSION=3.11
69
+ PY_NAME=python${PY_VERSION}
70
+ PY_DIR=/opt/python/${PY_BUILD_CODE}
71
+ PY_PKG_DIR=${PY_DIR} /lib/${PY_NAME} /site-packages/
72
+ build_wheel ${PY_DIR}
73
+ patch_wheel ${PY_PKG_DIR} ${PY_DIR} ${PY_BUILD_CODE}
65
74
}
66
75
67
- # build_py311() {
68
- # /opt/python/cp311-cp311/bin/python -m pip install -r requirements.txt
69
- # /opt/python/cp311-cp311/bin/python setup.py bdist_wheel --release --ci
70
- # #auditwheel repair --plat manylinux2014_x86_64
71
- # }
76
+ py312 () {
77
+ cd /workspace/project
78
+ PY_BUILD_CODE=cp312-cp312
79
+ PY_VERSION=3.12
80
+ PY_NAME=python${PY_VERSION}
81
+ PY_DIR=/opt/python/${PY_BUILD_CODE}
82
+ PY_PKG_DIR=${PY_DIR} /lib/${PY_NAME} /site-packages/
83
+ build_wheel ${PY_DIR}
84
+ patch_wheel ${PY_PKG_DIR} ${PY_DIR} ${PY_BUILD_CODE}
85
+ }
72
86
73
87
libtorchtrt () {
74
- cd /workspace/project/py
88
+ cd /workspace/project
75
89
mkdir -p /workspace/project/py/wheelhouse
76
90
PY_BUILD_CODE=cp310-cp310
77
91
PY_VERSION=3.10
78
92
PY_NAME=python${PY_VERSION}
79
93
PY_DIR=/opt/python/${PY_BUILD_CODE}
80
94
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
84
- bazel build //:libtorchtrt --platforms //toolchains:ci_rhel_x86_64_linux -c opt --noshow_progress
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__)" )
95
+ build_wheel ${PY_DIR}
96
+ patch_wheel ${PY_PKG_DIR} ${PY_DIR} ${PY_BUILD_CODE}
97
+ CUDA_VERSION=$( cd ${PROJECT_DIR} /py && ${PY_DIR} /bin/python3 -c " import versions; versions.cuda_version()" )
98
+ TORCHTRT_VERSION=$( cd ${PROJECT_DIR} /py && ${PY_DIR} /bin/python3 -c " import versions; versions.torch_tensorrt_version()" )
99
+ TRT_VERSION=$( cd ${PROJECT_DIR} /py && ${PY_DIR} /bin/python3 -c " import versions; versions.tensorrt_version()" )
100
+ CUDNN_VERSION=$( cd ${PROJECT_DIR} /py && ${PY_DIR} /bin/python3 -c " import versions; versions.cudnn_version()" )
89
101
TORCH_VERSION=$( ${PY_DIR} /bin/python -c " from torch import __version__;print(__version__.split('+')[0])" )
90
102
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
91
103
}
@@ -98,14 +110,12 @@ libtorchtrt_pre_cxx11_abi() {
98
110
PY_NAME=python${PY_VERSION}
99
111
PY_DIR=/opt/python/${PY_BUILD_CODE}
100
112
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
104
- bazel build //:libtorchtrt --config pre_cxx11_abi --platforms //toolchains:ci_rhel_x86_64_linux -c opt --noshow_progress
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__)" )
113
+ build_wheel ${PY_DIR}
114
+ patch_wheel ${PY_PKG_DIR} ${PY_DIR} ${PY_BUILD_CODE}
115
+ CUDA_VERSION=$( cd ${PROJECT_DIR} /py && ${PY_DIR} /bin/python3 -c " import versions; versions.cuda_version()" )
116
+ TORCHTRT_VERSION=$( cd ${PROJECT_DIR} /py && ${PY_DIR} /bin/python3 -c " import versions; versions.torch_tensorrt_version()" )
117
+ TRT_VERSION=$( cd ${PROJECT_DIR} /py && ${PY_DIR} /bin/python3 -c " import versions; versions.tensorrt_version()" )
118
+ CUDNN_VERSION=$( cd ${PROJECT_DIR} /py && ${PY_DIR} /bin/python3 -c " import versions; versions.cudnn_version()" )
109
119
TORCH_VERSION=$( ${PY_DIR} /bin/python -c " from torch import __version__;print(__version__.split('+')[0])" )
110
120
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
121
}
0 commit comments