name: Slice on: workflow_call: inputs: docker_build_image: type: string required: true can-skip: type: string required: false default: "false" slice-check: type: string required: false SLICE_TEST_MODE: type: string required: false default: "test_ci" SLICE_BENCHMARK_FRAMEWORKS: type: string required: false default: "paddle" MANUALLY_PR_ID: type: string required: false MANUALLY_COMMIT_ID: type: string required: false build-can-skip: type: string required: false default: 'false' env: PR_ID: ${{ github.event.pull_request.number || '0' }} COMMIT_ID: ${{ github.event.pull_request.head.sha || github.sha }} work_dir: /paddle PADDLE_ROOT: /paddle TASK: paddle-CI-${{ github.event.pull_request.number }}-slice ci_scripts: /paddle/ci BRANCH: ${{ github.event.pull_request.base.ref || github.ref_name }} CI_name: slice 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 if: ${{ github.repository_owner == 'PaddlePaddle' && inputs.build-can-skip != 'true' }} uses: ./.github/workflows/check-bypass-slice.yml with: workflow-name: "slice" secrets: github-token: ${{ secrets.GITHUB_TOKEN }} slice: name: Slice test needs: [check-bypass] if: ${{ needs.check-bypass.outputs.can-skip != 'true' && inputs.can-skip != 'true' }} runs-on: group: slice timeout-minutes: 20 steps: - name: Check docker image and run container env: wheel_link: https://paddle-github-action.bj.bcebos.com/PR/build/${{ env.PR_ID }}/${{ env.COMMIT_ID }}/paddlepaddle_gpu-0.0.0-cp310-cp310-linux_x86_64.whl RUN_ID: ${{ github.run_id }} SLICE_TEST_MODE: ${{ inputs.SLICE_TEST_MODE }} SLICE_BENCHMARK_FRAMEWORKS: ${{ inputs.SLICE_BENCHMARK_FRAMEWORKS }} run: | container_name="api_benchmark_ci_${RUN_ID}" echo "container_name=${container_name}" >> ${{ github.env }} docker_image=${{ inputs.docker_build_image }} docker run -d -t --gpus all --name ${container_name} --shm-size=128g \ -v "/home/data/cfs:/home/data/cfs" \ -v ${{ github.workspace }}/../../..:${{ github.workspace }}/../../.. \ -v ${{ github.workspace }}:/paddle \ -e core_index \ -e BRANCH \ -e PR_ID \ -e COMMIT_ID \ -e RUN_ID \ -e wheel_link \ -e work_dir \ -e PADDLE_ROOT \ -e ci_scripts \ -e no_proxy \ -e CI_name \ -e SLICE_TEST_MODE \ -e SLICE_BENCHMARK_FRAMEWORKS \ -w /paddle --network host ${docker_image} - name: Download PaddleTest env: work_dir: ${{ github.workspace }} timeout-minutes: 30 run: | docker exec -t ${{ env.container_name }} /bin/bash -c ' rm -rf * .[^.]* echo "Downloading PaddleTest" wget -q https://xly-devops.bj.bcebos.com/PaddleTest/PaddleTest.tar.gz --no-proxy echo "Extracting PaddleTest" git config --global --add safe.directory ${work_dir} tar -xzf PaddleTest.tar.gz && cd PaddleTest git submodule foreach "git config --global --add safe.directory \$toplevel/\$sm_path" ' - name: Test env: work_dir: ${{ github.workspace }} run: | docker exec -t ${{ env.container_name }} /bin/bash -c ' mkdir -p ${{ github.workspace }}/../../../.cache/pip source ${{ github.workspace }}/../../../proxy python3.10 -m pip config set global.cache-dir ${{ github.workspace }}/../../../.cache/pip if [[ "${{ inputs.SLICE_BENCHMARK_FRAMEWORKS }}" == "torch" ]];then python3.10 -m pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 --index-url https://download.pytorch.org/whl/cu118 else if [[ "${{ inputs.MANUALLY_PR_ID }}" == "" ]]; then python3.10 -m pip install $wheel_link else python3.10 -m pip install https://paddle-github-action.bj.bcebos.com/PR/build/${{ inputs.MANUALLY_PR_ID }}/${{ inputs.MANUALLY_COMMIT_ID }}/paddlepaddle_gpu-0.0.0-cp310-cp310-linux_x86_64.whl fi fi python3.10 -m pip install -r PaddleTest/framework/e2e/api_benchmark/requirement.txt cd PaddleTest/framework/slice_benchmark cp ${{ github.workspace }}/../../../apibm_config.yml . bash run.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 }}