Skip to content

Commit a42b7b0

Browse files
committed
chore: Update CI
Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
1 parent 4267406 commit a42b7b0

File tree

5 files changed

+147
-31
lines changed

5 files changed

+147
-31
lines changed

.circleci/config.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ commands:
162162
- run:
163163
name: Build setup
164164
command: |
165-
mv toolchains/ci_workspaces/WORKSPACE.<< parameters.platform >> WORKSPACE
166-
cd py
165+
mv ~/project/toolchains/ci_workspaces/WORKSPACE.<< parameters.platform >> ~/project/WORKSPACE
167166
python3 -m pip install wheel setuptools
168167
python3 -m pip install pybind11==2.6.2
169168
- when:
@@ -172,6 +171,7 @@ commands:
172171
- run:
173172
name: Build torch-tensorrt python release package
174173
command: |
174+
cd ~/project/py
175175
python3 setup.py bdist_wheel --use-cxx11-abi --release
176176
python3 setup.py install --use-cxx11-abi --release
177177
mkdir -p /tmp/dist/builds
@@ -182,6 +182,7 @@ commands:
182182
- run:
183183
name: Build torch-tensorrt python package
184184
command: |
185+
cd ~/project/py
185186
python3 setup.py bdist_wheel --use-cxx11-abi
186187
python3 setup.py install --use-cxx11-abi
187188
mkdir -p /tmp/dist/builds
@@ -624,8 +625,8 @@ jobs:
624625
name: Build Python packages and pre-cxx11-abi tarball
625626
command: |
626627
cd ~/project/py/
627-
cp ~/project/toolchains/ci_workspaces/WORKSPACE.x86_64.release ~/project/WORKSPACE
628-
docker run -it --rm -v$(pwd)/..:/workspace/Torch-TensorRT torch_tensorrt_release_env /bin/bash /workspace/Torch-TensorRT/py/ci/build_whl.sh
628+
cp ~/project/toolchains/ci_workspaces/WORKSPACE.x86_64.release.rhel ~/project/WORKSPACE
629+
docker run -it --rm -v ~/project:/workspace/project torch_tensorrt_release_env /bin/bash /workspace/project/py/ci/build_whl.sh
629630
- create-env:
630631
os: "ubuntu2004"
631632
platform: "x86_64"
@@ -637,14 +638,17 @@ jobs:
637638
name: Build cxx11-abi tarball
638639
command: |
639640
set -e
640-
bazel build //:libtorchtrt -c opt
641+
cd ~/project/
642+
cp ~/project/toolchains/ci_workspaces/WORKSPACE.x86_64.release.ubuntu ~/project/WORKSPACE
643+
bazel build //:libtorchtrt -c opt --noshow_progress
644+
sudo chown -R $(whoami) ~/project/py
641645
CUDA_VERSION=$(cd ~/project/py/torch_tensorrt && python3 -c "from _version import __cuda_version__;print(__cuda_version__)")
642-
TORCHTRT_VERSION=$(cd torch_tensorrt && python3 -c "from _version import __version__;print(__version__)")
643-
TRT_VERSION=$(cd torch_tensorrt && python3 -c "from _version import __tensorrt_version__;print(__tensorrt_version__)")
644-
CUDNN_VERSION=$(cd torch_tensorrt && python3 -c "from _version import __cudnn_version__;print(__cudnn_version__)")
646+
TORCHTRT_VERSION=$(cd ~/project/py/torch_tensorrt && python3 -c "from _version import __version__;print(__version__)")
647+
TRT_VERSION=$(cd ~/project/py/torch_tensorrt && python3 -c "from _version import __tensorrt_version__;print(__tensorrt_version__)")
648+
CUDNN_VERSION=$(cd ~/project/py/torch_tensorrt && python3 -c "from _version import __cudnn_version__;print(__cudnn_version__)")
645649
pip3 install -r ~/project/py/requirements.txt
646650
TORCH_VERSION=$(python3 -c "from torch import __version__;print(__version__.split('+')[0])")
647-
cp ~/project/bazel-bin/libtorchtrt.tar.gz ~/project/py/dist/libtorchtrt-${TORCHTRT_VERSION}-cudnn${CUDNN_VERSION}-tensorrt${TRT_VERSION}-cuda${CUDA_VERSION}-libtorch-${TORCH_VERSION}.tar.gz
651+
cp ~/project/bazel-bin/libtorchtrt.tar.gz ~/project/py/dist/libtorchtrt-${TORCHTRT_VERSION}-cudnn${CUDNN_VERSION}-tensorrt${TRT_VERSION}-cuda${CUDA_VERSION}-libtorch${TORCH_VERSION}-x86_64-linux.tar.gz
648652
- run:
649653
name: Collect packages
650654
command: |
@@ -720,14 +724,15 @@ jobs:
720724
name: Build cxx11-abi tarball
721725
command: |
722726
set -e
723-
bazel build //:libtorchtrt -c opt
727+
cd ~/project/py/
728+
bazel build //:libtorchtrt -c opt --noshow_progress
724729
CUDA_VERSION=$(cd torch_tensorrt && python3 -c "from _version import __cuda_version__;print(__cuda_version__)")
725730
TORCHTRT_VERSION=$(cd torch_tensorrt && python3 -c "from _version import __version__;print(__version__)")
726731
TRT_VERSION=$(cd torch_tensorrt && python3 -c "from _version import __tensorrt_version__;print(__tensorrt_version__)")
727732
CUDNN_VERSION=$(cd torch_tensorrt && python3 -c "from _version import __cudnn_version__;print(__cudnn_version__)")
728733
pip3 install -r ~/project/py/requirements.txt
729734
TORCH_VERSION=$(python3 -c "from torch import __version__;print(__version__.split('+')[0])")
730-
cp ~/project/bazel-bin/libtorchtrt.tar.gz ~/project/py/dist/libtorchtrt-${TORCHTRT_VERSION}-cudnn${CUDNN_VERSION}-tensorrt${TRT_VERSION}-cuda${CUDA_VERSION}-libtorch-${TORCH_VERSION}.tar.gz
735+
cp ~/project/bazel-bin/libtorchtrt.tar.gz ~/project/py/dist/libtorchtrt-${TORCHTRT_VERSION}-cudnn${CUDNN_VERSION}-tensorrt${TRT_VERSION}-cuda${CUDA_VERSION}-libtorch${TORCH_VERSION}-aarch64-linux-jp<< parameters.jetpack-version >>.tar.gz
731736
- run:
732737
name: Move to release dir
733738
command: |
@@ -790,7 +795,7 @@ parameters:
790795
type: string
791796
default: "8.4.1.5"
792797

