Skip to content

Commit

Permalink
Hoist benchmarking steps into reusable GH action
Browse files Browse the repository at this point in the history
Signed-off-by: Hanno Becker <[email protected]>
  • Loading branch information
hanno-becker committed Sep 8, 2024
1 parent b9e7133 commit 85135e9
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 15 deletions.
53 changes: 53 additions & 0 deletions .github/actions/bench/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# SPDX-License-Identifier: Apache-2.0

name: Bench MLKEM-C-AArch64
description: Run benchmarking script

inputs:
name:
description: Name for the benchmarking run
required: true
perf:
description: Method of obtaining PMU metrics
required: true
default: 'PERF'
type: choice
options:
- NO
- PERF
- PMU
- M1
cflags:
description: CFLAGS to pass to compilation
required: true
archflags:
description: ARCHFLAGS to pass to compilation
required: true
bench_extra_args:
description: Further arguments to be appended to command line for `bench` script
required: false
default: ''
store_results:
description: Whether to push results to GH pages
required: true
default: 'false'
runs:
using: composite
steps:
- name: Run benchmark
shell: nix develop .#ci -c bash -e {0}
run: |
tests bench -c ${{ inputs.perf }} --cflags "${{ inputs.cflags }}" --arch-flags "${{ inputs.archflags }}" -v --output output.json ${{ inputs.bench_extra_args }}
- name: Dump benchmark
if: ${{ inputs.store_results != 'true' }}
run: |
cat output.json
- name: Store benchmark result
if: ${{ inputs.store_results == 'true' }}
uses: benchmark-action/github-action-benchmark@v1
with:
name: ${{ inputs.name }}
tool: 'customSmallerIsBetter'
output-file-path: output.json
github-token: ${{ secrets.AWS_GITHUB_TOKEN }}
auto-push: true
20 changes: 5 additions & 15 deletions .github/workflows/bench_ec2_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,13 @@ jobs:
$(cat /proc/cpuinfo)
EOF
- name: Run benchmark
shell: nix develop .#ci -c bash -e {0}
run: |
tests bench -c PERF --cflags "${{ inputs.cflags }}" --arch-flags "${{ inputs.archflags }}" -v --output output.json
- name: Dump benchmark
if: ${{ inputs.store_results != 'true' }}
run: |
cat output.json
- name: Store benchmark result
if: ${{ inputs.store_results == 'true' }}
uses: benchmark-action/github-action-benchmark@v1
uses: ./.github/actions/bench
with:
name: ${{ inputs.name }}
tool: 'customSmallerIsBetter'
output-file-path: output.json
github-token: ${{ secrets.AWS_GITHUB_TOKEN }}
auto-push: true

cflags: ${{ inputs.cflags }}
archflags: ${{ inputs.archflags }}
perf: PERF
store_results: ${{ inputs.store_results }}
stop-ec2-runner:
name: Stop ${{ github.event.inputs.name }} (${{ github.event.inputs.ec2_instance_type }})
permissions:
Expand Down

0 comments on commit 85135e9

Please sign in to comment.