Skip to content

Commit d292c29

Browse files
authored
Fix for issue #395 (#414)
1 parent 364e3cf commit d292c29

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

toolchain/mfc/bench.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,27 +79,30 @@ def bench(targets = None):
7979
def diff():
8080
lhs, rhs = file_load_yaml(ARG("lhs")), file_load_yaml(ARG("rhs"))
8181

82-
cons.print(f"[bold]Comparing Bencharks: [magenta]{os.path.relpath(ARG('lhs'))}[/magenta] is x times slower than [magenta]{os.path.relpath(ARG('rhs'))}[/magenta].[/bold]")
83-
82+
cons.print(f"[bold]Comparing Benchmarks: Numbers < 1 indicate the [magenta]{os.path.relpath(ARG('rhs'))}[/magenta] is faster than [magenta]{os.path.relpath(ARG('lhs'))}[/magenta], > 1 indicate [magenta]{os.path.relpath(ARG('rhs'))}[/magenta] is slower.[/bold]")
8483
if lhs["metadata"] != rhs["metadata"]:
8584
def _lock_to_str(lock):
8685
return ' '.join([f"{k}={v}" for k, v in lock.items()])
8786

88-
cons.print(f"[bold yellow]Warning[/bold yellow]: Metadata in lhs and rhs are not equal.")
89-
cons.print(f" This could mean that the benchmarks are not comparable (e.g. one was run on CPUs and the other on GPUs).")
90-
cons.print(f" lhs:")
91-
cons.print(f" * Invocation: [magenta]{' '.join(lhs['metadata']['invocation'])}[/magenta]")
92-
cons.print(f" * Modes: {_lock_to_str(lhs['metadata']['lock'])}")
93-
cons.print(f" rhs:")
94-
cons.print(f" * Invocation: {' '.join(rhs['metadata']['invocation'])}")
95-
cons.print(f" * Modes: [magenta]{_lock_to_str(rhs['metadata']['lock'])}[/magenta]")
87+
cons.print(f"""\
88+
[bold yellow]Warning[/bold yellow]: Metadata in lhs and rhs are not equal.
89+
This could mean that the benchmarks are not comparable (e.g. one was run on CPUs and the other on GPUs).
90+
lhs:
91+
* Invocation: [magenta]{' '.join(lhs['metadata']['invocation'])}[/magenta]
92+
* Modes: {_lock_to_str(lhs['metadata']['lock'])}
93+
rhs:
94+
* Invocation: {' '.join(rhs['metadata']['invocation'])}
95+
* Modes: [magenta]{_lock_to_str(rhs['metadata']['lock'])}[/magenta]
96+
""")
9697

9798
slugs = set(lhs["cases"].keys()) & set(rhs["cases"].keys())
9899
if len(slugs) not in [len(lhs["cases"]), len(rhs["cases"])]:
99-
cons.print(f"[bold yellow]Warning[/bold yellow]: Cases in lhs and rhs are not equal.")
100-
cons.print(f" * rhs cases: {', '.join(set(rhs['cases'].keys()) - slugs)}.")
101-
cons.print(f" * lhs cases: {', '.join(set(lhs['cases'].keys()) - slugs)}.")
102-
cons.print(f" Using intersection: {slugs} with {len(slugs)} elements.")
100+
cons.print(f"""\
101+
[bold yellow]Warning[/bold yellow]: Cases in lhs and rhs are not equal.
102+
* rhs cases: {', '.join(set(rhs['cases'].keys()) - slugs)}.
103+
* lhs cases: {', '.join(set(lhs['cases'].keys()) - slugs)}.
104+
Using intersection: {slugs} with {len(slugs)} elements.
105+
""")
103106

104107
table = rich.table.Table(show_header=True, box=rich.table.box.SIMPLE)
105108
table.add_column("[bold]Case[/bold]", justify="left")

0 commit comments

Comments
 (0)