793-
packaging-enabled:
798+
enable-packaging:
794799
type: boolean
795800
default: false
796801

@@ -881,7 +886,7 @@ workflows:
881886
- build-x86_64-pyt-nightly
882887

883888
release:
884-
when: << pipeline.parameters.packaging-enabled >>
889+
when: << pipeline.parameters.enable-packaging >>
885890
jobs:
886891
- build-aarch64-pyt-jetson:
887892
torch-build: << pipeline.parameters.torch-jetson-build >>
@@ -925,7 +930,7 @@ workflows:
925930

926931
- package-x86_64:
927932
name: package-release-x86_64
928-
enabled: << pipeline.parameters.packaging-enabled >>
933+
enabled: << pipeline.parameters.enable-packaging >>
929934
torch-build: << pipeline.parameters.torch-release-build >>
930935
torch-build-index: << pipeline.parameters.torch-release-build-index >>
931936
requires:
@@ -935,7 +940,7 @@ workflows:
935940

936941
- package-jetson:
937942
name: package-release-aarch64-jetson
938-
enabled: << pipeline.parameters.packaging-enabled >>
943+
enabled: << pipeline.parameters.enable-packaging >>
939944
torch-build: << pipeline.parameters.torch-jetson-build >>
940945
jetpack-version: << pipeline.parameters.jetpack-version >>
941946
python-version: 3.8.10

py/build_whl.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@ build_py310() {
3131
#auditwheel repair --plat manylinux2014_x86_64
3232
}
3333

