Skip to content

Commit beca64a

Browse files
committed
[benchmarks] Separate main and feature benchmarks.
1 parent 1b92c88 commit beca64a

File tree

3 files changed

+83
-23
lines changed

3 files changed

+83
-23
lines changed
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Run benchmarks
2+
description: Run benchmarks and collect results
3+
4+
inputs:
5+
scheduler:
6+
type: string # A comma-separated list (no spaces!) is allowed.
7+
required: true
8+
runtime-ref:
9+
type: string
10+
required: true
11+
12+
13+
outputs:
14+
output-file:
15+
description: "The CSV file summarizing all benchmark results"
16+
value: ${{ steps.collect-results.outputs.output-file }}
17+
18+
19+
runs:
20+
using: "composite"
21+
steps:
22+
- name: Update LFC
23+
run: |
24+
echo $(ls)
25+
cd lf/org.lflang/src/lib/c/reactor-c && \
26+
git switch ${{ inputs.runtime-ref }} && cd ../../../../..
27+
echo $(ls)
28+
./gradlew buildLfc
29+
cd ..
30+
shell: bash
31+
32+
- name: Run benchmarks
33+
# TODO: Run all benchmarks with several numbers of threads
34+
# run: |
35+
# ./runner/run_benchmark.py -m continue_on_error=True iterations=12 \
36+
# benchmark="glob(*)" target=lf-c size=fast \
37+
# target.params.scheduler=GEDF_NP,NP,adaptive threads=1,3,6,12,24
38+
run: | # DEBUG
39+
./runner/run_benchmark.py -m continue_on_error=True iterations=12 \
40+
benchmark="savina_concurrency_cigsmok" target=lf-c size=fast \
41+
target.params.scheduler=${{ github.event.inputs.scheduler }} threads=1,3
42+
shell: bash
43+
44+
- name: Collect benchmark results
45+
id: collect-results
46+
run: |
47+
SHA=$(cd lf/org.lflang/src/lib/c/reactor-c && \
48+
git rev-parse --short=7 HEAD && cd ../../../../..)
49+
BRANCH=$(git rev-parse --abbrev-ref HEAD)
50+
OUTPUT_FILE=${{ inputs.scheduler }}-$BRANCH-$SHA.csv
51+
echo "The collected benchmark results will be saved to $OUTPUT_FILE"
52+
./runner/collect_results.py latest $OUTPUT_FILE
53+
echo "::set-output name=output-file::$OUTPUT_FILE"
54+
shell: bash

.github/actions/set-up-workspace/action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ runs:
2727
run: pip3 install -r runner/requirements.txt
2828
shell: bash
2929

30-
- name: Build lfc
30+
- name: Build lfc # FIXME: Redundant with run-benchmarks
3131
run: |
3232
cd lf
3333
./gradlew buildLfc
@@ -37,4 +37,4 @@ runs:
3737
run: |
3838
echo "LF_PATH=$GITHUB_WORKSPACE/lf" >> $GITHUB_ENV
3939
echo "LF_BENCHMARKS_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
40-
shell: bash
40+
shell: bash

.github/workflows/user-requested-benchmark.yml

+27-21
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@ on:
77
workflow_dispatch:
88
inputs:
99
pr_number:
10-
required: true
10+
default: 91 # TODO: remove this line and uncomment required: true
11+
# required: true
1112
type: number
13+
scheduler:
14+
default: NP
15+
feature_branch:
16+
default: automated_full_benchmark # TODO (same as above)
17+
# required: true
1218

1319
permissions:
1420
contents: write
@@ -33,36 +39,37 @@ jobs:
3339
repository: lf-lang/reactor-c
3440
token: ${{ secrets.GITHUB_TOKEN }}
3541
fetch-depth: 0 # It will be necessary to push to this repo
36-
ref: automated-full-benchmark # FIXME: delete this line after merge
42+
ref: graphics
3743
path: reactor-c
3844

3945
- name: Set up workspace
4046
uses: lf-lang/reactor-c/.github/actions/set-up-workspace@automated-full-benchmark
4147

42-
- name: Run C Benchmarks
43-
# run: |
44-
# ./runner/run_benchmark.py -m continue_on_error=True iterations=12 \
45-
# benchmark="glob(*)" target=lf-c size=fast \
46-
# target.params.scheduler=GEDF_NP,NP,adaptive threads=1,3,6,12,24
47-
run: | # DEBUG
48-
./runner/run_benchmark.py -m continue_on_error=True iterations=12 \
49-
benchmark="savina_parallelism_recmatmul" target=lf-c size=fast \
50-
target.params.scheduler=NP,adaptive threads=1,3,0
51-
shell: bash
48+
- name: Run C Benchmarks (feature branch)
49+
id: benchmarks-feature
50+
uses: lf-lang/reactor-c/.github/actions/run-benchmarks@automated-full-benchmark
51+
with:
52+
scheduler: ${{ github.event.inputs.scheduler }}
53+
runtime-ref: ${{ github.event.inputs.branch }}
5254

53-
- name: Collect benchmark results
54-
run: |
55-
./runner/collect_results.py latest latest-benchmark-results.csv
56-
shell: bash
55+
- name: Run C Benchmarks (main branch)
56+
id: benchmarks-main
57+
uses: lf-lang/reactor-c/.github/actions/run-benchmarks@automated-full-benchmark
58+
with:
59+
scheduler: GEDF_NP,NP,adaptive
60+
runtime-ref: main
5761

5862
- name: Make figure
5963
run: |
6064
OUTPUT_DIR=images/$(date -I)
65+
echo "Figure will be created in $OUTPUT_DIR"
6166
SHA=${{ github.sha }}
6267
OUTPUT_FILE=$OUTPUT_DIR/${SHA:0:7}.png
68+
echo "Figure will be named $OUTPUT_FILE"
6369
mkdir -p reactor-c/$OUTPUT_DIR
64-
./runner/make-graphics.py latest-benchmark-results.csv reactor-c/$OUTPUT_FILE
65-
echo "::set-output name=output_file::$OUTPUT_FILE"
70+
./runner/make-graphics.py ${{ steps.benchmarks-feature.outputs.output-file }} \
71+
${{ steps.benchmarks-main.outputs.output-file }} reactor-c/$OUTPUT_FILE
72+
echo "::set-output name=output-file::$OUTPUT_FILE"
6673
shell: bash
6774
id: figure
6875

@@ -72,8 +79,7 @@ jobs:
7279
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
7380
git config --global user.name "github-actions[bot]"
7481
git fetch
75-
git switch graphics
76-
git add ${{ steps.figure.outputs.OUTPUT_FILE }}
82+
git add ${{ steps.figure.outputs.output-file }}
7783
git commit -m "benchmark ${{ github.sha }}"
7884
git config -l | grep 'http\..*\.extraheader' | cut -d= -f1 | \
7985
xargs -L1 git config --unset-all
@@ -86,5 +92,5 @@ jobs:
8692
with:
8793
message: |
8894
![Visualization of the benchmark results.](https://raw.githubusercontent.com/lf-lang/reactor-c/graphics/${{ steps.figure.outputs.OUTPUT_FILE }})
89-
pr_number: 91 # ${{ inputs.pr_number }}
95+
pr_number: ${{ inputs.pr_number }}
9096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)