forked from PaddlePaddle/Paddle
-
Notifications
You must be signed in to change notification settings - Fork 0
339 lines (322 loc) · 13.1 KB
/
Copy path_Distribute-stable.yml
File metadata and controls
339 lines (322 loc) · 13.1 KB
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
name: Distribute-stable
on:
workflow_call:
inputs:
docker_distribute_image:
type: string
required: true
env:
PR_ID: ${{ github.event.pull_request.number }}
COMMIT_ID: ${{ github.event.pull_request.head.sha }}
work_dir: /paddle
PADDLE_ROOT: /paddle
TASK: paddle-CI-${{ github.event.pull_request.number }}-distribute
ci_scripts: /paddle/ci
BRANCH: ${{ github.event.pull_request.base.ref }}
CI_name: distribute
no_proxy: bcebos.com,apiin.im.baidu.com,gitee.com,aliyun.com,.baidu.com,.tuna.tsinghua.edu.cn,paddlepaddle.org.cn
docker_image: ${{ inputs.docker_distribute_image }}
defaults:
run:
shell: bash
jobs:
check-bypass:
name: Check bypass
uses: ./.github/workflows/check-bypass.yml
with:
workflow-name: 'skip ci'
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
data-storage:
name: Performance data storage
needs: check-bypass
if: false
runs-on: ubuntu-latest
steps:
- name: Check docker image and run container
env:
FLAGS_fraction_of_gpu_memory_to_use: 0.15
CTEST_OUTPUT_ON_FAILURE: 1
CTEST_PARALLEL_LEVEL: 4
WITH_GPU: "ON"
WITH_AVX: "ON"
WITH_MKL: "OFF"
WITH_PYTHON: "ON"
WITH_DISTRIBUTE: "ON"
WITH_TESTING: "ON"
WITH_INFERENCE_API_TEST: "OFF"
COVERALLS_UPLOAD: "ON"
PADDLE_VERSION: 0.0.0
CUDA_VISIBLE_DEVICES: 0,1
GIT_PR_ID: ${{ github.event.pull_request.number }}
GPUBOX_DEMO_INSTALL_DIR: /root/.cache/build
INFERENCE_DEMO_INSTALL_DIR: /root/.cache/python35
PY_VERSION: "3.10"
WITH_TENSORRT: "OFF"
GENERATOR: "Ninja"
WITH_SHARED_PHI: "ON"
CUDA_ARCH_NAME: Ampere
WITH_CUDNN_FRONTEND: "ON"
FLAGS_enable_cudnn_frontend: 1
CACHE_DIR: /root/.cache/build
CCACHE_DIR: /root/.ccache/gpubox
CCACHE_MAXSIZE: 150G
CCACHE_LIMIT_MULTIPLE: 0.8
CCACHE_STATSLOG: /paddle/build/.stats.log
CCACHE_SLOPPINESS: clang_index_store,time_macros,include_file_mtime
run: |
container_name=${TASK}-build-$(date +%Y%m%d-%H%M%S)
echo "container_name=${container_name}" >> ${{ github.env }}
docker run -d -t --name ${container_name} \
-v "/home/data/cfs:/home/data/cfs" \
-v "/home/data/cfs/.cache/:/root/.cache" \
-v "/home/data/cfs/.ccache:/root/.ccache" \
-v "/dev/shm:/dev/shm" \
-v ${{ github.workspace }}/../../..:${{ github.workspace }}/../../.. \
-v ${{ github.workspace }}:/paddle \
-e BRANCH \
-e PR_ID \
-e COMMIT_ID \
-e work_dir \
-e PADDLE_ROOT \
-e ci_scripts \
-e CI_name \
-e WITH_SHARED_PHI \
-e WITH_MKL \
-e WITH_TESTING \
-e COVERALLS_UPLOAD \
-e GIT_PR_ID \
-e PADDLE_VERSION \
-e WITH_DISTRIBUTE \
-e PY_VERSION \
-e WITH_TENSORRT \
-e GENERATOR \
-e CCACHE_MAXSIZE \
-e CCACHE_LIMIT_MULTIPLE \
-e WITH_AVX \
-e WITH_PYTHON \
-e CACHE_DIR \
-e CCACHE_DIR \
-e CCACHE_STATSLOG \
-e CCACHE_SLOPPINESS \
-e FLAGS_fraction_of_gpu_memory_to_use \
-e CTEST_OUTPUT_ON_FAILURE \
-e CTEST_PARALLEL_LEVEL \
-e WITH_GPU \
-e WITH_INFERENCE_API_TEST \
-e CUDA_VISIBLE_DEVICES \
-e GPUBOX_DEMO_INSTALL_DIR \
-e INFERENCE_DEMO_INSTALL_DIR \
-e CUDA_ARCH_NAME \
-e WITH_CUDNN_FRONTEND \
-e FLAGS_enable_cudnn_frontend \
-e no_proxy \
-w /paddle --network host ${docker_image}
- name: Download paddle.tar.gz and merge target branch
env:
work_dir: ${{ github.workspace }}
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
mkdir -p /root/.cache/build
mkdir -p /root/.ccache/gpubox
rm -rf * .[^.]*
set -e
echo "Downloading Paddle.tar.gz"
wget -q --tries=5 --no-proxy https://paddle-github-action.bj.bcebos.com/PR/Paddle/${PR_ID}/${COMMIT_ID}/Paddle.tar.gz --no-check-certificate
echo "Extracting Paddle.tar.gz"
tar -xf Paddle.tar.gz --strip-components=1
rm Paddle.tar.gz
git remote -v
set +e
git remote add upstream https://github.com/PaddlePaddle/Paddle.git
set -e
source ${{ github.workspace }}/../../../proxy
git checkout test
echo "Pull upstream develop"
bash ci/git_pull.sh $BRANCH
'
- name: Check bypass
id: check-bypass
uses: ./.github/actions/check-bypass
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
workflow-name: distribute
- name: Download flashattn cache
if: steps.check-bypass.outputs.can-skip != 'true'
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
set +e
flashattn_version=$(git submodule status | grep flashattn | awk "{print \$1}" | sed "s#-##g")
echo "flashattn_version=${flashattn_version}" >> ${{ github.env }}
wget -q --tries=5 --no-proxy https://paddle-github-action.bj.bcebos.com/PR/gpups/flashattn_cache/flashattn_libs_${flashattn_version}.tar.gz --no-check-certificate; FACODE=$?
if [ $FACODE -ne 0 ]; then
echo "flashattn_cached_package=true" >> ${{ github.env }}
fi
'
- name: Build
if: steps.check-bypass.outputs.can-skip != 'true'
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
source ${{ github.workspace }}/../../../proxy
bash ${ci_scripts}/cmake-predownload.sh
bash ${ci_scripts}/run_setup.sh bdist_wheel
'
- name: Packaging of products
if: steps.check-bypass.outputs.can-skip != 'true'
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
if [ "${{ env.flashattn_cached_package }}" == "true" ]; then
cd ${work_dir}/build/third_party/install/flashattn/lib
mkdir flashattn_libs_${{ env.flashattn_version }} && cd flashattn_libs_${{ env.flashattn_version }}
mkdir fa_libs && cp ../lib*.so fa_libs && tar -zcf fa_libs.tar ./fa_libs && rm -rf ./fa_libs
md5sum fa_libs.tar |awk "{print \$1}" >MD5.txt
cd .. && tar -zcf flashattn_libs_${{ env.flashattn_version }}.tar ./flashattn_libs_${{ env.flashattn_version }}
fi
bash ${ci_scripts}/compress_build.sh
cd ${work_dir}/..
tar --use-compress-program="pzstd -1" --warning=no-file-changed -cf Paddle.tar.gz paddle
'
- name: Upload product to bos
if: steps.check-bypass.outputs.can-skip != 'true'
env:
home_path: ${{ github.workspace }}/..
bos_file: ${{ github.workspace }}/../bos_retry/BosClient.py
paddle_whl: paddlepaddle_gpu-0.0.0-cp310-cp310-linux_x86_64.whl
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
set -x
export AK=paddle
export SK=paddle
source ${{ github.workspace }}/../../../proxy
echo "::group::Install bce-python-sdk"
python -m pip install bce-python-sdk==0.8.74
echo "::endgroup::"
if [ ! -f "${{ env.bos_file }}" ]; then
wget -q --no-proxy -O ${{ env.home_path }}/bos_retry.tar.gz https://xly-devops.bj.bcebos.com/home/bos_retry.tar.gz --no-check-certificate
mkdir ${{ env.home_path }}/bos_retry
tar xf ${{ env.home_path }}/bos_retry.tar.gz -C ${{ env.home_path }}/bos_retry
fi
cd ..
source ${{ github.workspace }}/../../../unproxy
echo "Uploading Paddle.tar.gz to bos"
python ${{ env.bos_file }} Paddle.tar.gz paddle-github-action/PR/gpups/${{ env.PR_ID }}/${{ env.COMMIT_ID }}
echo "Uploading whl to bos"
mv ${work_dir}/dist/${{ env.paddle_whl }} .
python ${{ env.bos_file }} ${{ env.paddle_whl }} paddle-github-action/PR/gpups/${{ env.PR_ID }}/${{ env.COMMIT_ID }}
if [ "${{ env.flashattn_cached_package }}" == "true" ]; then
echo "Uploading flashattn_libs_${flashattn_version}.tar.gz to bos"
mv ${work_dir}/build/third_party/install/flashattn/lib/flashattn_libs_${{ env.flashattn_version }}.tar .
python ${{ env.bos_file }} flashattn_libs_${{ env.flashattn_version }}.tar paddle-github-action/PR/gpups/flashattn_cache
fi
rm -rf Paddle.tar.gz ${{ env.paddle_whl }} flashattn_libs_${flashattn_version}.tar
'
- name: Terminate and delete the container
if: ${{ steps.check-bypass.outputs.can-skip != 'true' && always() }}
run: |
set +e
docker exec -t ${{ env.container_name }} /bin/bash -c 'rm -rf * .[^.]*'
docker rm -f ${{ env.container_name }}
test:
name: Test
if: false
runs-on:
group: Distribute
steps:
- name: Check docker image and run container
env:
FLAGS_fraction_of_gpu_memory_to_use: 0.15
CTEST_OUTPUT_ON_FAILURE: 1
CTEST_PARALLEL_LEVEL: 4
WITH_GPU: "ON"
WITH_AVX: "ON"
WITH_DISTRIBUTE: "ON"
WITH_TESTING: "ON"
WITH_COVERAGE: "OFF"
CMAKE_BUILD_TYPE: Release
PADDLE_FRACTION_GPU_MEMORY_TO_USE: 0.15
PRECISION_TEST: "OFF"
WITH_UNITY_BUILD: "ON"
AGILE_COMPILE_BRANCH: ${{ github.event.pull_request.base.ref }}
AGILE_REVISION: ${{ github.event.pull_request.head.sha }}
WITH_INCREMENTAL_COVERAGE: "OFF"
WITH_ONNXRUNTIME: "OFF"
COVERALLS_UPLOAD: "ON"
PADDLE_VERSION: 0.0.0
GIT_PR_ID: ${{ github.event.pull_request.number }}
PY_VERSION: "3.10"
CUDA_ARCH_NAME: Auto
WITH_CUDNN_FRONTEND: "ON"
FLAGS_enable_cudnn_frontend: 1
CACHE_DIR: /root/.cache/build
CCACHE_DIR: /root/.ccache/gpubox
run: |
export CUDA_SO="$(\ls -d /usr/lib64/libcuda* | xargs -I{} echo '-v {}:{}') $(\ls -d /usr/lib64/libnvidia* | xargs -I{} echo '-v {}:{}')"
export DEVICES="$(\ls -d /dev/nvidia* | xargs -I{} echo "-v {}:{}") $(\ls /dev/nvidia-caps/* | xargs -I{} echo "-v {}:{}")"
export SMI="-v /usr/bin/nvidia-smi:/usr/bin/nvidia-smi"
container_name=${TASK}-test-$(date +%Y%m%d-%H%M%S)
echo "container_name=${container_name}" >> ${{ github.env }}
docker run -d -t --name ${container_name} ${CUDA_SO} ${DEVICES} ${SMI} --runtime=nvidia --shm-size=32G \
-v "/home/data/cfs:/home/data/cfs" \
-v "/home/data/cfs/.cache/:/root/.cache" \
-v "/home/data/cfs/.ccache:/root/.ccache" \
-v "/ssd1/root:/root" \
-v "/dev/shm:/dev/shm" \
-v ${{ github.workspace }}/../../..:${{ github.workspace }}/../../.. \
-v ${{ github.workspace }}:/paddle \
-e BRANCH \
-e PR_ID \
-e COMMIT_ID \
-e work_dir \
-e PADDLE_ROOT \
-e ci_scripts \
-e CI_name \
-e FLAGS_fraction_of_gpu_memory_to_use \
-e CTEST_OUTPUT_ON_FAILURE \
-e CTEST_PARALLEL_LEVEL \
-e WITH_GPU \
-e WITH_AVX \
-e WITH_DISTRIBUTE \
-e WITH_TESTING \
-e WITH_COVERAGE \
-e CMAKE_BUILD_TYPE \
-e PADDLE_FRACTION_GPU_MEMORY_TO_USE \
-e PRECISION_TEST \
-e WITH_UNITY_BUILD \
-e AGILE_COMPILE_BRANCH \
-e AGILE_REVISION \
-e WITH_INCREMENTAL_COVERAGE \
-e WITH_ONNXRUNTIME \
-e COVERALLS_UPLOAD \
-e PADDLE_VERSION \
-e GIT_PR_ID \
-e PY_VERSION \
-e CUDA_ARCH_NAME \
-e WITH_CUDNN_FRONTEND \
-e FLAGS_enable_cudnn_frontend \
-e CACHE_DIR \
-e CCACHE_DIR \
-e no_proxy \
-w /paddle --network host ${docker_image}
- name: Download paddle.tar.gz and merge target branch
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
rm -rf * .[^.]*
echo "Downloading Paddle.tar.gz"
wget -q --tries=5 --no-proxy https://paddle-github-action.bj.bcebos.com/PR/gpups/${{ env.PR_ID }}/${{ env.COMMIT_ID }}/Paddle.tar.gz --no-check-certificate
echo "Extracting Paddle.tar.gz"
tar --use-compress-program="pzstd" -xf Paddle.tar.gz --strip-components=1
rm Paddle.tar.gz
git checkout test
'
- name: Test
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
source ${{ github.workspace }}/../../../proxy
bash ${ci_scripts}/distribute_test.sh
'
- name: Terminate and delete the container
if: always()
run: |
set +e
docker exec -t ${{ env.container_name }} /bin/bash -c 'rm -rf * .[^.]*'
docker rm -f ${{ env.container_name }}