-
Notifications
You must be signed in to change notification settings - Fork 2.3k
187 lines (177 loc) · 6.78 KB
/
ubuntu-cuda.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
name: Ubuntu CUDA
on:
workflow_dispatch:
inputs:
developer_build:
description: 'Set to OFF for Release packages.'
required: false
default: 'ON'
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
GCE_GPU_CI_SA: ${{ secrets.GCE_GPU_CI_SA }}
GCE_CLI_GHA_VERSION: "416.0.0"
DEVELOPER_BUILD: ${{ github.event.inputs.developer_build || 'ON' }}
jobs:
skip-check:
runs-on: ubuntu-latest
name: Skip job for forks
outputs:
skip: ${{ steps.check.outputs.skip }}
steps:
- name: Skip check
id: check
run: |
if [ "${GITHUB_REPOSITORY}" == "isl-org/Open3D" ] && [ -n "${GCE_GPU_CI_SA}" ] ; then
echo "Secrets available: performing GCE test"
echo "skip=no" >> $GITHUB_OUTPUT
else
echo "Secrets not available: skipping GCE test"
echo "skip=yes" >> $GITHUB_OUTPUT
fi
build-and-run-docker:
name: Build and run
runs-on: ubuntu-latest
needs: [skip-check]
if: needs.skip-check.outputs.skip == 'no'
strategy:
fail-fast: false
matrix:
include:
- CI_CONFIG: 2-bionic
- CI_CONFIG: 3-ml-shared-bionic
- CI_CONFIG: 4-shared-bionic
- CI_CONFIG: 5-ml-focal
env:
# Export everything from matrix to be easily used.
# Docker tag and ccache names must be consistent with docker_build.sh
CI_CONFIG : ${{ matrix.CI_CONFIG }}
BUILD_PACKAGE : ${{ contains(fromJson('["3-ml-shared-bionic", "4-shared-bionic"]'), matrix.CI_CONFIG) }}
GCE_INSTANCE_PREFIX: open3d-ci-${{ matrix.CI_CONFIG }}
DOCKER_TAG : open3d-ci:${{ matrix.CI_CONFIG }}
CCACHE_TAR_NAME : open3d-ci-${{ matrix.CI_CONFIG }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: 'false'
- name: Package code
run: |
# GITHUB_WORKSPACE: /home/runner/work/Open3D/Open3D
cd "${GITHUB_WORKSPACE}/.."
tar -czvf Open3D.tar.gz Open3D
ls -alh
- name: GCloud CLI auth
uses: 'google-github-actions/auth@v1'
with:
project_id: ${{ secrets.GCE_PROJECT }}
credentials_json: '${{ secrets.GCE_SA_KEY_GPU_CI }}'
- name: GCloud CLI setup
uses: google-github-actions/setup-gcloud@v1
with:
version: ${{ env.GCE_CLI_GHA_VERSION }}
project_id: ${{ secrets.GCE_PROJECT }}
- name: VM create
run: |
INSTANCE_NAME="${GCE_INSTANCE_PREFIX}-${GITHUB_SHA::8}"
INSTANCE_ZONES=(us-west1-a
us-west1-b
us-central1-a
us-central1-b
us-central1-f
us-east1-c
us-east1-d
us-east4-b
southamerica-east1-c
europe-west2-b
europe-west3-b
europe-west4-b
europe-west4-c
europe-west2-a
asia-southeast1-b
asia-southeast1-c
australia-southeast1-a)
# GCE only supports GPU on n1-standard (2020/07)
ZONE_ID=0
until ((ZONE_ID >= ${#INSTANCE_ZONES[@]})) ||
gcloud compute instances create "$INSTANCE_NAME" \
--zone="${INSTANCE_ZONES[$ZONE_ID]}" \
--accelerator="count=2,type=nvidia-tesla-t4" \
--maintenance-policy="TERMINATE" \
--machine-type=n1-standard-8 \
--boot-disk-size="128GB" \
--boot-disk-type="pd-ssd" \
--image-family="ubuntu-os-docker-gpu-2004-lts" \
--metadata-from-file=startup-script=./util/gcloud_auto_clean.sh \
--scopes="storage-full,compute-rw" \
--service-account="$GCE_GPU_CI_SA"; do
((ZONE_ID = ZONE_ID + 1))
done
sleep 90
echo "GCE_ZONE=${INSTANCE_ZONES[$ZONE_ID]}" >> "${GITHUB_ENV}"
echo "INSTANCE_NAME=${INSTANCE_NAME}" >> "${GITHUB_ENV}"
exit $((ZONE_ID >= ${#INSTANCE_ZONES[@]})) # 0 => success
- name: VM copy code
run: |
gcloud compute scp \
"${GITHUB_WORKSPACE}/../Open3D.tar.gz" "${INSTANCE_NAME}":~ \
--zone "${GCE_ZONE}"
gcloud compute ssh "${INSTANCE_NAME}" \
--zone "${GCE_ZONE}" \
--command "ls -alh \
&& tar -xvzf Open3D.tar.gz \
&& ls -alh \
&& ls -alh Open3D \
&& nvidia-smi"
- name: VM build docker
run: |
if [ "${BUILD_PACKAGE}" == "true" ] && [ "$DEVELOPER_BUILD" == "OFF" ]; then
export RELEASE_TAG="-release"
fi
gcloud compute ssh "${INSTANCE_NAME}" \
--zone="${GCE_ZONE}" \
--command="sudo Open3D/docker/docker_build.sh ${CI_CONFIG}${RELEASE_TAG:-}"
if [ "${BUILD_PACKAGE}" == 'true' ]; then
gcloud compute scp --zone="${GCE_ZONE}" \
"${INSTANCE_NAME}":open3d-devel-linux*.tar.xz "$PWD"
fi
- name: Upload package
if: ${{ env.BUILD_PACKAGE == 'true' }}
uses: actions/upload-artifact@v3
with:
name: open3d-devel-linux-x86_64-cuda
path: open3d-devel-linux*.tar.xz
if-no-files-found: error
- name: Upload package to GCS bucket
if: ${{ github.ref == 'refs/heads/main' && env.BUILD_PACKAGE == 'true' }}
run: |
gcloud compute ssh "${INSTANCE_NAME}" \
--zone="${GCE_ZONE}" \
--command="ls -alh \
&& gsutil cp open3d-devel-linux-*.tar.xz \
gs://open3d-releases/devel/"
- name: VM run docker
run: |
gcloud compute ssh "${INSTANCE_NAME}" \
--zone="${GCE_ZONE}" \
--command="sudo Open3D/docker/docker_test.sh ${CI_CONFIG}"
- name: VM ccache upload
if: ${{ github.ref == 'refs/heads/main' }}
run: |
gcloud compute ssh "${INSTANCE_NAME}" \
--zone="${GCE_ZONE}" \
--command="ls -alh \
&& gsutil cp ${CCACHE_TAR_NAME}.tar.gz gs://open3d-ci-cache/"
- name: VM delete
if: always()
run: |
gcloud compute instances delete "${INSTANCE_NAME}" --zone "${GCE_ZONE}"
ls -alh "${HOME}/.ssh"
gcloud compute os-login describe-profile
gcloud compute os-login ssh-keys remove --key-file "${HOME}/.ssh/google_compute_engine.pub"