Skip to content

[CI] XPU third_party local cache #72445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
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
23 changes: 16 additions & 7 deletions .github/workflows/_Linux-XPU.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ jobs:
echo "Pull upstream develop or target branch"
git pull upstream $BRANCH --no-edit

- name: Search cached third_party
env:
cache_dir: ${{ github.workspace }}/../../../../../.cache
run: |
bash -x ${ci_scripts_runner}/download_tp_cache.sh ${cache_dir}/XPU/third_party XPU

- name: Check docker image and run container
env:
WITH_SHARED_PHI: "ON"
Expand All @@ -77,7 +83,7 @@ jobs:
CCACHE_LIMIT_MULTIPLE: 0.8
no_proxy: "bcebos.com,apiin.im.baidu.com,gitee.com,aliyun.com,.baidu.com,.tuna.tsinghua.edu.cn"
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
home_dir: ${{ github.workspace }}/../../../..
home_dir: ${{ github.workspace }}/../../../../..
run: |
container_name=${TASK}-$(date +%Y%m%d-%H%M%S)
echo "container_name=${container_name}" >> ${{ github.env }}
Expand Down Expand Up @@ -125,25 +131,29 @@ jobs:
ulimit -n 102400
git config --global --add safe.directory ${work_dir}
git submodule foreach "git config --global --add safe.directory \$toplevel/\$sm_path"
bash -x ${ci_scripts}/run_setup.sh bdist_wheel
EXCODE=$?
exit $EXCODE
bash -x ${ci_scripts}/run_setup.sh bdist_wheel
'

- name: Upload build.tar.gz and paddle_whl to bos
- name: Upload product 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: |
if [ "${update_cached_package}" == ON ];then
cd ${{ github.workspace }}
tar --use-compress-program=pigz -cf ${xz_file} -C build third_party
fi
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 ..
sudo rm -rf `find . -name "*.a"`
sudo rm -rf `find . -name "*.o"`
cd ${{ github.workspace }}/..
tar --use-compress-program="pigz" -cpf build.tar.gz Paddle
# source /home/opt/deck/1.0/etc/bashrc
python3 ${bos_file} build.tar.gz paddle-github-action/PR/xpu/${{ env.PR_ID }}/${{ env.COMMIT_ID }}
Expand Down Expand Up @@ -173,7 +183,6 @@ jobs:
run: |
sudo rm -rf * .[^.]*
wget -q --no-proxy https://paddle-github-action.bj.bcebos.com/PR/xpu/${PR_ID}/${COMMIT_ID}/build.tar.gz --no-check-certificate
# wget -q --no-proxy https://paddle-github-action.bj.bcebos.com/PR/xpu/72068/a58543d2f92bbe5c817e185e9cc24b549c919601/build.tar.gz --no-check-certificate
tar --use-compress-program="pigz" -xpf build.tar.gz --strip-components=1
rm build.tar.gz

Expand Down
33 changes: 33 additions & 0 deletions ci/download_tp_cache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_md5=`find ${GITHUB_WORKSPACE} -path './cmake/*' -type f |xargs md5sum|md5sum |awk '{print $1}'`
third_party_md5=`find ${GITHUB_WORKSPACE} -path './third_party/*' -type f |xargs md5sum|md5sum|awk '{print $1}'`
export md5_content=`echo ${cmake_md5} ${third_party_md5} |md5sum|awk '{print $1}'`
xz_dir="$1" && echo "xz_dir=${xz_dir}" >> $GITHUB_ENV
xz_file_tar="${xz_dir}/${md5_content}.tar"
xz_file="${xz_dir}/${md5_content}.tar.xz" && echo "xz_file=${xz_file}" >> $GITHUB_ENV
if [ ! -f "${xz_file}" ];then
set +e
wget -q --no-proxy --no-check-certificate https://paddle-github-action.bj.bcebos.com/home/.cache/$2/third_party/${md5_content}.tar.xz; result=$?
if [ $result -eq 0 ];then
mkdir -p ${GITHUB_WORKSPACE}/build
mv ${md5_content}.tar.xz ${xz_dir}
else
mkdir -p ${xz_dir}
echo "update_cached_package=ON" >> $GITHUB_ENV
fi
else
mkdir -p ${GITHUB_WORKSPACE}/build
fi
Loading