34+
#build_py311() {
35+
# /opt/python/cp311-cp311/bin/python -m pip install -r requirements.txt
36+
# /opt/python/cp311-cp311/bin/python setup.py bdist_wheel --release
37+
#auditwheel repair --plat manylinux2014_x86_64
38+
#}
39+
3440
build_py37
3541
build_py38
3642
build_py39
3743
build_py310
44+
#build_py311

py/ci/build_whl.sh

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

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

5-
cd /workspace/Torch-TensorRT/py
5+
cd /workspace/project/py
66

77
export CXX=g++
88
export CUDA_HOME=/usr/local/cuda-11.3
9+
PROJECT_DIR=/workspace/project
10+
11+
cp -r $CUDA_HOME /usr/local/cuda
912

1013
build_py37() {
1114
/opt/python/cp37-cp37m/bin/python -m pip install -r requirements.txt
@@ -31,31 +34,37 @@ build_py310() {
3134
#auditwheel repair --plat manylinux2014_x86_64
3235
}
3336

37+
#build_py311() {
38+
# /opt/python/cp311-cp311/bin/python -m pip install -r requirements.txt
39+
# /opt/python/cp311-cp311/bin/python setup.py bdist_wheel --release --ci
40+
# #auditwheel repair --plat manylinux2014_x86_64
41+
#}
42+
3443
build_libtorchtrt() {
3544
bazel clean
36-
bazel build //:libtorchtrt --platforms //toolchains:ci_rhel_x86_64_linux -c opt
37-
CUDA_VERSION=$(cd torch_tensorrt && python3 -c "from _version import __cuda_version__;print(__cuda_version__)")
38-
TORCHTRT_VERSION=$(cd torch_tensorrt && python3 -c "from _version import __version__;print(__version__)")
39-
TRT_VERSION=$(cd torch_tensorrt && python3 -c "from _version import __tensorrt_version__;print(__tensorrt_version__)")
40-
CUDNN_VERSION=$(cd torch_tensorrt && python3 -c "from _version import __cudnn_version__;print(__cudnn_version__)")
45+
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__)")
4150
TORCH_VERSION=$(/opt/python/cp310-cp310/bin/python -c "from torch import __version__;print(__version__.split('+')[0])")
42-
cp ../bazel-bin/libtorchtrt.tar.gz dist/libtorchtrt-${TORCHTRT_VERSION}-cudnn${CUDNN_VERSION}-tensorrt${TRT_VERSION}-cuda${CUDA_VERSION}-libtorch-${TORCH_VERSION}.tar.gz
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
4352
}
4453

4554
build_libtorchtrt_pre_cxx11_abi() {
46-
bazel build //:libtorchtrt --config pre_cxx11_abi --platforms //toolchains:ci_rhel_x86_64_linux -c opt
47-
CUDA_VERSION=$(cd torch_tensorrt && python3 -c "from _version import __cuda_version__;print(__cuda_version__)")
48-
TORCHTRT_VERSION=$(cd torch_tensorrt && python3 -c "from _version import __version__;print(__version__)")
49-
TRT_VERSION=$(cd torch_tensorrt && python3 -c "from _version import __tensorrt_version__;print(__tensorrt_version__)")
50-
CUDNN_VERSION=$(cd torch_tensorrt && python3 -c "from _version import __cudnn_version__;print(__cudnn_version__)")
55+
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__)")
5160
TORCH_VERSION=$(/opt/python/cp310-cp310/bin/python -c "from torch import __version__;print(__version__.split('+')[0])")
52-
cp ../bazel-bin/libtorchtrt.tar.gz dist/libtorchtrt-${TORCHTRT_VERSION}-pre-cxx11-abi-cudnn${CUDNN_VERSION}-tensorrt${TRT_VERSION}-cuda${CUDA_VERSION}-libtorch-${TORCH_VERSION}.tar.gz
53-
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
5462
}
5563

5664
build_py37
5765
build_py38
5866
build_py39
5967
build_py310
68+
#build_py311
6069
build_libtorchtrt_pre_cxx11_abi
61-
build_libtorchtrt
70+
#build_libtorchtrt

