Skip to content
Snippets Groups Projects
Verified Commit 106cdcfe authored by Dorian Stoll's avatar Dorian Stoll
Browse files

rodinia-srad: Add script to compare and validate two benchmark results

parent ba009342
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
from __future__ import annotations
import sys
from pathlib import Path
def main(args: list[str]) -> int:
outputA: Path = Path(args[0])
outputB: Path = Path(args[1])
linesA: list[str] = outputA.read_text().splitlines()
linesB: list[str] = outputB.read_text().splitlines()
assert len(linesA) == len(linesB)
assert linesA[0] == linesB[0]
assert linesA[1] == linesB[1]
errors: list[float] = []
for i in range(2, len(linesA) - 2):
floatsA: list[float] = [float(x) for x in linesA[i].strip().split(' ')]
floatsB: list[float] = [float(x) for x in linesB[i].strip().split(' ')]
assert len(floatsA) == len(floatsB)
for j in range(0, len(floatsA)):
errors.append(abs(floatsA[j] - floatsB[j]))
assert linesA[-1] == linesB[-1]
print(f"Absolute Error: {sum(errors)}")
print(f"Average Error: {sum(errors) / len(errors)}")
print(f"Min Error: {min(errors)}")
print(f"Max Error: {max(errors)}")
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment