mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-15 21:00:47 +00:00
Support userbenchmarks, such as nvfuser, in the TorchBench CI. Test Plan: TorchBench CI RUN_TORCHBENCH: nvfuser TORCHBENCH_BRANCH: xz9/fix-ubs Pull Request resolved: https://github.com/pytorch/pytorch/pull/78794 Approved by: https://github.com/malfet
93 lines
3.7 KiB
YAML
93 lines
3.7 KiB
YAML
name: TorchBench CI (pytorch-linux-py3.7-cu102)
|
|
on:
|
|
pull_request:
|
|
|
|
env:
|
|
PYTHON_VERSION: "3.8"
|
|
CUDA_VERSION: "11.3"
|
|
MAGMA_VERSION: "magma-cuda113"
|
|
# must be consistent with https://github.com/pytorch/benchmark/blob/main/requirements.txt#L19
|
|
NUMPY_VERSION: "1.21.2"
|
|
PR_NUM: ${{ github.event.number }}
|
|
PR_BODY: ${{ github.event.pull_request.body }}
|
|
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
|
|
jobs:
|
|
run-torchbench:
|
|
# We don't accept running on non-pytorch repos because of security concerns
|
|
# Only run the job when the body contains magic word "RUN_TORCHBENCH:"
|
|
if: ${{ github.repository_owner == 'pytorch' && contains(github.event.pull_request.body, 'RUN_TORCHBENCH:') }}
|
|
runs-on: [self-hosted, bm-runner]
|
|
# Set to 12 hours
|
|
timeout-minutes: 720
|
|
steps:
|
|
- name: Checkout PyTorch
|
|
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
|
|
with:
|
|
path: pytorch
|
|
- name: Update self-hosted PyTorch
|
|
run: |
|
|
pushd "${HOME}"/pytorch
|
|
git remote prune origin
|
|
git fetch
|
|
popd
|
|
- name: Create conda environment and install deps
|
|
run: |
|
|
conda create -y -n pr-ci python="${PYTHON_VERSION}"
|
|
# shellcheck disable=SC1091
|
|
. "${HOME}"/anaconda3/etc/profile.d/conda.sh
|
|
conda activate pr-ci
|
|
# pin cmake version to 3.22 since 3.23 breaks pytorch build
|
|
# see details at: https://github.com/pytorch/pytorch/issues/74985
|
|
conda install -y numpy="${NUMPY_VERSION}" requests ninja pyyaml mkl mkl-include \
|
|
setuptools cmake=3.22 cffi typing_extensions \
|
|
future six dataclasses pillow pytest tabulate gitpython git-lfs tqdm psutil
|
|
# install magma
|
|
conda install -y -c pytorch "${MAGMA_VERSION}"
|
|
- name: Setup TorchBench branch
|
|
run: |
|
|
# shellcheck disable=SC1091
|
|
. "${HOME}"/anaconda3/etc/profile.d/conda.sh
|
|
conda activate pr-ci
|
|
PR_BODY_FILE=/tmp/pr-body.txt
|
|
echo "$PR_BODY" > ${PR_BODY_FILE}
|
|
python pytorch/.github/scripts/run_torchbench.py --pr-body "${PR_BODY_FILE}" set-torchbench-branch
|
|
- name: Checkout TorchBench
|
|
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
|
|
with:
|
|
repository: pytorch/benchmark
|
|
path: benchmark
|
|
lfs: false
|
|
ref: ${{ env.TORCHBENCH_BRANCH }}
|
|
- name: Run TorchBench
|
|
run: |
|
|
pushd "${HOME}"/pytorch
|
|
PR_MERGE_BASE=$(git merge-base "$PR_BASE_SHA" "$PR_HEAD_SHA")
|
|
popd
|
|
PR_BODY_FILE=/tmp/pr-body.txt
|
|
echo "$PR_BODY" > ${PR_BODY_FILE}
|
|
# shellcheck disable=SC1091
|
|
. "${HOME}"/anaconda3/etc/profile.d/conda.sh
|
|
conda activate pr-ci
|
|
python3 pytorch/.github/scripts/run_torchbench.py \
|
|
--pr-body "$PR_BODY_FILE" \
|
|
run \
|
|
--pytorch-path "${HOME}"/pytorch \
|
|
--torchbench-path "${PWD}"/benchmark \
|
|
--pr-num "$PR_NUM" \
|
|
--pr-base-sha "$PR_MERGE_BASE" \
|
|
--pr-head-sha "$PR_HEAD_SHA"
|
|
- name: Remove conda environment and cleanup
|
|
run: |
|
|
conda env remove --name pr-ci
|
|
rm /tmp/pr-body.txt
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: TorchBench result
|
|
path: ~/.torchbench/bisection/pr${{ github.event.number }}
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
|
|
cancel-in-progress: true
|