toolchains/ci_workspaces/WORKSPACE.x86_64.release renamed to toolchains/ci_workspaces/WORKSPACE.x86_64.release.rhel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ local_repository(
4141
new_local_repository(
4242
name = "cuda",
4343
build_file = "@//third_party/cuda:BUILD",
44-
path = "/usr/local/cuda-11.3/",
44+
path = "/usr/local/cuda-11.3",
4545
)
4646

4747
new_local_repository(
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
workspace(name = "Torch-TensorRT")
2+
3+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4+
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
5+
6+
http_archive(
7+
name = "rules_python",
8+
sha256 = "778197e26c5fbeb07ac2a2c5ae405b30f6cb7ad1f5510ea6fdac03bded96cc6f",
9+
url = "https://github.com/bazelbuild/rules_python/releases/download/0.2.0/rules_python-0.2.0.tar.gz",
10+
)
11+
12+
load("@rules_python//python:pip.bzl", "pip_install")
13+
14+
http_archive(
15+
name = "rules_pkg",
16+
sha256 = "038f1caa773a7e35b3663865ffb003169c6a71dc995e39bf4815792f385d837d",
17+
urls = [
18+
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.4.0/rules_pkg-0.4.0.tar.gz",
19+
"https://github.com/bazelbuild/rules_pkg/releases/download/0.4.0/rules_pkg-0.4.0.tar.gz",
20+
],
21+
)
22+
23+
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
24+
25+
rules_pkg_dependencies()
26+
27+
git_repository(
28+
name = "googletest",
29+
commit = "703bd9caab50b139428cea1aaff9974ebee5742e",
30+
remote = "https://github.com/google/googletest",
31+
shallow_since = "1570114335 -0400",
32+
)
33+
34+
# External dependency for torch_tensorrt if you already have precompiled binaries.
35+
local_repository(
36+
name = "torch_tensorrt",
37+
path = "/opt/circleci/.pyenv/versions/3.9.4/lib/python3.9/site-packages/torch_tensorrt"
38+
)
39+
40+
# CUDA should be installed on the system locally
41+
new_local_repository(
42+
name = "cuda",
43+
build_file = "@//third_party/cuda:BUILD",
44+
path = "/usr/local/cuda",
45+
)
46+
47+
new_local_repository(
48+
name = "cublas",
49+
build_file = "@//third_party/cublas:BUILD",
50+
path = "/usr",
51+
)
52+
#############################################################################################################
53+
# Tarballs and fetched dependencies (default - use in cases when building from precompiled bin and tarballs)
54+
#############################################################################################################
55+
56+
http_archive(
57+
name = "libtorch",
58+
build_file = "@//third_party/libtorch:BUILD",
59+
sha256 = "80f089939de20e68e3fcad4dfa72a26c8bf91b5e77b11042f671f39ebac35865",
60+
strip_prefix = "libtorch",
61+
urls = ["https://download.pytorch.org/libtorch/cu113/libtorch-cxx11-abi-shared-with-deps-1.12.0%2Bcu113.zip"],
62+
)
63+
64+
http_archive(
65+
name = "libtorch_pre_cxx11_abi",
66+
build_file = "@//third_party/libtorch:BUILD",
67+
sha256 = "8e35371403f7052d9e9b43bcff383980dbde4df028986dc1dab539953481d55f",
68+
strip_prefix = "libtorch",
69+
urls = ["https://download.pytorch.org/libtorch/cu113/libtorch-shared-with-deps-1.12.0%2Bcu113.zip"],
70+
)
71+
72+
####################################################################################
73+
# Locally installed dependencies (use in cases of custom dependencies or aarch64)
74+
####################################################################################
75+
76+
new_local_repository(
77+
name = "cudnn",
78+
path = "/usr/",
79+
build_file = "@//third_party/cudnn/local:BUILD"
80+
)
81+
82+
new_local_repository(
83+
name = "tensorrt",
84+
path = "/usr/",
85+
build_file = "@//third_party/tensorrt/local:BUILD"
86+
)
87+
88+
# #########################################################################
89+
# # Testing Dependencies (optional - comment out on aarch64)
90+
# #########################################################################
91+
92+
pip_install(
93+
name = "pylinter_deps",
94+
requirements = "//tools/linter:requirements.txt",
95+
)

0 commit comments

Comments
 (0)