-
Notifications
You must be signed in to change notification settings - Fork 39
90 lines (73 loc) · 2.8 KB
/
benchmark.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Benchmark
on:
issue_comment:
types: [created]
jobs:
benchmark:
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/run-benchmark')
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: main
- name: Get base branch commit ID
id: get_base_commit
run: echo "BASE_COMMIT_ID=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Create virtual environment
run: python -m venv bitblas_benchmark
- name: Activate virtual environment and install dependencies
run: |
source bitblas_benchmark/bin/activate
python -m pip install --upgrade pip
if [ -f requirements-dev.txt ]; then python -m pip install -r requirements-dev.txt; fi
- name: Install project in wheel mode
run: |
source bitblas_benchmark/bin/activate
python -m pip install .
- name: Matmul Benchmark
run: |
source bitblas_benchmark/bin/activate
cd benchmark/operators
python ./benchmark_ops_matmul.py
- name: Get PR branch commit ID
id: get_pr_commit
run: echo "PR_COMMIT_ID=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Activate virtual environment and install dependencies
run: |
source bitblas_benchmark/bin/activate
python -m pip install --upgrade pip
if [ -f requirements-dev.txt ]; then python -m pip install -r requirements-dev.txt; fi
- name: Install project in wheel mode
run: |
source bitblas_benchmark/bin/activate
python -m pip install .
- name: Matmul Benchmark
run: |
source bitblas_benchmark/bin/activate
cd benchmark/operators
python ./benchmark_ops_matmul.py
- name: Compare benchmark results
run: |
source bitblas_benchmark/bin/activate
cd benchmark/operators
python ./compare_benchmark.py --base ${{ env.BASE_COMMIT_ID }} --head ${{ env.PR_COMMIT_ID }} 2>&1 | tee compare_results.txt
- name: Install GitHub CLI
run: |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
sudo apt-add-repository https://cli.github.com/packages
sudo apt update
sudo apt install gh
- name: Authenticate GitHub CLI
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh auth login --with-token <<< $GITHUB_TOKEN
- name: Post benchmark results
run: |
cat compare_results.txt
gh pr comment ${{ github.event.issue.number }} --body "$(cat compare_results.txt)"