Skip to content

Commit c5cd398

Browse files
committed
Add workflow yml for validate.
1 parent b756a5e commit c5cd398

File tree

1 file changed

+133
-0
lines changed

1 file changed

+133
-0
lines changed

.github/workflows/Validate-GPU.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Validate-GPU
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
docker_build_image:
7+
type: string
8+
required: true
9+
clone_dir:
10+
type: string
11+
required: false
12+
default: 'Paddle'
13+
can-skip:
14+
type: string
15+
required: false
16+
17+
env:
18+
PR_ID: ${{ github.event.pull_request.number }}
19+
COMMIT_ID: ${{ github.event.pull_request.head.sha }}
20+
work_dir: /workspace
21+
BRANCH: ${{ github.event.pull_request.base.ref }}
22+
CI_name: validate-gpu
23+
CFS_DIR: /home/data/cfs
24+
no_proxy: "bcebos.com,apiin.im.baidu.com,gitee.com,aliyun.com,.baidu.com,.tuna.tsinghua.edu.cn"
25+
26+
defaults:
27+
run:
28+
shell: bash
29+
30+
jobs:
31+
cinn:
32+
name: CINN
33+
if: ${{ inputs.can-skip != 'true' }}
34+
runs-on:
35+
group: BD_BJ-V100
36+
steps:
37+
- name: Check docker image and run container
38+
env:
39+
CACHE_DIR: /home/data/cfs/.cache
40+
run: |
41+
container_name=${TASK}-${core_index}-$(date +%Y%m%d-%H%M%S)
42+
echo "container_name=${container_name}" >> ${{ github.env }}
43+
docker_image=${{ inputs.docker_build_image }}
44+
docker container ls -a --filter "name=paddle-CI-*-api-benchmark-${core_index}*" --format "{{.ID}}" | xargs -r docker rm -f
45+
docker container ls -a --filter "name=api_benchmark_ci_baseline_" --format "{{.ID}} {{.CreatedAt}}" | awk '$2 <= "'$(date -d '1 day ago' +'%Y-%m-%d')'" {print $1}' | xargs -r docker rm -f
46+
docker run -d -t --gpus all --name ${container_name} --shm-size=128g \
47+
-v "/home/data/cfs:/home/data/cfs" \
48+
-v "/home/data/cfs/.cache:/root/.cache" \
49+
-v "/home/data/cfs/.ccache:/root/.ccache" \
50+
-v "/dev/shm:/dev/shm" \
51+
-v ${{ github.workspace }}/../../..:${{ github.workspace }}/../../.. \
52+
-v ${{ github.workspace }}:/paddle \
53+
-e python \
54+
-e core_index \
55+
-e BRANCH \
56+
-e PR_ID \
57+
-e COMMIT_ID \
58+
-e work_dir \
59+
-e PADDLE_ROOT \
60+
-e ci_scripts \
61+
-e no_proxy \
62+
-e CI_name \
63+
-e CACHE_DIR \
64+
-e GITHUB_API_TOKEN \
65+
-e CFS_DIR \
66+
-w /paddle --network host ${docker_image}
67+
68+
- name: Download Paddle and PaddleTest
69+
env:
70+
work_dir: ${{ github.workspace }}
71+
run: |
72+
docker exec -t ${{ env.container_name }} /bin/bash -c '
73+
rm -rf * .[^.]*
74+
echo "Downloading build.tar.gz from cfs"
75+
cp ${CFS_DIR}/build_bos/${PR_ID}/${COMMIT_ID}/build.tar.gz .
76+
echo "Extracting build.tar.gz"
77+
git config --global --add safe.directory ${work_dir}
78+
tar --use-compress-program="pzstd -1" -xpf build.tar.gz --strip-components=1
79+
git submodule foreach "git config --global --add safe.directory \$toplevel/\$sm_path"
80+
git checkout test
81+
rm build.tar.gz
82+
cd /
83+
echo "Downloading PaddleTest.tar.gz"
84+
wget -q --tries=5 --no-proxy https://xly-devops.bj.bcebos.com/PaddleTest/PaddleTest.tar.gz --no-check-certificate
85+
echo "Extracting PaddleTest.tar.gz"
86+
tar -zvxf PaddleTest.tar.gz 1>/dev/null 2>&1
87+
'
88+
89+
- name: Check bypass
90+
id: check-bypass
91+
uses: ./.github/actions/check-bypass
92+
with:
93+
github-token: ${{ secrets.GITHUB_TOKEN }}
94+
workflow-name: ce-cinn-framework
95+
96+
- name: Determine ci trigger
97+
if: steps.check-bypass.outputs.can-skip != 'true'
98+
env:
99+
work_dir: ${{ github.workspace }}
100+
run: |
101+
docker exec -t ${{ env.container_name }} /bin/bash -c '
102+
source ${{ github.workspace }}/../../../proxy
103+
source ${ci_scripts}/ce_cinn_diff.sh
104+
if [ ${sum_num} -eq 0 ];then
105+
echo "The modified files does not affect LayerCase in CE-CINN-Framework, so skip this ci."
106+
echo "skip_ci=true" >> ${{ github.env }}
107+
fi
108+
'
109+
110+
- name: Run check
111+
if: ${{ steps.check-bypass.outputs.can-skip != 'true' && env.skip_ci != 'true' }}
112+
env:
113+
work_dir: ${{ github.workspace }}
114+
run: |
115+
docker exec -t ${{ env.container_name }} /bin/bash -c '
116+
source ~/.bashrc
117+
pip config set global.cache-dir "$CACHE_DIR/pip"
118+
pip install /paddle/build/pr_whl/paddlepaddle_gpu-0.0.0-cp310-cp310-linux_x86_64.whl
119+
cd /PaddleTest/framework/e2e/PaddleLT_new
120+
pip install -r requirement.txt
121+
source ./scene/set_ci_dy^dy2stcinn_train^dy2stcinn_eval_inputspec_env.sh
122+
python support/dict_to_yml.py --filename apibm_config.yml --data_str "$(cat $CACHE_DIR/cinn_config)"
123+
set -e
124+
python run.py
125+
exit $(head -n 1 "exit_code.txt")
126+
'
127+
128+
- name: Terminate and delete the container
129+
if: always()
130+
run: |
131+
set +e
132+
docker exec -t ${{ env.container_name }} /bin/bash -c 'rm -rf * .[^.]*'
133+
docker rm -f ${{ env.container_name }}

0 commit comments

Comments
 (0)