Skip to content
Snippets Groups Projects
Commit daab624e authored by Bram Veenboer's avatar Bram Veenboer
Browse files

COB-121: Improve readability of tSubbandProcPerformance output

parent adf568a3
No related branches found
No related tags found
1 merge request!436COB-148: Enable NVRTC for CUDA kernel compilation
...@@ -40,8 +40,8 @@ print("Reference: {}".format(filename_reference)) ...@@ -40,8 +40,8 @@ print("Reference: {}".format(filename_reference))
print("Candidate: {}".format(filename_candidate)) print("Candidate: {}".format(filename_candidate))
print("Tolerance: {}%".format(tolerance)) print("Tolerance: {}%".format(tolerance))
# Read measurements
def read_measurements(filename): def read_measurements(filename):
# Open results file, skip the first two lines: # Open results file, skip the first two lines:
# Line 0: date # Line 0: date
# Line 1: info # Line 1: info
...@@ -64,46 +64,57 @@ measurements_candidate = read_measurements(filename_candidate) ...@@ -64,46 +64,57 @@ measurements_candidate = read_measurements(filename_candidate)
runtime_total = measurements_reference["total"] runtime_total = measurements_reference["total"]
runtime_threshold = runtime_total * 0.05 # 5 percent runtime_threshold = runtime_total * 0.05 # 5 percent
# Check all measurements # Organize measurements in categories passed, failed and skipped
passed = list() class Measurement():
failed = list() name = ""
missing = list() runtime_reference = 0.0
status = 0 runtime_candidate = 0.0
result = 0.0
def __str__(self):
name = '\"{}\"'.format(self.name)
return '{:32}: {:5.2f} -> {:5.2f} ({:5.1f} %)'.format(name, self.runtime_reference, self.runtime_candidate, self.result)
measurements = set()
missing = set()
for name, runtime_reference in measurements_reference.items(): for name, runtime_reference in measurements_reference.items():
# Skip very short measurements if (name in measurements_candidate):
if (runtime_reference < runtime_threshold): # Skip very short measurements
continue if (runtime_reference < runtime_threshold):
continue
# Try to get runtime for candidate
try: # Add measurement entry
runtime_candidate = measurements_candidate[name] measurement = Measurement()
measurement.name = name
# Compare the two measurements measurement.runtime_reference = runtime_reference
performance = runtime_candidate / runtime_reference * 100 measurement.runtime_candidate = measurements_candidate[name]
result = "\"{}\", reference: {:.2f}, candidate: {:.2f} ({:.1f} %)".format(name, runtime_reference, runtime_candidate, performance) measurement.result = measurement.runtime_candidate / runtime_reference * 100
if (performance < (100 + tolerance)): measurements.add(measurement)
passed.append(result) else:
else:
failed.append(result)
status = 1
except KeyError:
missing.append("\"{}\"".format(name)) missing.append("\"{}\"".format(name))
status = 1 status = 1
passed = set(filter(lambda measurement : measurement.result < (100 + tolerance), measurements))
failed = list(measurements - passed)
passed = list(passed)
passed = sorted(passed, key=lambda m: m.runtime_reference, reverse=True)
failed = sorted(failed, key=lambda m: m.runtime_reference, reverse=True)
# Print summary # Print summary
print(">>> Results") print(">>> Results")
print("PASSED:", end='') print("PASSED:", end='')
if len(passed): if len(passed):
print() print()
print("\n".join(passed)) print("\n".join([str(m) for m in passed]))
else: else:
print(" none") print(" none")
print("FAILED:", end='') print("FAILED:", end='')
if len(failed): if len(failed):
print() print()
print("\n".join(failed)) print("\n".join([str(m) for m in failed]))
else: else:
print(" none") print(" none")
...@@ -114,4 +125,6 @@ if len(missing): ...@@ -114,4 +125,6 @@ if len(missing):
else: else:
print(" none") print(" none")
# Determine exit status and exit
status = len(failed) > 0 or len(missing) > 0
exit(status) exit(status)
\ No newline at end of file
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