Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 42 additions & 74 deletions .github/workflows/_IXUCA.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,25 @@ on:
default: 'true'

jobs:
PR-CI-HPU:
check-bypass:
name: Check bypass
if: ${{ inputs.can-skip != 'true' }}
uses: ./.github/workflows/check-bypass.yml
with:
workflow-name: 'iluvatar'
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}

PR-CI-IXUCA:
name: PR-CI-IXUCA
if: ${{ github.repository_owner == 'PaddlePaddle' }}
runs-on:
group: test2
needs: check-bypass
if: ${{ needs.check-bypass.outputs.can-skip != 'true' && github.repository_owner == 'PaddlePaddle' }}
runs-on: iluvatar-gpu-2
container:
image: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/device/paddle-ixuca:latest
env:
LD_LIBRARY_PATH: /usr/local/corex/lib
LIBRARY_PATH: /usr/local/corex/lib
env:
PR_ID: ${{ github.event.pull_request.number }}
COMMIT_ID: ${{ github.event.pull_request.head.sha }}
Expand All @@ -29,37 +43,8 @@ jobs:
no_proxy: "bcebos.com,apiin.im.baidu.com,gitee.com,aliyun.com,.baidu.com,.tuna.tsinghua.edu.cn"

steps:
- name: Check docker image and run container
env:
GIT_PR_ID: ${{ github.event.pull_request.number || '0' }}
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUN_ID: ${{ github.run_id }}
cache_dir: /root/.cache
ccache_dir: /root/.ccache
docker_image: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/device/paddle-ixuca:latest
run: |
container_name=${TASK}-$(date +%Y%m%d-%H%M%S)
echo "container_name=${container_name}" >> ${{ github.env }}
docker run --shm-size=128G \
-d -t --name ${container_name} \
--privileged --network=host \
-e PR_ID \
-e COMMIT_ID \
-e BRANCH \
-e no_proxy \
-e LD_LIBRARY_PATH=/usr/local/corex-4.3.0/lib \
-e LIBRARY_PATH=/usr/local/corex-4.3.0/lib \
-v ${cache_dir}:/root/.cache \
-v ${ccache_dir}:/root/.ccache \
-v ${{ github.workspace }}/../../..:${{ github.workspace }}/../../.. \
-v ${{ github.workspace }}:/workspace -w /workspace \
${docker_image} /bin/bash

