Skip to content

Commit b16aa09

Browse files
committed
Add gitlab job for performance tests and github benchmark workflow for visualization
1 parent 1388b64 commit b16aa09

File tree

4 files changed

+85
-1
lines changed

4 files changed

+85
-1
lines changed

.ci-scripts/build_and_test.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use_dev_shm=${USE_DEV_SHM:-true}
2929
spack_debug=${SPACK_DEBUG:-false}
3030
debug_mode=${DEBUG_MODE:-false}
3131
push_to_registry=${PUSH_TO_REGISTRY:-true}
32+
performance_tests=${PERFORMANCE_TESTS:-false}
3233

3334
# REGISTRY_TOKEN allows you to provide your own personal access token to the CI
3435
# registry. Be sure to set the token with at least read access to the registry.
@@ -223,7 +224,7 @@ then
223224
fi
224225

225226
# Test
226-
if [[ "${option}" != "--build-only" ]]
227+
if [[ "${option}" != "--build-only" && "${performance_tests}" != "true" ]]
227228
then
228229

229230
if [[ ! -d ${build_dir} ]]
@@ -267,6 +268,27 @@ then
267268
timed_message "Quandary tests completed"
268269
fi
269270

271+
# Performance tests
272+
if [[ "${option}" != "--build-only" && "${performance_tests}" == "true" ]]
273+
then
274+
275+
cd ${project_dir}
276+
277+
timed_message "Performance tests for Quandary"
278+
279+
timed_message "Install python test dependencies"
280+
281+
eval `${spack_cmd} env activate ${spack_env_path} --sh`
282+
python -m pip install -e . --prefer-binary
283+
284+
timed_message "Run performance tests"
285+
286+
mpi_exe=$(grep 'MPIEXEC_EXECUTABLE' "${hostconfig_path}" | cut -d'"' -f2 | sed 's/;/ /g')
287+
pytest -v -s performance_tests --mpi-exec="${mpi_exe}" --benchmark-json=benchmark_results.json
288+
289+
timed_message "Quandary performance tests completed"
290+
fi
291+
270292
cd ${project_dir}
271293

272294
timed_message "Build and test completed"

.github/workflows/benchmark.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Process Benchmark
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
benchmark_data:
7+
description: 'Base64 encoded benchmark data'
8+
required: true
9+
pull_request: # TODO remove this later
10+
branches:
11+
- main
12+
13+
jobs:
14+
store-and-visualize:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Decode benchmark data
20+
run: echo "${{ github.event.inputs.benchmark_data }}" | base64 -d > benchmark.json
21+
22+
- name: Store benchmark result
23+
uses: benchmark-action/github-action-benchmark@v1
24+
with:
25+
tool: 'pytest'
26+
output-file-path: benchmark.json
27+
github-token: ${{ secrets.GITHUB_TOKEN }}
28+
auto-push: true
29+
gh-pages-branch: gh-pages
30+
benchmark-data-dir-path: dev/bench
31+
comment-on-alert: true
32+
alert-threshold: '120%'
33+
max-items-in-chart: 100

.gitlab/custom-jobs-and-variables.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,24 @@ variables:
4949
reports:
5050
junit: junit.xml
5151

52+
.performance_job:
53+
artifacts:
54+
paths:
55+
- benchmark_results.json
56+
after_script:
57+
- |
58+
if [ -f "benchmark_results.json" ]; then
59+
echo "Sending benchmark results to GitHub..."
60+
BENCHMARK_DATA=$(base64 -w 0 benchmark_results.json)
61+
curl -X POST \
62+
-H "Authorization: token $GITHUB_TOKEN" \
63+
-H "Accept: application/vnd.github.v3+json" \
64+
https://api.github.com/repos/${GITHUB_PROJECT_ORG}/${GITHUB_PROJECT_NAME}/actions/workflows/benchmark.yml/dispatches \
65+
-d "{\"ref\":\"main\",\"inputs\":{\"benchmark_data\":\"$BENCHMARK_DATA\"}}"
66+
else
67+
echo "benchmark_results.json not found, skipping GitHub API integration."
68+
fi
69+
5270
.reproducer_vars:
5371
script:
5472
- |

.gitlab/jobs/ruby.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,14 @@ gcc_10_3_1:
2323
variables:
2424
SPEC: "${PROJECT_RUBY_VARIANTS} %gcc@=10.3.1 ${PROJECT_RUBY_DEPS} ^mvapich2%gcc@=10.3.1"
2525
extends: .job_on_ruby
26+
27+
############
28+
# Extra jobs
29+
############
30+
performance_tests_clang_14_0_6:
31+
variables:
32+
SPEC: "${PROJECT_RUBY_VARIANTS} %clang@=14.0.6 ${PROJECT_RUBY_DEPS}"
33+
PERFORMANCE_TESTS: "true"
34+
extends:
35+
- .job_on_ruby
36+
- .performance_job

0 commit comments

Comments
 (0)