-
Notifications
You must be signed in to change notification settings - Fork 639
407 lines (396 loc) · 14.9 KB
/
build.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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
name: build
on:
push:
paths-ignore:
- ".github/scripts/**"
- "demo/**"
- "docker/**"
- "tools/**"
pull_request:
paths-ignore:
- ".github/scripts/**"
- "demo/**"
- "docker/**"
- "tools/**"
- "docs/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_cpu_model_convert:
runs-on: ubuntu-20.04
strategy:
matrix:
torch: [1.8.0, 1.9.0]
include:
- torch: 1.8.0
torchvision: 0.9.0
- torch: 1.9.0
torchvision: 0.10.0
steps:
- uses: actions/checkout@v2
- name: Install PyTorch
run: |
python -m pip install --upgrade pip
python -V
python -m pip show pip
python -m pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Install unittest dependencies
run: |
python -m pip install openmim
python -m pip install -r requirements.txt
python -m pip install -r requirements/backends.txt
python -m mim install "mmcv>=2.0.0"
python -m mim install -r requirements/codebases.txt
python -m pip install clip numba transformers numpy==1.23 albumentations
python -m pip list
- name: Install mmyolo
run: |
git clone -b dev --depth 1 https://github.com/open-mmlab/mmyolo.git /home/runner/work/mmyolo
python -m pip install -v -e /home/runner/work/mmyolo
- name: Install mmpose
run: |
git clone --depth 1 https://github.com/open-mmlab/mmpose.git /home/runner/work/mmpose
python -m pip install -v -e /home/runner/work/mmpose
- name: Build and install
run: |
rm -rf .eggs && python -m pip install -e .
python tools/check_env.py
- name: Run python unittests and generate coverage report
run: |
coverage run --branch --source mmdeploy -m pytest -rsE tests
coverage xml
coverage report -m
- name: Run mmyolo deploy unittests
id: badge_status
run: |
python -m pip install xdoctest
cd /home/runner/work/mmyolo
pytest tests/test_deploy
- name: create badge
if: always()
uses: RubbaBoy/[email protected]
with:
NAME: build_cpu_model_convert
LABEL: 'build'
STATUS: ${{ steps.badge_status.conclusion == 'success' && 'passing' || 'failing' }}
COLOR: ${{ steps.badge_status.conclusion == 'success' && 'green' || 'red' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_cpu_sdk:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: update
run: sudo apt update
- name: gcc-multilib
run: |
sudo apt install gcc-multilib g++-multilib wget libprotobuf-dev protobuf-compiler
sudo apt update
sudo apt install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libxrender-dev libc++1-9 libc++abi1-9
sudo apt install libopencv-dev lcov wget
- name: Build and run SDK unit test without backend
id: badge_status
run: |
mkdir -p build && pushd build
cmake .. -DCMAKE_CXX_COMPILER=g++ -DMMDEPLOY_CODEBASES=all -DMMDEPLOY_BUILD_SDK=ON -DMMDEPLOY_BUILD_SDK_PYTHON_API=OFF -DMMDEPLOY_TARGET_DEVICES=cpu -DMMDEPLOY_COVERAGE=ON -DMMDEPLOY_BUILD_TEST=ON
make -j2
mkdir -p mmdeploy_test_resources/transform
cp ../tests/data/tiger.jpeg mmdeploy_test_resources/transform/
./bin/mmdeploy_tests
lcov --capture --directory . --output-file coverage.info
ls -lah coverage.info
cp coverage.info ../
- name: create badge
if: always()
uses: RubbaBoy/[email protected]
with:
NAME: build_cpu_sdk
LABEL: 'build'
STATUS: ${{ steps.badge_status.conclusion == 'success' && 'passing' || 'failing' }}
COLOR: ${{ steps.badge_status.conclusion == 'success' && 'green' || 'red' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
cross_build_aarch64:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: update
run: sudo apt update
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: gcc-multilib
id: badge_status
run: |
sh -ex tools/scripts/ubuntu_cross_build_aarch64.sh
- name: create badge
if: always()
uses: RubbaBoy/[email protected]
with:
NAME: cross_build_aarch64
LABEL: 'build'
STATUS: ${{ steps.badge_status.conclusion == 'success' && 'passing' || 'failing' }}
COLOR: ${{ steps.badge_status.conclusion == 'success' && 'green' || 'red' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_cuda117:
runs-on: ubuntu-20.04
container:
image: pytorch/pytorch:2.0.0-cuda11.7-cudnn8-devel
env:
FORCE_CUDA: 1
steps:
- uses: actions/checkout@v2
- name: Install system dependencies
run: |
apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libxrender-dev
apt-get clean
rm -rf /var/lib/apt/lists/*
- name: Install PyTorch
run: |
python -V
python -m pip show torch torchvision
python -m pip install --no-cache-dir --upgrade pip
- name: Check disk space
continue-on-error: true
run: |
df -h
rm -rf /__t/go
rm -rf /__t/node
rm -rf /__t/Ruby
rm -rf /__t/CodeQL
cat /proc/cpuinfo | grep -ic proc
free
df -h
- name: Install dependencies
run: |
python -V
python -m pip install --no-cache-dir openmim
python -m pip install --no-cache-dir -r requirements.txt
python -m pip install --no-cache-dir -r requirements/backends.txt
python -m mim install "mmcv>=2.0.0"
python -m pip install --no-cache-dir -r requirements/codebases.txt
python -m pip install --no-cache-dir -U pycuda numpy==1.23 clip numba transformers albumentations
python -m pip list
- name: Build and install
run: |
rm -rf .eggs && python -m pip install -e .
python tools/check_env.py
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmdeploy -m pytest -rsE tests
coverage xml
coverage report -m
- name: Upload coverage to Codecov
id: badge_status
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml,./coverage.info
flags: unittests
env_vars: OS,PYTHON,CPLUS
name: codecov-umbrella
fail_ci_if_error: false
- name: create badge
if: always()
uses: RubbaBoy/[email protected]
with:
NAME: build_cuda117
LABEL: 'build'
STATUS: ${{ steps.badge_status.conclusion == 'success' && 'passing' || 'failing' }}
COLOR: ${{ steps.badge_status.conclusion == 'success' && 'green' || 'red' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_cuda113:
runs-on: ubuntu-20.04
container:
image: pytorch/pytorch:1.12.0-cuda11.3-cudnn8-devel
steps:
- uses: actions/checkout@v2
- name: Install system dependencies
run: |
apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libxrender-dev
apt-get clean
rm -rf /var/lib/apt/lists/*
- name: Install PyTorch
run: |
python -V
python -m pip show torch torchvision
python -m pip install --no-cache-dir --upgrade pip
- name: Check disk space
continue-on-error: true
run: |
df -h
rm -rf /__t/go
rm -rf /__t/node
rm -rf /__t/Ruby
rm -rf /__t/CodeQL
cat /proc/cpuinfo | grep -ic proc
free
df -h
- name: Install dependencies
run: |
python -V
python -m pip install --no-cache-dir openmim
python -m pip install --no-cache-dir -r requirements.txt
python -m pip install --no-cache-dir -r requirements/backends.txt
python -m mim install --no-cache-dir "mmcv>=2.0.0"
python -m pip install --no-cache-dir -r requirements/codebases.txt
python -m pip install --no-cache-dir -U pycuda numpy clip numba transformers albumentations
python -m pip list
- name: Build and install
run: |
rm -rf .eggs && python -m pip install -e .
python tools/check_env.py
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmdeploy -m pytest -rsE tests
coverage xml
coverage report -m
- name: create badge
if: always()
uses: RubbaBoy/[email protected]
with:
NAME: build_cuda113
LABEL: 'build'
STATUS: ${{ steps.badge_status.conclusion == 'success' && 'passing' || 'failing' }}
COLOR: ${{ steps.badge_status.conclusion == 'success' && 'green' || 'red' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_cuda118_linux:
needs: [build_cpu_model_convert, build_cpu_sdk, build_cuda117]
runs-on: [self-hosted, linux-3090]
container:
image: openmmlab/mmdeploy:ubuntu20.04-cuda11.8
options: "--gpus=all --ipc=host"
volumes:
- /data2/pip-cache:/root/.cache/pip
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
run: |
apt update && apt install unzip
python3 -V
python3 -m pip install opencv-python==4.5.4.60 opencv-python-headless==4.5.4.60 opencv-contrib-python==4.5.4.60
python3 -m pip install openmim numpy pycuda clip transformers
python3 -m pip install -r requirements.txt
python3 -m mim install $(cat requirements/codebases.txt | grep mmpretrain)
python3 -m pip list
- name: Build SDK
run: |
export Torch_DIR=$(python3 -c "import torch;print(torch.utils.cmake_prefix_path + '/Torch')")
bash .github/scripts/linux/build.sh "cpu;cuda" "ort;trt;ncnn;torchscript" \
-Dpplcv_DIR=${pplcv_DIR} \
-DTENSORRT_DIR=${TENSORRT_DIR} \
-DONNXRUNTIME_DIR=${ONNXRUNTIME_DIR} \
-Dncnn_DIR=${ncnn_DIR} \
-DTorch_DIR=${Torch_DIR}
ls build/lib
- name: Install converter
run: |
rm -rf .eggs && python3 -m pip install -e .
export LD_LIBRARY_PATH="/root/workspace/mmdeploy/build/lib:${LD_LIBRARY_PATH}"
python3 tools/check_env.py
- name: Test TensorRT pipeline
id: badge_status
run: |
export LD_LIBRARY_PATH="/root/workspace/mmdeploy/build/lib:${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH="/root/workspace/mmdeploy/mmdeploy/lib:${LD_LIBRARY_PATH}"
bash .github/scripts/linux/test_full_pipeline.sh trt cuda
- name: create badge
if: always()
uses: RubbaBoy/[email protected]
with:
NAME: build_cuda118_linux
LABEL: 'build'
STATUS: ${{ steps.badge_status.conclusion == 'success' && 'passing' || 'failing' }}
COLOR: ${{ steps.badge_status.conclusion == 'success' && 'green' || 'red' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_cuda118_windows:
needs: [build_cpu_model_convert, build_cpu_sdk, build_cuda117]
runs-on: [self-hosted, win10-3080]
env:
BASE_ENV: mmdeploy-cuda11.8-torch2.0-py38
defaults:
run:
shell: powershell
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Setup Python Environment
run: |
echo "============================== Info =============================="
echo "env:path= $env:path"
echo "============================== Info =============================="
conda info
conda info -e
$env:TEMP_ENV = "$pwd/../temp_envs/$env:GITHUB_RUN_ID"
New-Item -Path "$env:TEMP_ENV" -ItemType Directory -Force
echo "TEMP_ENV=$env:TEMP_ENV" >> $env:GITHUB_ENV
conda create -p $env:TEMP_ENV --clone $env:BASE_ENV -y
conda activate $env:TEMP_ENV
python -V
python -m pip install openmim
python -m pip install -r requirements.txt
python -m pip install -r requirements/backends.txt
python -m mim install "mmpretrain>=1.0.0rc7"
python -m pip list
- name: Build mmdeploy
run: |
conda activate $env:TEMP_ENV
python -V
mkdir build
cd build
cmake .. -A x64 -T v142,cuda=$env:CUDA_PATH `
-DMMDEPLOY_BUILD_TEST=ON `
-DMMDEPLOY_BUILD_SDK_CSHARP_API=ON `
-DMMDEPLOY_BUILD_SDK_PYTHON_API=ON `
-DMMDEPLOY_BUILD_SDK=ON `
-DMMDEPLOY_TARGET_DEVICES='cuda' `
-DMMDEPLOY_TARGET_BACKENDS='ort;trt' `
-DMMDEPLOY_CODEBASES='all' `
-Dpplcv_DIR="$env:pplcv_DIR" `
-DOpenCV_DIR="$env:OpenCV_DIR" `
-DTENSORRT_DIR="$env:TENSORRT_DIR" `
-DONNXRUNTIME_DIR="$env:ONNXRUNTIME_GPU_DIR" `
-DMMDEPLOY_BUILD_EXAMPLES=ON `
-DCUDNN_DIR="$env:CUDNN_DIR"
cmake --build . --config Release -- /m
cmake --install . --config Release
ls $pwd\bin\Release
- name: Install mmdeploy converter
run: |
conda activate $env:TEMP_ENV
python -m pip install -e .
python .\tools\check_env.py
- name: Test trt full pipeline
run: |
conda activate $env:TEMP_ENV
$env:path = "$pwd\build\bin\Release;" + $env:path
$env:path = "$env:ONNXRUNTIME_GPU_DIR\lib;" + $env:path
echo $env:path
.github\scripts\windows\test_full_pipeline.ps1 -Backend trt -Device cuda
- name: Clear temp env
if: always()
run: |
conda env remove --prefix "$env:TEMP_ENV"
badge_build_cuda118_windows:
needs: build_cuda118_windows
if: always()
runs-on: ubuntu-20.04
steps:
- name: create badge
uses: RubbaBoy/[email protected]
with:
NAME: build_cuda118_windows
LABEL: 'build'
STATUS: ${{ needs.build_cuda113_windows.result == 'success' && 'passing' || needs.build_cuda113_windows.result }}
COLOR: ${{ needs.build_cuda113_windows.result == 'success' && 'green' || 'red' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}