- name: Download Code
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
rm -rf /workspace/* /workspace/.[^.]* 2>/dev/null || true
source ${{ github.workspace }}/../../../proxy
set -x
wget -q --tries=5 --no-proxy https://paddle-github-action.bj.bcebos.com/PaddleCustomDevice/PR/${PR_ID}/${COMMIT_ID}/PaddleCustomDevice.tar.gz --no-check-certificate
echo "Extracting PaddleCustomDevice.tar.gz"
Expand All @@ -68,81 +53,64 @@ jobs:
git config --global --add safe.directory "*"
git remote add upstream https://github.com/PaddlePaddle/PaddleCustomDevice.git
git merge ${BRANCH} --no-edit
git --no-pager log --pretty=oneline -5'

- name: Check bypass
id: check-bypass
uses: ./PaddleCustomDevice/.github/actions/check-bypass
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
workflow-name: ixuca
git --no-pager log --pretty=oneline -5

- name: RUN IXUCA
id: run-ixuca
if: steps.check-bypass.outputs.can-skip != 'true'
run: |
echo "=========== Checking PR Changes If IXUCA FULL CI Needed ==========="

should_skip=$(docker exec -t ${{ env.container_name }} /bin/bash -c '
cd /workspace/PaddleCustomDevice
cd PaddleCustomDevice

change_numbers=$(git --no-pager diff --name-only remotes/origin/${BRANCH} | wc -l)
change_backend=$(git --no-pager diff --name-only remotes/origin/${BRANCH} | grep "backends/" | wc -l)
change_ixuca_only=$(git --no-pager diff --name-only remotes/origin/${BRANCH} | grep "backends/iluvatar_gpu" | wc -l)
change_numbers=$(git --no-pager diff --name-only remotes/origin/${BRANCH} | wc -l)
change_backend=$(git --no-pager diff --name-only remotes/origin/${BRANCH} | grep "backends/" | wc -l)
change_ixuca_only=$(git --no-pager diff --name-only remotes/origin/${BRANCH} | grep "backends/iluvatar_gpu" | wc -l)

echo "Changed files:"
git --no-pager diff --name-only remotes/origin/${BRANCH}
echo "Changed files:"
git --no-pager diff --name-only remotes/origin/${BRANCH}

if [ $change_numbers -ne $change_backend ]; then
echo "Common file changed, continue to run IXUCA FULL CI test ..."
echo false
elif [ $change_ixuca_only -eq 0 ]; then
echo "NO IXUCA backend changes found, skip IXUCA FULL CI ...."
echo true
else
echo "IXUCA backend changed, run FULL CI ..."
echo false
fi
' | tail -n 1 | tr -d '\r')
should_skip="false"
if [ $change_numbers -ne $change_backend ]; then
echo "Common file changed, continue to run IXUCA FULL CI test ..."
elif [ $change_ixuca_only -eq 0 ]; then
echo "NO IXUCA backend changes found, skip IXUCA FULL CI ...."
should_skip="true"
else
echo "IXUCA backend changed, run FULL CI ..."
fi

echo "should_skip from docker = $should_skip"
echo "should_skip=$should_skip" >> $GITHUB_OUTPUT

- name: Build and Install paddle_iluvatar_gpu
if: steps.check-bypass.outputs.can-skip != 'true' && steps.run-ixuca.outputs.should_skip != 'true'
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
export PATH=/usr/local/corex-4.3.0/bin:$PATH
mkdir -p /workspace/PaddleCustomDevice/Paddle/third_party/mklml/Linux
curl -o /workspace/PaddleCustomDevice/Paddle/third_party/mklml/Linux/csrmm_mklml_lnx_2019.0.5.tgz http://paddlepaddledeps.bj.bcebos.com/csrmm_mklml_lnx_2019.0.5.tgz
tar xf /workspace/PaddleCustomDevice/Paddle/third_party/mklml/Linux/csrmm_mklml_lnx_2019.0.5.tgz
export PATH=/usr/local/corex/bin:$PATH
mkdir -p PaddleCustomDevice/Paddle/third_party/mklml/Linux
curl -o PaddleCustomDevice/Paddle/third_party/mklml/Linux/csrmm_mklml_lnx_2019.0.5.tgz http://paddlepaddledeps.bj.bcebos.com/csrmm_mklml_lnx_2019.0.5.tgz
tar xf PaddleCustomDevice/Paddle/third_party/mklml/Linux/csrmm_mklml_lnx_2019.0.5.tgz
python3 -m pip install --pre paddlepaddle -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/
pip show paddlepaddle
python3 -m pip install parameterized
export PADDLE_VERSION=0.0.0
cd /workspace/PaddleCustomDevice/backends/iluvatar_gpu
cd PaddleCustomDevice/backends/iluvatar_gpu
# build
bash build_paddle.sh
# Install
bash install_paddle.sh'
bash install_paddle.sh

- name: Run Tests
if: steps.check-bypass.outputs.can-skip != 'true' && steps.run-ixuca.outputs.should_skip != 'true'
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
pip show parameterized
python3 -m pip install parameterized
export FLAG_SKIP_FLOAT64=1
cd /workspace/PaddleCustomDevice/backends/iluvatar_gpu/tests
cd PaddleCustomDevice/backends/iluvatar_gpu/tests
# Run tests
bash run_test.sh'
bash run_test.sh

- name: Terminate and delete the container
if: always()
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
rm -rf * .[^.]*
chmod -R 777 . || true
'
docker stop ${container_name}
docker rm ${container_name}
Loading