Skip to content

Commit

Permalink
Refactor workflow to improve performance result handling and caching
Browse files Browse the repository at this point in the history
  • Loading branch information
flferretti committed Feb 27, 2025
1 parent 6aef209 commit 49ab7f8
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions .github/workflows/gpu_benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ permissions:

jobs:
benchmark:
runs-on: [self-hosted, gpu]
runs-on: self-hosted
container:
image: ghcr.io/nvidia/jax:jax
options: --gpus all
options: --rm --gpus all

steps:
- name: Checkout repository
Expand All @@ -25,29 +25,30 @@ jobs:
run: |
pip install .[all]
- name: Run JaxSim benchmarks
id: benchmark
run: |
echo "### Benchmark Results" > results.txt
pytest --benchmark-only --gpu-only >> results.txt
# Output the results to GitHub Actions for use in the comment
echo "results=$(cat results.txt)" >> $GITHUB_ENV
- name: Performance regression check
uses: actions/checkout@v4

- name: Debugging comment for benchmarks start
uses: thollander/actions-comment-pull-request@v3
- name: Run benchmark and store result
run: pytest bench.py --benchmark-json output.json

- name: Download previous benchmark data
uses: actions/cache@v4
with:
message: |
Running GPU benchmarks for this PR :rocket:
comment-tag: to_delete_on_completion
mode: delete-on-completion

- name: Post results in PR comment
if: github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v3
path: ./cache
key: ${{ runner.os }}-benchmark

- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
pr-number: ${{ github.event.number }}
message: |
_(execution **${{ github.run_id }}** / attempt **${{ github.run_attempt }}**)_
${{ env.results }}
comment-tag: execution
mode: upsert
tool: 'pytest'
output-file-path: output.json
external-data-json-path: ./cache/benchmark-data.json
fail-on-alert: true
summary-always: true
alert-threshold: 150%
auto-push: false
gh-pages-branch: gh-pages

- name: Push benchmark result
if: github.event_name != 'pull_request'
run: git push 'https://ami-iit:${{ secrets.GITHUB_TOKEN }}@github.com/ami-iit/jaxsim.git' gh-pages:gh-pages

0 comments on commit 49ab7f8

Please sign in to comment.