Skip to content

Commit 75af5e4

Browse files
author
mohdsaid497566
committed
quick fix to bench table restored to og
1 parent 96aa00b commit 75af5e4

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

toolchain/mfc/bench.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,29 +85,40 @@ def diff():
8585

8686
if lhs["metadata"] != rhs["metadata"]:
8787
_lock_to_str = lambda lock: ' '.join([f"{k}={v}" for k, v in lock.items()])
88-
cons.print(f"[bold yellow]Warning[/bold yellow]: Metadata in lhs and rhs are not equal.\n"
89-
f" This could mean that the benchmarks are not comparable (e.g. one was run on CPUs and the other on GPUs).\n"
90-
f" Invocation,\t\t Modes\n"
91-
f" lhs: {' '.join(lhs['metadata']['invocation'])} | {_lock_to_str(lhs['metadata']['lock'])}\n"
92-
f" rhs: {' '.join(rhs['metadata']['invocation'])} | {_lock_to_str(rhs['metadata']['lock'])}")
88+
cons.print(f"[bold]Comparing Benchmarks: Speedups from [magenta]{os.path.relpath(ARG('lhs'))}[/magenta] to [magenta]{os.path.relpath(ARG('rhs'))}[/magenta] are displayed below. Thus, numbers > 1 represent increases in performance.[/bold]")
89+
90+
cons.print(f"""\
91+
[bold yellow]Warning[/bold yellow]: Metadata in lhs and rhs are not equal.
92+
This could mean that the benchmarks are not comparable (e.g. one was run on CPUs and the other on GPUs).
93+
lhs:
94+
* Invocation: [magenta]{' '.join(lhs['metadata']['invocation'])}[/magenta]
95+
* Modes: {_lock_to_str(lhs['metadata']['lock'])}
96+
rhs:
97+
* Invocation: {' '.join(rhs['metadata']['invocation'])}
98+
* Modes: [magenta]{_lock_to_str(rhs['metadata']['lock'])}[/magenta]
99+
""")
93100

94101
slugs = set(lhs["cases"].keys()) & set(rhs["cases"].keys())
95102
if len(slugs) not in [len(lhs["cases"]), len(rhs["cases"])]:
96103
cons.print(f"""\
97-
[bold yellow]Warning[/bold yellow]: Cases in lhs and rhs differ. Using intersection: {slugs} with {len(slugs)} elements.
104+
[bold yellow]Warning[/bold yellow]: Cases in lhs and rhs are not equal.
98105
* rhs cases: {', '.join(set(rhs['cases'].keys()) - slugs)}.
99-
* lhs cases: {', '.join(set(lhs['cases'].keys()) - slugs)}.""")
106+
* lhs cases: {', '.join(set(lhs['cases'].keys()) - slugs)}.
107+
Using intersection: {slugs} with {len(slugs)} elements.
108+
""")
100109

101110
table = rich.table.Table(show_header=True, box=rich.table.box.SIMPLE)
102111
table.add_column("[bold]Case[/bold]", justify="left")
112+
table.add_column("[bold]Pre Process[/bold]", justify="right")
113+
table.add_column("[bold]Simulation[/bold]", justify="right")
114+
table.add_column("[bold]Post Process[/bold]", justify="right")
103115

104116
err = 0
105117
for slug in slugs:
106118
lhs_summary, rhs_summary = lhs["cases"][slug]["output_summary"], rhs["cases"][slug]["output_summary"]
107119
speedups = []
108120

109121
for target in sorted(DEFAULT_TARGETS, key=lambda t: t.runOrder):
110-
table.add_column(f"[bold]{target.name}[/bold]", justify="right") #add column for each target
111122
if (target.name not in lhs_summary) or (target.name not in rhs_summary):
112123
cons.print(f"{target.name} not present in lhs_summary or rhs_summary - Case: {slug}")
113124
err = 1; continue

0 commit comments

Comments
 (0)