Skip to content

Commit ac30781

Browse files
committed
Add offline perf ci
1 parent 33348d2 commit ac30781

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

.github/workflows/offline_perf.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
16+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
17+
18+
name: Offline Performance
19+
20+
on:
21+
pull_request:
22+
23+
jobs:
24+
py:
25+
name: "Offline micro benchmark"
26+
strategy:
27+
matrix:
28+
python-version: ['3.10']
29+
runs-on: self-hosted
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
- name: Setup Python
34+
uses: actions/setup-python@v4
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
- name: Install Dependencies
38+
run: |
39+
python -m venv venv
40+
source venv/bin/activate
41+
source install_everything.sh
42+
wget https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-amd64
43+
chmod +x ./jq-linux-amd64
44+
env
45+
python -c "import jax; print(jax.devices())"
46+
- name: Run offlinebench
47+
env:
48+
JAX_PLATFORMS: tpu,cpu
49+
run: |
50+
set -euo pipefail
51+
source venv/bin/activate
52+
python benchmarks/basic_ops.py | ./jq-linux-amd64 -Rsa . | tee output.txt
53+
- name: Update result to PR
54+
env:
55+
URL: ${{ github.event.pull_request.comments_url }}
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
run: |
58+
curl \
59+
-X POST \
60+
$URL \
61+
-H "Content-Type: application/json" \
62+
-H "Authorization: token $GITHUB_TOKEN" \
63+
--data "{ \"body\": $(cat output.txt) }"
64+

0 commit comments

Comments
 (0)