Repository navigation
283 lines (268 loc) · 9.93 KB
/
Copy path_Linux-XPU.yml
File metadata and controls
283 lines (268 loc) · 9.93 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
name: Linux-XPU
on:
workflow_call:
inputs:
docker_xpu_image:
type: string
required: true
clone-can-skip:
type: string
required: false
default: "false"
env:
docker_image: ${{ inputs.docker_xpu_image }}
PR_ID: ${{ github.event.pull_request.number }}
COMMIT_ID: ${{ github.event.pull_request.head.sha }}
ci_scripts: /paddle/ci
ci_scripts_runner: ${{ github.workspace }}/ci
work_dir: /paddle
PADDLE_ROOT: /paddle
BRANCH: ${{ github.event.pull_request.base.ref }}
CI_name: xpu
no_proxy: "bcebos.com,apiin.im.baidu.com,gitee.com,aliyun.com,.baidu.com,.tuna.tsinghua.edu.cn"
defaults:
run:
shell: bash
jobs:
check-bypass:
name: Check bypass
uses: ./.github/workflows/check-bypass.yml
with:
workflow-name: "xpu"
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build
needs: [check-bypass]
if: ${{ needs.check-bypass.outputs.can-skip != 'true' && inputs.clone-can-skip != 'true' }}
env:
TASK: paddle-CI-${{ github.event.pull_request.number }}-xpu_build
runs-on:
group: XPU-build
timeout-minutes: 120
steps:
- name: Check docker image and run container
env:
WITH_SHARED_PHI: "ON"
WITH_XPU: "ON"
COVERALLS_UPLOAD: "OFF"
WITH_AVX: "OFF"
GIT_PR_ID: ${{ github.event.pull_request.number }}
PADDLE_VERSION: 0.0.0
WITH_TESTING: "ON"
WITH_DISTRIBUTE: "ON"
PY_VERSION: "3.10"
XPU_VISIBLE_DEVICES: "0,1"
WITH_XPU_BKCL: "ON"
WITH_XPU_FFT: "ON"
WITH_XPU_XRE5: "ON"
CACHE_DIR: /root/.cache
CCACHE_DIR: /root/.ccache
CCACHE_MAXSIZE: 150G
CCACHE_LIMIT_MULTIPLE: 0.8
IF_KUNLUN3: "OFF"
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
home_dir: ${{ github.workspace }}/../../../..
run: |
container_name=${TASK}-$(date +%Y%m%d-%H%M%S)
echo "container_name=${container_name}" >> ${{ github.env }}
docker run --ulimit nofile=102400:102400 -d -t --name ${container_name} \
-v $home_dir/.cache:/root/.cache \
-v $home_dir/.ccache:/root/.ccache \
-v ${{ github.workspace }}/../../..:${{ github.workspace }}/../../.. \
-v ${{ github.workspace }}:/paddle \
-e BRANCH \
-e PR_ID \
-e COMMIT_ID \
-e work_dir \
-e PADDLE_ROOT \
-e WITH_SHARED_PHI \
-e WITH_XPU \
-e COVERALLS_UPLOAD \
-e GIT_PR_ID \
-e PADDLE_VERSION \
-e WITH_TESTING \
-e WITH_DISTRIBUTE \
-e PY_VERSION \
-e XPU_VISIBLE_DEVICES \
-e WITH_XPU_BKCL \
-e WITH_XPU_FFT \
-e WITH_XPU_XRE5 \
-e WITH_INFERENCE_API_TEST \
-e CACHE_DIR \
-e CCACHE_DIR \
-e CCACHE_MAXSIZE \
-e CCACHE_LIMIT_MULTIPLE \
-e ci_scripts \
-e WITH_AVX \
-e IF_KUNLUN3 \
-e no_proxy \
-e GITHUB_API_TOKEN \
-e CI_name \
-w /paddle --network host ${docker_image} /bin/bash
- name: Download paddle.tar.gz and update test branch
timeout-minutes: 30
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
ulimit -n 102400
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"
git config --global --add safe.directory ${work_dir}
tar -xf Paddle.tar.gz --strip-components=1
git submodule foreach "git config --global --add safe.directory \$toplevel/\$sm_path"
rm Paddle.tar.gz
git config --global user.name "PaddleCI"
git config --global user.email "paddle_ci@example.com"
git remote add upstream https://github.com/PaddlePaddle/Paddle.git
source ${{ github.workspace }}/../../../proxy
git config pull.rebase false
git checkout test
echo "Pull upstream develop or target branch"
bash ci/git_pull.sh $BRANCH
git submodule update
'
- name: Run build
env:
work_dir: ${{ github.workspace }}
PADDLE_ROOT: ${{ github.workspace }}
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
source ${{ github.workspace }}/../../../proxy
bash ${ci_scripts}/cmake-predownload.sh
apt install zstd -y
bash ${ci_scripts}/run_setup.sh bdist_wheel
EXCODE=$?
python -m pip install bce-python-sdk==0.8.74
bash ${ci_scripts}/compress_build.sh
exit $EXCODE
'
- name: Upload build.tar.gz and paddle_whl to bos
env:
AK: paddle
SK: paddle
home_path: ${{ github.workspace }}/..
bos_file: ${{ github.workspace }}/../bos/BosClient.py
paddle_whl: paddlepaddle_xpu-0.0.0-cp310-cp310-linux_x86_64.whl
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
set -e
if [ ! -f "${{ env.bos_file }}" ]; then
wget -q --no-proxy -O ${{ env.home_path }}/bos_new.tar.gz https://xly-devops.bj.bcebos.com/home/bos_new.tar.gz --no-check-certificate
mkdir ${{ env.home_path }}/bos
tar xf ${{ env.home_path }}/bos_new.tar.gz -C ${{ env.home_path }}/bos
fi
cd ..
tar --use-compress-program="pzstd -5" -cf build.tar.gz paddle
# source /home/opt/deck/1.0/etc/bashrc
echo "Uploading build.tar.gz"
python ${{ env.bos_file }} build.tar.gz paddle-github-action/PR/xpu/${{ env.PR_ID }}/${{ env.COMMIT_ID }}
echo "Uploading paddle_whl"
cp /paddle/dist/${{ env.paddle_whl }} .
python ${{ env.bos_file }} ${{ env.paddle_whl }} paddle-github-action/PR/xpu/${{ env.PR_ID }}/${{ env.COMMIT_ID }}
'
- name: Terminate and delete the container
if: always()
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c 'rm -rf * .[^.]*'
docker rm -f ${container_name}
test:
name: Test
needs: build
env:
TASK: paddle-CI-${{ github.event.pull_request.number }}-xpu_test
runs-on:
group: Kunlun
timeout-minutes: 120
steps:
- name: Determine the runner
run: |
runner_name=`(echo $PWD|awk -F '/' '{print $3}')`
echo $runner_name
wget -q https://xly-devops.bj.bcebos.com/utils.sh
source utils.sh
determine_kunlun_runner ${runner_name}
- name: Check docker image and run container
env:
WITH_XPU: "ON"
COVERALLS_UPLOAD: "OFF"
CMAKE_BUILD_TYPE: Release
WITH_AVX: "OFF"
GIT_PR_ID: ${{ github.event.pull_request.number }}
PADDLE_VERSION: 0.0.0
WITH_TESTING: "ON"
WITH_DISTRIBUTE: "ON"
PY_VERSION: "3.10"
XPU_VISIBLE_DEVICES: ${{ env.CUDA_VISIBLE_DEVICES }}
CUDA_VISIBLE_DEVICES: ${{ env.CUDA_VISIBLE_DEVICES }}
WITH_XPU_BKCL: "ON"
CACHE_DIR: /root/.cache
CCACHE_DIR: /root/.ccache
CCACHE_MAXSIZE: 150G
CCACHE_LIMIT_MULTIPLE: 0.8
IF_KUNLUN3: "OFF"
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
home_dir: ${{ github.workspace }}/../../../..
FLAGS_use_stride_kernel: "0"
run: |
container_name=${TASK}-$(date +%Y%m%d-%H%M%S)
echo "container_name=${container_name}" >> ${{ github.env }}
docker run --ulimit nofile=102400 --ulimit core=-1 --shm-size=32g -d -t --name ${container_name} \
-v /ssd1/cibuild/.cache:/root/.cache \
-v /ssd1/cibuild/.ccache:/root/.ccache \
-v ${{ github.workspace }}/../../..:${{ github.workspace }}/../../.. \
-v ${{ github.workspace }}:/paddle \
-v /ssd1/cibuild/tmp:/tmp \
--device ${XPU_CODE_1} \
--device ${XPU_CODE_2} \
--device /dev/xpuctrl \
--shm-size=32g \
-e BRANCH \
-e PR_ID \
-e COMMIT_ID \
-e work_dir \
-e PADDLE_ROOT \
-e WITH_XPU \
-e COVERALLS_UPLOAD \
-e CMAKE_BUILD_TYPE \
-e GIT_PR_ID \
-e PADDLE_VERSION \
-e WITH_TESTING \
-e WITH_DISTRIBUTE \
-e PY_VERSION \
-e XPU_VISIBLE_DEVICES \
-e CUDA_VISIBLE_DEVICES \
-e WITH_XPU_BKCL \
-e CACHE_DIR \
-e CCACHE_DIR \
-e WITH_INFERENCE_API_TEST \
-e CCACHE_MAXSIZE \
-e CCACHE_LIMIT_MULTIPLE \
-e ci_scripts \
-e WITH_AVX \
-e IF_KUNLUN3 \
-e no_proxy \
-e GITHUB_API_TOKEN \
-e FLAGS_use_stride_kernel \
-e CI_name \
-w /paddle --network host ${docker_image} /bin/bash
- name: Download build.tar.gz
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
wget -q --no-proxy https://paddle-github-action.bj.bcebos.com/PR/xpu/${PR_ID}/${COMMIT_ID}/build.tar.gz --no-check-certificate
tar --use-compress-program="pzstd" -xf build.tar.gz --strip-components=1
rm build.tar.gz
'
- name: Run test
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
source ${{ github.workspace }}/../../../proxy
bash ${ci_scripts}/kunlun_test.sh
'
- name: Terminate and delete the container
if: always()
run: |
docker exec -t ${container_name} /bin/bash -c 'rm -rf * .[^.]*'
docker rm -f ${container_name}