Skip to content

Commit

Permalink
Hoist benchmarking into reusable job
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 10, 2024
1 parent 227fd53 commit 1f02fcb
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 68 deletions.
47 changes: 10 additions & 37 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,40 +32,13 @@ jobs:
archflags: "-mcpu=cortex-a55 -march=armv8.2-a"
cflags: "-static -DFORCE_AARCH64"
bench_extra_args: -w exec-on-a55
runs-on: self-hosted-${{ matrix.target.system }}
defaults:
run:
shell: nix develop .#ci -c bash -e {0}
permissions:
contents: write
if: github.repository_owner == 'pq-code-package' && (github.event.label.name == 'benchmark' || github.ref == 'refs/heads/main')
steps:
- uses: actions/checkout@v4
- name: Setup nix
uses: ./.github/actions/setup-nix
with:
devShell: ci
script: |
ARCH=$(uname -m)
cat >> $GITHUB_STEP_SUMMARY <<-EOF
## Setup
Architecture: $ARCH
- $(uname -a)
- $(nix --version)
- $(astyle --version)
- $(${{ matrix.target.cross_prefix }}gcc --version | grep -m1 "")
- $(bash --version | grep -m1 "")
## CPU Info
$(cat /proc/cpuinfo)
EOF
- name: Run benchmark
uses: ./.github/actions/bench
with:
name: ${{ matrix.target.name }}
cflags: ${{ matrix.target.cflags }}
archflags: ${{ matrix.target.archflags }}
perf: ${{ matrix.target.bench_pmu }}
store_results: ${{ github.repository_owner == 'pq-code-package' && github.ref == 'refs/heads/main' }}
bench_extra_args: ${{ matrix.target.bench_extra_args }}
gh_token: ${{ secrets.GITHUB_TOKEN }}
uses: ./.github/workflows/bench_core_reusable.yml
with:
runner: self-hosted-${{ matrix.target.system }}
name: ${{ matrix.target.name }}
cflags: ${{ matrix.target.cflags }}
archflags: ${{ matrix.target.archflags }}
perf: ${{ matrix.target.bench_pmu }}
store_results: ${{ github.repository_owner == 'pq-code-package' && github.ref == 'refs/heads/main' }}
bench_extra_args: ${{ matrix.target.bench_extra_args }}
gh_token: ${{ secrets.GITHUB_TOKEN }}
80 changes: 80 additions & 0 deletions .github/workflows/bench_core_reusable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: bench-core-reusable
on:
workflow_call:
inputs:
runner:
type: string
description: Name of the runner to use
name:
type: string
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:
type: string
description: CFLAGS to pass to compilation
default: ''
archflags:
type: string
description: ARCHFLAGS to pass to compilation
default: ''
bench_extra_args:
type: string
description: Further arguments to be appended to command line for `bench` script
default: ''
store_results:
type: string
description: Whether to push results to GH pages
default: 'false'
gh_token:
type: string
description: GitHub access token
required: true
jobs:
bench:
name: Bench ${{ inputs.name }}
runs-on: ${{ inputs.runner }}
defaults:
run:
shell: nix develop .#ci -c bash -e {0}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Setup nix
uses: ./.github/actions/setup-nix
with:
devShell: ci
script: |
ARCH=$(uname -m)
cat >> $GITHUB_STEP_SUMMARY <<-EOF
## Setup
Architecture: $ARCH
- $(uname -a)
- $(nix --version)
- $(astyle --version)
- $(${{ matrix.target.cross_prefix }}gcc --version | grep -m1 "")
- $(bash --version | grep -m1 "")
## CPU Info
$(cat /proc/cpuinfo)
EOF
- name: Run benchmark
uses: ./.github/actions/bench
with:
name: ${{ inputs.name }}
cflags: ${{ inputs.cflags }}
archflags: ${{ inputs.archflags }}
perf: ${{ inputs.perf }}
store_results: ${{ inputs.store_results }}
bench_extra_args: ${{ inputs.bench_extra_args }}
gh_token: ${{ secrets.AWS_GITHUB_TOKEN }}
41 changes: 10 additions & 31 deletions .github/workflows/bench_ec2_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,37 +73,16 @@ jobs:
bench:
name: Bench ${{ inputs.name }}
needs: start-ec2-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.start-ec2-runner.outputs.label }} # run the job on the newly created runner
steps:
- uses: actions/checkout@v4
- name: Setup nix
uses: ./.github/actions/setup-nix
with:
devShell: ci
script: |
ARCH=$(uname -m)
cat >> $GITHUB_STEP_SUMMARY <<-EOF
## Setup
Architecture: $ARCH
- $(uname -a)
- $(nix --version)
- $(astyle --version)
- $(${{ matrix.target.cross_prefix }}gcc --version | grep -m1 "")
- $(bash --version | grep -m1 "")
## CPU Info
$(cat /proc/cpuinfo)
EOF
- name: Run benchmark
uses: ./.github/actions/bench
with:
name: ${{ inputs.name }}
cflags: ${{ inputs.cflags }}
archflags: ${{ inputs.archflags }}
perf: PERF
store_results: ${{ inputs.store_results }}
bench_extra_args: ${{ inputs.bench_extra_args }}
gh_token: ${{ secrets.AWS_GITHUB_TOKEN }}
uses: ./.github/workflows/bench_core_reusable.yml
with:
runner: ${{ needs.start-ec2-runner.outputs.label }}
name: ${{ inputs.name }}
cflags: ${{ inputs.cflags }}
archflags: ${{ inputs.archflags }}
perf: PERF
store_results: ${{ inputs.store_results }}
bench_extra_args: ${{ inputs.bench_extra_args }}
gh_token: ${{ secrets.AWS_GITHUB_TOKEN }}
stop-ec2-runner:
name: Stop ${{ github.event.inputs.name }} (${{ github.event.inputs.ec2_instance_type }})
permissions:
Expand Down

0 comments on commit 1f02fcb

Please sign in to comment.