Skip to content

Commit 0f0a872

Browse files
dor-forergithub-actions[bot]
authored andcommitted
Add Arm machines support to benchamrks [MOD-8531] (#600)
* Add arm support * Changed the arm cpu info * Add ip test * Add to tests * Added tests andbm * fix tests * Add github benchmakrs * Check 1 * only arm * change ami * Try ireland * Try different image * try image * back to old image * larger image * Add option to change env * back to default region * Created new image * Try to add the x86 to check * Try different machine * added include * Try without opti on arm * Change to c6g * added matrix region * change to west * try the i8 * Try oregon * Change subnet id * Now subnet * Change subnet * add subnet * Try group id * Change to vpc id * change subnet * Change ami * Try without subnet * add security group again * Change the subnets * Change to ids * Change sg * psubnet * Try different * different * to a file * print * p * leave empty * empty * Try different account * Run 2 arm machines * Move both to us-west-2 * Try workflow * Change name * Changes * Change the secrets * Add supprted arch * Add defaults * Support all * Change the jq * Change machine to t4g * Change the name * Change the machine * fix the stop * only benchamrk * add the secrets * region secret * benchmark region * Change timeout * Added support for arch name in benchamrks * change th json * changed to v9.0 * Change the check * add v9 * Check alt version of armv9 * added check * add arc_arch * changed to CONCAT_WITH_UNDERSCORE_ARCH * change the check * Add full check * fix the instruct * Added the cmake * fix the support * put it back to cmake * back * change the condition * No armpl for now * cland format * remove the opt * Changed to one machine * Added BENCHMARK_ARCH * fix endif * Remove secrets call * pr changes * suuport check for armv7 * Change or OR (cherry picked from commit 977def5)
1 parent 9889cd3 commit 0f0a872

27 files changed

+346
-207
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
setup:
5+
required: true
6+
type: string
7+
architecture:
8+
required: true
9+
type: string
10+
instance-type:
11+
required: true
12+
type: string
13+
ami-id:
14+
required: true
15+
type: string
16+
github-runner-label:
17+
required: true
18+
type: string
19+
20+
jobs:
21+
start-runner:
22+
name: Start self-hosted EC2 runner
23+
runs-on: ubuntu-latest
24+
outputs:
25+
runner_label: ${{ steps.start-ec2-runner.outputs.label }}
26+
ec2_instance_id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
27+
steps:
28+
- name: Configure AWS credentials
29+
uses: aws-actions/configure-aws-credentials@v4
30+
with:
31+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
32+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
33+
aws-region: ${{ secrets.AWS_REGION_BENCHMARK }}
34+
- name: Start EC2 runner
35+
id: start-ec2-runner
36+
uses: machulav/ec2-github-runner@v2
37+
with:
38+
mode: start
39+
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
40+
ec2-image-id: ${{ inputs.ami-id }}
41+
ec2-instance-type: ${{ inputs.instance-type }}
42+
subnet-id: ${{ secrets.AWS_EC2_SUBNET_ID_BENCHMARK }}
43+
security-group-id: ${{ secrets.AWS_EC2_SG_ID_BENCHMARK }}
44+
label: ${{ inputs.github-runner-label }}
45+
46+
benchmark:
47+
name: Run benchmarks on runner
48+
needs: start-runner
49+
runs-on: ${{ needs.start-runner.outputs.runner_label }}
50+
steps:
51+
- name: Checkout code
52+
uses: actions/checkout@v4
53+
with:
54+
ref: ${{ github.event.number && format('refs/pull/{0}/merge', github.event.number) || github.head_ref }}
55+
- name: Print runner info
56+
run: |
57+
printf "Runner lscpu:\n$(lscpu)\n"
58+
printf "Runner lsmem:\n$(lsmem)\n"
59+
printf "Runner nproc:\n$(nproc)\n"
60+
printf "Runner uname:\n$(uname -a)\n"
61+
printf "Runner arch:\n$(arch)\n"
62+
- name: Install benchmark dependencies
63+
run: |
64+
sudo .install/install_script.sh
65+
sudo apt install python3-pip -y
66+
pip3 install --upgrade pip PyYAML setuptools redisbench-admin
67+
pip3 install -r requirements.txt
68+
- name: Download pre-generated indices
69+
timeout-minutes: 20
70+
run: ./tests/benchmark/bm_files.sh ${{ inputs.setup }}
71+
- name: Run Benchmark
72+
env:
73+
ARCH: ${{ inputs.architecture }}
74+
timeout-minutes: 300
75+
run: |
76+
make benchmark BM_FILTER=${{ inputs.setup }}
77+
- name: Collect results
78+
run: |
79+
./tests/benchmark/benchmarks.sh ${{ inputs.setup }} | xargs -P 0 -I {} redisbench-admin export \
80+
--redistimeseries_host ${{ secrets.PERFORMANCE_RTS_HOST }} \
81+
--redistimeseries_port ${{ secrets.PERFORMANCE_RTS_PORT }} \
82+
--redistimeseries_user default \
83+
--redistimeseries_pass '${{ secrets.PERFORMANCE_RTS_AUTH }}' \
84+
--github_repo ${{ github.event.repository.name }} \
85+
--github_org ${{ github.repository_owner }} \
86+
--github_branch ${{ github.head_ref || github.ref_name }} \
87+
--github_actor ${{ github.triggering_actor }} \
88+
--results-format google.benchmark \
89+
--benchmark-result-file {}_results.json
90+
91+
stop-runner:
92+
name: Stop self-hosted EC2 runner
93+
needs:
94+
- start-runner # required to get output from the start-runner job
95+
- benchmark # required to wait when the main job is done
96+
runs-on: ubuntu-latest
97+
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
98+
steps:
99+
- name: Configure AWS credentials
100+
uses: aws-actions/configure-aws-credentials@v4
101+
with:
102+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
103+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
104+
aws-region: ${{ secrets.AWS_REGION_BENCHMARK }}
105+
- name: Stop EC2 runner
106+
uses: machulav/ec2-github-runner@v2
107+
with:
108+
mode: stop
109+
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
110+
label: ${{ inputs.github-runner-label }}
111+
ec2-instance-id: ${{ needs.start-runner.outputs.ec2_instance_id }}
112+

.github/workflows/benchmark.yml

Lines changed: 61 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ on:
44
setup:
55
type: string
66
required: true
7+
architecture:
8+
type: string
9+
required: false
10+
default: 'all'
11+
description: 'Run only on specific architecture'
712
workflow_dispatch:
813
inputs:
914
setup:
@@ -35,107 +40,66 @@ on:
3540
- bm-spaces
3641
description: 'Benchmarks set to run'
3742
default: benchmarks-all
43+
architecture:
44+
type: choice
45+
options:
46+
- all
47+
- arm64
48+
- x86_64
49+
description: 'Run only on specific architecture'
50+
default: 'all'
3851

3952
jobs:
40-
start-runner:
41-
name: Start self-hosted EC2 runner
53+
prepare_runner_configurations:
4254
runs-on: ubuntu-latest
4355
outputs:
44-
label: ${{ steps.start-ec2-runner.outputs.label }}
45-
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
46-
steps:
47-
- name: Configure AWS credentials
48-
uses: aws-actions/configure-aws-credentials@v4
49-
with:
50-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
51-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
52-
aws-region: ${{ secrets.AWS_REGION }}
53-
- name: Start EC2 runner
54-
id: start-ec2-runner
55-
uses: machulav/ec2-github-runner@v2
56-
with:
57-
mode: start
58-
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
59-
# Ubuntu 22.04 128GB Storage AMI
60-
ec2-image-id: ami-0ba430d4b7b64de57
61-
ec2-instance-type: r7i.xlarge
62-
subnet-id: ${{ secrets.AWS_EC2_SUBNET_ID }}
63-
security-group-id: ${{ secrets.AWS_EC2_SG_ID }}
64-
65-
benchmark:
66-
name: Run the benchmarks on the runner
67-
needs: start-runner # required to start the main job when the runner is ready
68-
runs-on: ${{ needs.start-runner.outputs.label }} # run the job on the newly created runner
56+
matrix: ${{ steps.set-matrix.outputs.matrix }}
6957
steps:
70-
- name: checkout
71-
uses: actions/checkout@v4
72-
with:
73-
ref: ${{ github.event.number && format('refs/pull/{0}/merge', github.event.number) || github.head_ref }}
74-
- name: Print runner info
58+
- name: Set matrix
59+
id: set-matrix
7560
run: |
76-
printf "Runner lscpu:\n$(lscpu)\n"
77-
printf "Runner lsmem:\n$(lsmem)\n"
78-
printf "Runner nproc:\n$(nproc)\n"
79-
printf "Runner uname:\n$(uname -a)\n"
80-
81-
- name: Install benchmark dependencies
82-
run: |
83-
sudo .install/install_script.sh
84-
sudo apt install python3-pip -y
85-
pip3 install --upgrade pip PyYAML setuptools redisbench-admin
86-
pip3 install -r requirements.txt
87-
88-
# - name: stress test
89-
# run: |
90-
# sudo apt install stress-ng -qqy
91-
# uptime
92-
# stress-ng -c 1 --timeout 60s --metrics-brief
93-
# uptime
94-
# stress-ng --stream 1 -t 60 --metrics-brief
95-
# uptime
96-
# stress-ng --ipsec-mb=1 -t 60 --metrics-brief
97-
# uptime
61+
# Define the full matrix as a JSON string
62+
FULL_MATRIX='
63+
{
64+
"include": [
65+
{
66+
"architecture": "arm64",
67+
"instance-type": "i8g.xlarge",
68+
"ami-id": "ami-0d6c92b636b74f843"
69+
},
70+
{
71+
"architecture": "x86_64",
72+
"instance-type": "r7i.xlarge",
73+
"ami-id": "ami-09fabd03bb09b3704"
74+
}
75+
]
76+
}
77+
'
78+
79+
# Filter the matrix based on architecture
80+
if [ "${{ inputs.architecture }}" = "all" ]; then
81+
# Use the full matrix
82+
FILTERED_MATRIX="$FULL_MATRIX"
83+
else
84+
# Filter to only the selected architecture
85+
FILTERED_MATRIX=$(echo "$FULL_MATRIX" | jq -c '{include: [.include[] | select(.architecture | contains("${{ inputs.architecture }}"))]}')
86+
fi
87+
88+
# Use multiline output delimiter syntax for GitHub Actions
89+
echo "matrix<<EOF" >> $GITHUB_OUTPUT
90+
echo "$FILTERED_MATRIX" >> $GITHUB_OUTPUT
91+
echo "EOF" >> $GITHUB_OUTPUT
9892
99-
# TODO: remove "--no-check-certificate" when possible
100-
- name: Download pre-generated indices
101-
timeout-minutes: 20
102-
run: ./tests/benchmark/bm_files.sh ${{ inputs.setup }}
103-
- name: Benchmark
104-
timeout-minutes: 120
105-
run: make benchmark BM_FILTER=${{ inputs.setup }}
106-
107-
- name: Collect results
108-
run: |
109-
./tests/benchmark/benchmarks.sh ${{ inputs.setup }} | xargs -P 0 -I {} redisbench-admin export \
110-
--redistimeseries_host ${{ secrets.PERFORMANCE_RTS_HOST }} \
111-
--redistimeseries_port ${{ secrets.PERFORMANCE_RTS_PORT }} \
112-
--redistimeseries_user default \
113-
--redistimeseries_pass '${{ secrets.PERFORMANCE_RTS_AUTH }}' \
114-
--github_repo ${{ github.event.repository.name }} \
115-
--github_org ${{ github.repository_owner }} \
116-
--github_branch ${{ github.head_ref || github.ref_name }} \
117-
--github_actor ${{ github.triggering_actor }} \
118-
--results-format google.benchmark \
119-
--benchmark-result-file {}_results.json
120-
121-
stop-runner:
122-
name: Stop self-hosted EC2 runner
123-
needs:
124-
- start-runner # required to get output from the start-runner job
125-
- benchmark # required to wait when the main job is done
126-
runs-on: ubuntu-latest
127-
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
128-
steps:
129-
- name: Configure AWS credentials
130-
uses: aws-actions/configure-aws-credentials@v4
131-
with:
132-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
133-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
134-
aws-region: ${{ secrets.AWS_REGION }}
135-
- name: Stop EC2 runner
136-
uses: machulav/ec2-github-runner@v2
137-
with:
138-
mode: stop
139-
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
140-
label: ${{ needs.start-runner.outputs.label }}
141-
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}
93+
run_benchmarks:
94+
name: Run ${{ matrix.architecture }} benchmarks
95+
needs: prepare_runner_configurations
96+
uses: ./.github/workflows/benchmark-runner.yml
97+
secrets: inherit
98+
strategy:
99+
matrix: ${{ fromJson(needs.prepare_runner_configurations.outputs.matrix) }}
100+
with:
101+
setup: ${{ inputs.setup }}
102+
architecture: ${{ matrix.architecture }}
103+
instance-type: ${{ matrix.instance-type }}
104+
ami-id: ${{ matrix.ami-id }}
105+
github-runner-label: ${{ matrix.architecture }}-${{ matrix.instance-type }}-${{ github.run_id }}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
include(CheckCXXCompilerFlag)
2+
3+
4+
message(STATUS "Building for ARM aarch64")
5+
6+
# Check what compiler flags are supported
7+
CHECK_CXX_COMPILER_FLAG("-march=armv7-a+neon" CXX_ARMV7_NEON)
8+
CHECK_CXX_COMPILER_FLAG("-march=armv8-a" CXX_ARMV8A)
9+
CHECK_CXX_COMPILER_FLAG("-march=armv8-a+sve" CXX_SVE)
10+
CHECK_CXX_COMPILER_FLAG("-march=armv9-a+sve2" CXX_ARMV9)
11+
12+
# Only use ARMv9 if both compiler and CPU support it
13+
if(CXX_ARMV9)
14+
message(STATUS "Using ARMv9.0-a with SVE2 (supported by CPU)")
15+
add_compile_definitions(OPT_ARMV9)
16+
endif()
17+
if (CXX_ARMV8A OR CXX_ARMV7_NEON)
18+
add_compile_definitions(OPT_NEON)
19+
endif()
20+
if (CXX_SVE)
21+
add_compile_definitions(OPT_SVE)
22+
endif()

0 commit comments

Comments
 (0)