Skip to content

Commit 4d66aba

Browse files
Compare performance to baseline
1 parent 7466a0f commit 4d66aba

2 files changed

Lines changed: 40 additions & 5 deletions

File tree

.github/scripts/csv_to_md.py

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,42 @@
22
import csv
33
import tabulate as tab
44

5-
csv_filename = sys.argv[1]
5+
csv_benchmark = sys.argv[1]
6+
csv_baseline = sys.argv[2]
67

7-
with open(csv_filename) as csv_file:
8+
def html_inline(x):
9+
if x == 0:
10+
color = "black"
11+
x = "{:.1f}".format(x)
12+
elif x < 0:
13+
color = "green"
14+
x = "{:.1f}".format(x)
15+
elif x > 0:
16+
color = "red"
17+
x = "+{:.1f}".format(x)
18+
return f"<span style=\"color:{color}\">{x}</span>"
19+
20+
with open(csv_benchmark) as csv_file:
21+
csv_reader = csv.reader(csv_file)
22+
next(csv_reader)
23+
table_benchmark = [row for row in csv_reader]
24+
25+
with open(csv_baseline) as csv_file:
826
csv_reader = csv.reader(csv_file)
9-
header = next(csv_reader)
10-
table = [row for row in csv_reader]
27+
next(csv_reader)
28+
table_baseline = [row for row in csv_reader]
29+
30+
table = []
31+
for benchmark, baseline in zip(table_benchmark, table_baseline):
32+
assert(benchmark[0] == baseline[0] and benchmark[2:4] == baseline[2:4])
33+
name = benchmark[0]
34+
time = benchmark[1]
35+
d = float(baseline[1]) - float(benchmark[1])
36+
difference = html_inline(d)
37+
percent = html_inline(100 * d / float(baseline[1]))
38+
count = benchmark[2]
39+
events = benchmark[3]
40+
table.append([name, time, difference, percent, count, events])
1141

42+
header = ["name", "time", "difference", "percent", "count", "events"]
1243
print(tab.tabulate(table, header, tablefmt="github"))

.github/workflows/standalone-benchmark.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ jobs:
4747
4848
curl -fL --retry 3 -o ${STANDALONE_DIR}/o2-simple-GPU.out https://cernbox.cern.ch/remote.php/dav/public-files/SfYXgQOHFga2w75/o2-simple-GPU.out
4949
50+
mkdir -p ${STANDALONE_DIR}/baseline
51+
curl -fL --retry 3 -o ${STANDALONE_DIR}/baseline/${{ matrix.name }}.csv https://cernbox.cern.ch/remote.php/dav/public-files/SfYXgQOHFga2w75/baseline/${{ matrix.name }}.csv
52+
5053
mkdir -p ${STANDALONE_DIR}/events
5154
curl -fL --retry 3 -o ${STANDALONE_DIR}/events/o2-simple.tar.xz https://cernbox.cern.ch/remote.php/dav/public-files/SfYXgQOHFga2w75/events/o2-simple.tar.xz
5255
tar -xf ${STANDALONE_DIR}/events/o2-simple.tar.xz -C ${STANDALONE_DIR}/events
@@ -91,7 +94,8 @@ jobs:
9194
run: |
9295
source /etc/profile.d/modules.sh
9396
module load ninja/fortran-v1.11.1.g9-15 Vc/1.4.5-10 boost/v1.83.0-alice2-57 fmt/11.1.2-14 CMake/v3.31.6-10 ms_gsl/4.2.1-3 Clang/v20.1.7-9 TBB/v2022.3.0-3 ROOT/v6-36-04-alice9-15 ONNXRuntime/v1.22.0-71 GLFW/3.3.2-25
94-
python3 ${GITHUB_WORKSPACE}/.github/scripts/csv_to_md.py ${ARTIFACT_FILE} >> ${GITHUB_STEP_SUMMARY}
97+
python3 ${GITHUB_WORKSPACE}/.github/scripts/csv_to_md.py ${ARTIFACT_FILE} ${STANDALONE_DIR}/baseline/${{ matrix.name }}.csv >> ${GITHUB_STEP_SUMMARY}
98+
rm -rf ${STANDALONE_DIR}/baseline
9599
96100
- name: Upload Artifact
97101
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)