Skip to content

Commit 7931689

Browse files
Average over 2o runs
1 parent 0f8ed0b commit 7931689

3 files changed

Lines changed: 35 additions & 8 deletions

File tree

.github/scripts/csv_to_md.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,15 @@
1919

2020
table = []
2121
for benchmark, baseline in zip(table_benchmark, table_baseline):
22-
assert(benchmark[0] == baseline[0] and benchmark[2:4] == baseline[2:4])
22+
assert(benchmark[0] == baseline[0])
2323
name = benchmark[0]
2424
time = benchmark[1]
25+
stdev = benchmark[1]
2526
d = float(baseline[1]) - float(benchmark[1])
2627
emoji = ':red_circle:' if 0 < d else ':green_circle:'
2728
difference = pretty(d)
2829
percent = pretty(100 * d / float(baseline[1]))
29-
count = benchmark[2]
30-
events = benchmark[3]
31-
table.append([name, time, emoji, difference, percent, count, events])
30+
table.append([name, time, stdev, emoji, difference, percent])
3231

33-
header = ["name", "time", "", "difference", "percent", "count", "events"]
32+
header = ["name", "time", "stdev", "", "difference", "percent"]
3433
print(tab.tabulate(table, header, tablefmt="github"))

.github/scripts/merge_runs.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import sys
2+
import csv
3+
import statistics
4+
5+
in_csv = sys.argv[1]
6+
out_csv = sys.argv[2]
7+
8+
time_dict = dict({})
9+
10+
with open(in_csv) as csv_file:
11+
csv_reader = csv.reader(csv_file)
12+
next(csv_reader)
13+
for name, time, _, _ in csv_reader:
14+
if name in time_dict.keys():
15+
time_dict[name].append(float(time))
16+
else:
17+
time_dict[name] = [float(time)]
18+
19+
data = [["name", "time", "stdev"]]
20+
for name, time_list in time_dict.items():
21+
mean = statistics.mean(time_list)
22+
stdev = statistics.stdev(time_list)
23+
data.append([name, mean, stdev])
24+
25+
with open(out_csv, 'w') as csv_file:
26+
csv_writer = csv.writer(csv_file)
27+
csv_writer.writerows(data)

.github/workflows/standalone-benchmark.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
ALIBUILD_ARCH_PREFIX: el9-x86_64/Packages
3434
MODULEPATH: /cvmfs/alice.cern.ch/etc/toolchain/modulefiles/el9-x86_64:/cvmfs/alice.cern.ch/el9-x86_64/Modules/modulefiles
3535
STANDALONE_DIR: /root/standalone
36-
ARTIFACT_FILE: /root/benchmark.csv
36+
BENCHMARK_CSV: /root/benchmark.csv
3737
LD_LIBRARY_PATH: /usr/local/cuda-13.0/compat
3838

3939
name: ${{ matrix.name }}
@@ -87,14 +87,15 @@ jobs:
8787
source /etc/profile.d/modules.sh
8888
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
8989
cd ${STANDALONE_DIR}
90-
${STANDALONE_DIR}/ca -e 50kHz -g --memSize 15000000000 --sync --runs 1 --debug 1 --PROCtimingCSV ${ARTIFACT_FILE}
90+
${STANDALONE_DIR}/ca -e 50kHz -g --memSize 15000000000 --sync --runs 20 --debug 1 --PROCtimingCSV ${BENCHMARK_CSV}
9191
rm -rf ${STANDALONE_DIR}/events/50kHz ${STANDALONE_DIR}/build
9292
9393
- name: Display table on GitHub web
9494
run: |
9595
source /etc/profile.d/modules.sh
9696
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
97-
python3 ${GITHUB_WORKSPACE}/.github/scripts/csv_to_md.py ${ARTIFACT_FILE} ${STANDALONE_DIR}/baseline/${{ matrix.name }}.csv >> ${GITHUB_STEP_SUMMARY}
97+
python3 ${GITHUB_WORKSPACE}/.github/scripts/merge_runs.py ${BENCHMARK_CSV} ${BENCHMARK_CSV}
98+
python3 ${GITHUB_WORKSPACE}/.github/scripts/csv_to_md.py ${BENCHMARK_CSV} ${BENCHMARK_CSV} #${STANDALONE_DIR}/baseline/${{ matrix.name }}.csv >> ${GITHUB_STEP_SUMMARY}
9899
rm -rf ${STANDALONE_DIR}/baseline
99100
100101
- name: Upload Artifact

0 commit comments

Comments
 (0)