|
| 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 | + - name: Run offlinebench |
| 45 | + env: |
| 46 | + JAX_PLATFORMS: tpu,cpu |
| 47 | + run: | |
| 48 | + set -euo pipefail |
| 49 | + source venv/bin/activate |
| 50 | + python benchmarks/basic_ops.py | ./jq-linux-amd64 -Rsa . | tee output.txt |
| 51 | + - name: Update result to PR |
| 52 | + env: |
| 53 | + URL: ${{ github.event.pull_request.comments_url }} |
| 54 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 55 | + run: | |
| 56 | + curl \ |
| 57 | + -X POST \ |
| 58 | + $URL \ |
| 59 | + -H "Content-Type: application/json" \ |
| 60 | + -H "Authorization: token $GITHUB_TOKEN" \ |
| 61 | + --data "{ \"body\": $(cat output.txt) }" |
| 62 | +
|
0 commit comments