Skip to content

Add benchmark job #585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions .github/workflows/benchmarks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Run benchmark on pokec medium dataset

on:
push:
branches:
- benchmarks-ci

workflow_dispatch:
inputs:
mage_build_arch:
type: choice
description: "Mage build architecture"
default: 'amd64'
options:
- "amd64"
- "arm64"
mage_build_scope:
type: choice
description: "Mage build scope"
default: 'with ML'
options:
- "with ML"
- "without ML"
memgraph_branch:
type: string
description: "Memgraph branch to build from."
default: "mage-benchmarks"
mage_branch:
type: string
description: "Mage branch to build from."
default: "main"

jobs:
benchmark_on_pokec_medium:
name: "Benchmark on pokec medium dataset"
runs-on: ["self-hosted", "DockerMgBuild", "X64"] # amd64
timeout-minutes: 120
env:
THREADS: 24
MEMGRAPH_ENTERPRISE_LICENSE: ${{ secrets.MEMGRAPH_ENTERPRISE_LICENSE }}
MEMGRAPH_ORGANIZATION_NAME: ${{ secrets.MEMGRAPH_ORGANIZATION_NAME }}
OS: ubuntu-24.04
TOOLCHAIN: v6
ARCH: amd # TODO: allow arm
BUILD_TYPE: Release
MEMGRAPH_BRANCH: mage-benchmarks
CONTAINER_NAME: mgbuild_v6_ubuntu-24.04

steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Spin up mgbuild container
run: |
cd cpp/memgraph
./release/package/mgbuild.sh \
--toolchain ${{ env.TOOLCHAIN }} \
--os ${{ env.OS }} \
--arch ${{ env.ARCH }} \
run

- name: Build Memgraph release binary
run: | # For some reason --single-branch fails with get_version and node version gets messed up on init
docker exec -i -u root "${{ env.CONTAINER_NAME }}" bash -c "
cd /home/mg &&
rm -rf memgraph &&
git clone https://github.com/memgraph/memgraph.git &&
cd memgraph &&
git checkout ${{ env.MEMGRAPH_BRANCH }} &&
source /opt/toolchain-v6/activate &&
(./init || true) &&
cd build &&
cmake -DCMAKE_BUILD_TYPE=Release .. &&
make -j$(nproc)
"

# Skip packaging and just run everything in the mgbuild container
- name: Build cpp MAGE query modules
run: |
docker exec -i -u root "${{ env.CONTAINER_NAME }}" bash -c "
cd /home/mg &&
git clone https://github.com/memgraph/mage.git --recurse-submodules &&
cd mage &&
git checkout ${{ github.ref_name }} &&
source /opt/toolchain-v6/activate &&
python3 setup build -p /home/mg/memgraph/build/query_modules --cpp-build-flags CMAKE_BUILD_TYPE=Release --lang=cpp
"

- name: Run benchmarks
run: |
docker exec -i -u root "${{ env.CONTAINER_NAME }}" bash -c "
cd /home/mg/memgraph/tests/mgbench &&
source /opt/toolchain-v6/activate &&
python3 benchmark.py vendor-native --vendor-binary /home/mg/memgraph/build/memgraph --vendor-name memgraph --vendor-specific telemetry-enabled=False query-modules-directory=/home/mg/memgraph/build/query_modules --no-authorization pokec/medium/mage/* --export-results /home/mg/mage_benchmarks.json
"

- name: Upload benchmark results
run: |
cd cpp/memgraph
git checkout ${{ env.MEMGRAPH_BRANCH }}
./release/package/mgbuild.sh \
--toolchain $TOOLCHAIN \
--os $OS \
--arch $ARCH \
--enterprise-license $MEMGRAPH_ENTERPRISE_LICENSE \
--organization-name $MEMGRAPH_ORGANIZATION_NAME \
test-memgraph upload-to-bench-graph \
--benchmark-name "mage" \
--benchmark-results "/home/mg/mage_benchmarks.json" \
--github-run-id "${{ github.run_id }}" \
--github-run-number "${{ github.run_number }}" \
--head-branch-name "${{ env.MEMGRAPH_BRANCH }}+${{ github.ref_name }}"


- name: "Stop mgbuild container"
if: always()
run: |
cd cpp/memgraph
./release/package/mgbuild.sh \
--toolchain ${{ env.TOOLCHAIN }} \
--os ${{ env.OS }} \
--arch ${{ env.ARCH }} \
stop --remove
2 changes: 1 addition & 1 deletion .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
additional_tag:
type: choice
default: 'latest'
descritpion: "Additional tag for the image"
description: "Additional tag for the image"
required: true
options:
- 'latest'
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@ concurrency:
cancel-in-progress: true

on:
push:
tags:
- "v*.*.*-rc*"
- "v*.*-rc*"
schedule:
- cron: "0 1 * * *" #UTC
pull_request:
merge_group:
workflow_dispatch:
inputs:
Expand Down
Loading