Skip to content

Commit b3b2ddd

Browse files
authored
chore: Adding CMake to the CI (#1310)
* chore: Adding CMake to the CI * Updated config.yml * Updated config.yml * Updated config.yml * Updated config.yml * Updated config.yml * chore: Adding CMake to the CI * Updated config.yml
1 parent fac80ec commit b3b2ddd

File tree

1 file changed

+154
-6
lines changed

1 file changed

+154
-6
lines changed

.circleci/config.yml

+154-6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,81 @@ commands:
1919
sudo wget -q https://github.com/bazelbuild/bazel/releases/download/<< parameters.version >>/bazel-<< parameters.version >>-linux-<< parameters.platform >> -O /usr/bin/bazel
2020
sudo chmod a+x /usr/bin/bazel
2121
22+
install-cmake:
23+
description: Install CMake.
24+
parameters:
25+
cache:
26+
default: true
27+
description: Whether or not to cache the installation.
28+
type: boolean
29+
cache-key:
30+
default: v1
31+
description: String to use in cache key. Typically overridden when needed to bust cache.
32+
type: string
33+
install-dir:
34+
default: $HOME/cmake
35+
description: The path to install CMake to.
36+
type: string
37+
version:
38+
default: 3.18.2
39+
description: The version of CMake to install.
40+
type: string
41+
steps:
42+
- when:
43+
condition:
44+
equal:
45+
- << parameters.cache >>
46+
- true
47+
steps:
48+
- run:
49+
command: mkdir -pv << parameters.install-dir >>
50+
name: Prep cache restore
51+
- restore_cache:
52+
keys:
53+
- cmake-<< parameters.cache-key >>-<< parameters.version >>
54+
- run:
55+
command: |
56+
echo 'export PATH="<< parameters.install-dir >>/bin:$PATH"' >> $BASH_ENV
57+
name: Add CMake to PATH
58+
- run:
59+
command: |
60+
if which cmake; then
61+
if cmake --version | grep "<< parameters.version >>"; then
62+
echo "CMake is already installed."
63+
exit 0
64+
else
65+
echo "CMake is already installed but it is the wrong version."
66+
fi
67+
fi
68+
69+
rm -rf << parameters.install-dir >>/*
70+
echo "Installing the requested version of CMake."
71+
baseUrl="https://github.com/Kitware/CMake/releases/download/"
72+
url="${baseUrl}/v<< parameters.version >>/cmake-<< parameters.version >>-Linux-x86_64.tar.gz"
73+
curl -sSL -o /tmp/cmake.tar.gz $url
74+
tar -C << parameters.install-dir >> --strip-components 1 -zxf /tmp/cmake.tar.gz
75+
name: Install CMake
76+
- run:
77+
command: rm -rf << parameters.install-dir >>/{doc,man}
78+
name: Remove unnecessary files
79+
- run:
80+
command: |
81+
ls -l << parameters.install-dir >>/bin
82+
echo $PATH
83+
cmake --version
84+
name: Verify CMake installation
85+
- when:
86+
condition:
87+
equal:
88+
- << parameters.cache >>
89+
- true
90+
steps:
91+
- save_cache:
92+
key: cmake-<< parameters.cache-key >>-<< parameters.version >>
93+
paths:
94+
- << parameters.install-dir >>
95+
96+
2297
install-cuda:
2398
description: "Install CUDA"
2499
parameters:
@@ -207,6 +282,30 @@ commands:
207282
mkdir -p /tmp/dist/builds
208283
cp dist/* /tmp/dist/builds
209284
285+
build-cmake:
286+
description: "Build the torch-tensorrt using CMake"
287+
parameters:
288+
platform:
289+
type: string
290+
default: "x86_64"
291+
steps:
292+
- run:
293+
name: Build torch-tensorrt library with CMake
294+
command: |
295+
mkdir build
296+
export PATH=$PATH:/usr/local/cuda/bin
297+
~/cmake/bin/cmake -S. -Bbuild \
298+
-DCMAKE_MODULE_PATH=cmake/Module \
299+
-DTorch_DIR=/opt/circleci/.pyenv/versions/3.9.4/lib/python3.9/site-packages/torch/share/cmake/Torch \
300+
-DTensorRT_ROOT=/usr \
301+
-DCMAKE_BUILD_TYPE=Debug
302+
cmake --build build -j4
303+
mkdir -p /tmp/dist/builds
304+
cp -r build/bin /tmp/dist/builds
305+
cp -r build/lib /tmp/dist/builds
306+
cp -r cpp/include /tmp/dist/builds
307+
308+
210309
dump-test-env:
211310
description: "Dump the test env to console"
212311
steps:
@@ -632,7 +731,7 @@ jobs:
632731
platform: "x86_64"
633732
cudnn-version: << pipeline.parameters.cudnn-release-version >>
634733
trt-version-short: << pipeline.parameters.trt-release-version-short >>
635-
bazel-version: "5.1.1"
734+
bazel-version: << pipeline.parameters.bazel-version >>
636735
bazel-platform: "x86_64"
637736
- run:
638737
name: Build cxx11-abi tarball
@@ -703,7 +802,7 @@ jobs:
703802
platform: "sbsa"
704803
cudnn-version: << pipeline.parameters.cudnn-jetson-version >>
705804
trt-version-short: << pipeline.parameters.trt-jetson-version-short >>
706-
bazel-version: "5.1.1"
805+
bazel-version: << pipeline.parameters.bazel-version >>
707806
bazel-platform: "arm64"
708807
- run:
709808
name: Set python version
@@ -742,6 +841,45 @@ jobs:
742841
path: /tmp/dist/jetson
743842
destination: aarch64-release-pkgs
744843

844+
build-x86_64-cmake:
845+
parameters:
846+
cudnn-version:
847+
type: string
848+
trt-version-short:
849+
type: string
850+
torch-build:
851+
type: string
852+
torch-build-index:
853+
type: string
854+
machine:
855+
image: ubuntu-2004-cuda-11.4:202110-01
856+
resource_class: gpu.nvidia.small
857+
steps:
858+
- checkout
859+
- create-env:
860+
os: "ubuntu2004"
861+
platform: "x86_64"
862+
cudnn-version: << parameters.cudnn-version >>
863+
trt-version-short: << parameters.trt-version-short >>
864+
bazel-platform: "x86_64"
865+
- install-cmake:
866+
version: 3.24.1
867+
- install-torch-from-index:
868+
torch-build: << parameters.torch-build >>
869+
torch-build-index: << parameters.torch-build-index >>
870+
- build-cmake
871+
- run:
872+
name: Move to cmake build dir
873+
command: |
874+
mkdir -p /tmp/dist/cmake
875+
cp -r /tmp/dist/builds/* /tmp/dist/cmake
876+
- persist_to_workspace:
877+
root: /tmp/dist
878+
paths:
879+
- cmake
880+
- store_artifacts:
881+
path: /tmp/dist/cmake
882+
destination: x86_64-cmake
745883

746884
parameters:
747885
bazel-version:
@@ -821,7 +959,6 @@ workflows:
821959
jetpack-version: << pipeline.parameters.jetpack-version >>
822960
python-version: 3.8.10
823961

824-
825962
- build-x86_64-pyt-release:
826963
torch-build: << pipeline.parameters.torch-release-build >>
827964
torch-build-index: << pipeline.parameters.torch-release-build-index >>
@@ -855,7 +992,6 @@ workflows:
855992
requires:
856993
- build-x86_64-pyt-release
857994

858-
859995
- build-x86_64-pyt-nightly:
860996
torch-build: << pipeline.parameters.torch-nightly-build >>
861997
torch-build-index: << pipeline.parameters.torch-nightly-build-index >>
@@ -901,7 +1037,6 @@ workflows:
9011037
torch-build: << pipeline.parameters.torch-release-build >>
9021038
torch-build-index: << pipeline.parameters.torch-release-build-index >>
9031039

904-
9051040
- test-core-cpp-x86_64:
9061041
name: test-core-cpp-x86_64-pyt-release
9071042
channel: "release"
@@ -958,7 +1093,6 @@ workflows:
9581093
jetpack-version: << pipeline.parameters.jetpack-version >>
9591094
python-version: 3.8.10
9601095

961-
9621096
- build-x86_64-pyt-release:
9631097
torch-build: << pipeline.parameters.torch-release-build >>
9641098
torch-build-index: << pipeline.parameters.torch-release-build-index >>
@@ -1025,3 +1159,17 @@ workflows:
10251159
trt-version-long: << pipeline.parameters.trt-nightly-version-long >>
10261160
requires:
10271161
- build-x86_64-pyt-nightly
1162+
1163+
- build-x86_64-cmake:
1164+
name: build-x86_64-cmake-pyt-nightly
1165+
torch-build: << pipeline.parameters.torch-nightly-build >>
1166+
torch-build-index: << pipeline.parameters.torch-nightly-build-index >>
1167+
trt-version-short: << pipeline.parameters.trt-nightly-version-short >>
1168+
cudnn-version: << pipeline.parameters.cudnn-nightly-version >>
1169+
1170+
- build-x86_64-cmake:
1171+
name: build-x86_64-cmake-pyt-release
1172+
torch-build: << pipeline.parameters.torch-release-build >>
1173+
torch-build-index: << pipeline.parameters.torch-release-build-index >>
1174+
trt-version-short: << pipeline.parameters.trt-release-version-short >>
1175+
cudnn-version: << pipeline.parameters.cudnn-release-version >>

0 commit comments

Comments
 (0)