Skip to content

Commit

Permalink
EC2 bench: Make configuration of AMI more comfortable
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 9, 2024
1 parent fd4cffa commit 0e58519
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/bench_ec2_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
if: github.repository_owner == 'pq-code-package' && (github.event.label.name == 'benchmark' || github.ref == 'refs/heads/main')
with:
ec2_instance_type: t4g.small
ec2_ami_id: ami-096ea6a12ea24a797
ec2_ami: "ubuntu-latest (aarch64)"
archflags: -mcpu=cortex-a76 -march=armv8.2-a
store_results: 'true'
name: Graviton2
Expand All @@ -30,7 +30,7 @@ jobs:
if: github.repository_owner == 'pq-code-package' && (github.event.label.name == 'benchmark' || github.ref == 'refs/heads/main')
with:
ec2_instance_type: c7g.medium
ec2_ami_id: ami-096ea6a12ea24a797
ec2_ami: "ubuntu-latest (aarch64)"
archflags: -mcpu=neoverse-v1 -march=armv8.4-a
store_results: 'true'
name: Graviton3
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/bench_ec2_any.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ on:
ec2_instance_type:
description: Type if EC2 instance to benchmark on
default: t4g.small
ec2_ami:
description: AMI
type: choice
options:
- ubuntu-latest (x86_64)
- ubuntu-latest (aarch64)
- ubuntu-latest (custom AMI)
default: "ubuntu-latest (x86_64)"
ec2_ami_id:
description: AMI ID
default: ami-096ea6a12ea24a797
Expand All @@ -32,6 +40,7 @@ jobs:
uses: ./.github/workflows/bench_ec2_reusable.yml
with:
ec2_instance_type: ${{ github.event.inputs.ec2_instance_type }}
ec2_ami: ${{ github.event.inputs.ec2_ami }}
ec2_ami_id: ${{ github.event.inputs.ec2_ami_id }}
cflags: ${{ github.event.inputs.cflags }}
archflags: ${{ github.event.inputs.archflags }}
Expand Down
30 changes: 29 additions & 1 deletion .github/workflows/bench_ec2_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ on:
type: string
description: Type if EC2 instance to benchmark on
default: t4g.small
ec2_ami:
description: AMI
type: choice
options:
- ubuntu-latest (x86_64)
- ubuntu-latest (aarch64)
- ubuntu-latest (custom AMI)
default: "ubuntu-latest (x86_64)"
ec2_ami_id:
type: string
description: AMI ID
Expand Down Expand Up @@ -37,6 +45,8 @@ on:
env:
AWS_ROLE: arn:aws:iam::559050233797:role/mlkem-c-aarch64-gh-action
AWS_REGION: us-east-1
AMI_UBUNTU_LATEST_X86_64: ami-0e86e20dae9224db8
AMI_UBUNTU_LATEST_AARCH64: ami-096ea6a12ea24a797
jobs:
start-ec2-runner:
name: Start ${{ github.event.inputs.name }} (${{ github.event.inputs.ec2_instance_type }})
Expand All @@ -48,6 +58,23 @@ jobs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Determine AMI ID
id: det_ami_id
run: |
if [[ "${{ inputs.ec2_ami }}" == "ubuntu-latest (x86_64)" ]]; then
AMI_ID=${{ env.AMI_UBUNTU_LATEST_X86_64 }}
fi
if [[ "${{ inputs.ec2_ami }}" == "ubuntu-latest (aarch64)" ]]; then
AMI_ID=${{ env.AMI_UBUNTU_LATEST_AARCH64 }}
fi
if [[ "${{ inputs.ec2_ami }}" == "ubuntu-latest (custom AMI)" ]]; then
AMI_ID=${{ inputs.ec2_ami_id }}
fi
echo "Using AMI ID: $AMI_ID"
echo "AMI_ID=$AMI_ID" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
- name: Clear nix-installer action cache
uses: ./.github/actions/clear-cache
Expand All @@ -62,11 +89,12 @@ jobs:
aws-region: ${{ env.AWS_REGION }}
- name: Start EC2 runner
id: start-ec2-runner
needs: det_ami_id
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.AWS_GITHUB_TOKEN }}
ec2-image-id: ${{ inputs.ec2_ami_id }}
ec2-image-id: ${{ steps.det_ami_id.outputs.AMI_ID }}
ec2-instance-type: ${{ inputs.ec2_instance_type }}
subnet-id: subnet-07b2729e5e065962f
security-group-id: sg-0ab2e297196c8c381
Expand Down

0 comments on commit 0e58519

Please sign in to comment.