Skip to content
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

[fix]: KeyError Exception thrown by benchmark_size.py when missing baseline data #201

Open
wants to merge 2 commits into
base: embench-2.0-branch
Choose a base branch
from
Open
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
11 changes: 8 additions & 3 deletions benchmark_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# Contributor: Jeremy Bennett <[email protected]>
# Contributor: Roger Shepherd <[email protected]>
# Contributor: Konrad Moreon <[email protected]>
# Contributor: Madhu Sudhanan <[email protected]>
#
# This file is part of Embench.

Expand Down Expand Up @@ -297,9 +298,13 @@ def collect_data(benchmarks):
# Want relative results (the default). If baseline is zero, just
# use 0.0 as the value. Note this is inverted compared to the
# speed benchmark, so SMALL is good.
if baseline[bench] > 0:
rel_data[bench] = raw_totals[bench] / baseline[bench]
else:
try:
if baseline[bench] > 0:
rel_data[bench] = raw_totals[bench] / baseline[bench]
else:
rel_data[bench] = 0.0
except KeyError:
log.error(f'Baseline data for {bench} not found. Assuming 0.')
rel_data[bench] = 0.0

# Output it
Expand Down