Skip to content

Commit 534c0d9

Browse files
committed
chore: Adding CMake to the CI
1 parent 4d32d47 commit 534c0d9

File tree

1 file changed

+150
-6
lines changed

1 file changed

+150
-6
lines changed

.circleci/config.yml

+150-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:
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,26 @@ 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+
cmake -S. -Bbuild \
297+
-DCMAKE_MODULE_PATH=cmake/Module \
298+
-DTorch_DIR=/opt/circleci/.pyenv/versions/3.9.4/lib/python3.9/site-packages/torch/share/cmake/Torch \
299+
-DTensorRT_ROOT=/usr \
300+
-DCMAKE_BUILD_TYPE=Debug
301+
cmake --build build
302+
mkdir -p /tmp/dist/builds
303+
cp -r build /tmp/dist/builds
304+
210305
dump-test-env:
211306
description: "Dump the test env to console"
212307
steps:
@@ -632,7 +727,7 @@ jobs:
632727
platform: "x86_64"
633728
cudnn-version: << pipeline.parameters.cudnn-release-version >>
634729
trt-version-short: << pipeline.parameters.trt-release-version-short >>
635-
bazel-version: "5.1.1"
730+
bazel-version: << pipeline.parameters.bazel-version >>
636731
bazel-platform: "x86_64"
637732
- run:
638733
name: Build cxx11-abi tarball
@@ -703,7 +798,7 @@ jobs:
703798
platform: "sbsa"
704799
cudnn-version: << pipeline.parameters.cudnn-jetson-version >>
705800
trt-version-short: << pipeline.parameters.trt-jetson-version-short >>
706-
bazel-version: "5.1.1"
801+
bazel-version: << pipeline.parameters.bazel-version >>
707802
bazel-platform: "arm64"
708803
- run:
709804
name: Set python version
@@ -742,6 +837,45 @@ jobs:
742837
path: /tmp/dist/jetson
743838
destination: aarch64-release-pkgs
744839

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

746880
parameters:
747881
bazel-version:
@@ -821,7 +955,6 @@ workflows:
821955
jetpack-version: << pipeline.parameters.jetpack-version >>
822956
python-version: 3.8.10
823957

824-
825958
- build-x86_64-pyt-release:
826959
torch-build: << pipeline.parameters.torch-release-build >>
827960
torch-build-index: << pipeline.parameters.torch-release-build-index >>
@@ -855,7 +988,6 @@ workflows:
855988
requires:
856989
- build-x86_64-pyt-release
857990

858-
859991
- build-x86_64-pyt-nightly:
860992
torch-build: << pipeline.parameters.torch-nightly-build >>
861993
torch-build-index: << pipeline.parameters.torch-nightly-build-index >>
@@ -901,7 +1033,6 @@ workflows:
9011033
torch-build: << pipeline.parameters.torch-release-build >>
9021034
torch-build-index: << pipeline.parameters.torch-release-build-index >>
9031035

904-
9051036
- test-core-cpp-x86_64:
9061037
name: test-core-cpp-x86_64-pyt-release
9071038
channel: "release"
@@ -958,7 +1089,6 @@ workflows:
9581089
jetpack-version: << pipeline.parameters.jetpack-version >>
9591090
python-version: 3.8.10
9601091

961-
9621092
- build-x86_64-pyt-release:
9631093
torch-build: << pipeline.parameters.torch-release-build >>
9641094
torch-build-index: << pipeline.parameters.torch-release-build-index >>
@@ -1025,3 +1155,17 @@ workflows:
10251155
trt-version-long: << pipeline.parameters.trt-nightly-version-long >>
10261156
requires:
10271157
- build-x86_64-pyt-nightly
1158+
1159+
- build-x86_64-cmake:
1160+
name: build-x86_64-cmake-pyt-nightly
1161+
torch-build: << pipeline.parameters.torch-nightly-build >>
1162+
torch-build-index: << pipeline.parameters.torch-nightly-build-index >>
1163+
trt-version-short: << pipeline.parameters.trt-nightly-version-short >>
1164+
cudnn-version: << pipeline.parameters.cudnn-nightly-version >>
1165+
1166+
- build-x86_64-cmake:
1167+
name: build-x86_64-cmake-pyt-release
1168+
torch-build: << pipeline.parameters.torch-release-build >>
1169+
torch-build-index: << pipeline.parameters.torch-release-build-index >>
1170+
trt-version-short: << pipeline.parameters.trt-release-version-short >>
1171+
cudnn-version: << pipeline.parameters.cudnn-release-version >>

0 commit comments

Comments
 (0)