-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathdisplay_bench_results.py
More file actions
89 lines (76 loc) · 2.54 KB
/
display_bench_results.py
File metadata and controls
89 lines (76 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Standard
from typing import List
import argparse
# First Party
# import this because of alot of internal contants
from scripts.benchmarks.benchmark import DIR_SAMP_CONFIGS, gather_report
def main(
*directories: str,
output_filename: str = "results.csv",
remove_columns: List[str] = None,
keep_columns: List[str] = None,
):
"gather outputs from a list of directories and output to a csv"
df, constant = gather_report(directories, raw=False)
errors = []
try:
# remove error messages if any
errors = df.error_messages
errors = errors.loc[errors.isna() == False]
df = df.loc[df.error_messages.isna()]
except:
pass
# filter result columns to keep by the inverse of remove_columns
if remove_columns:
df = df[df.columns[~df.columns.isin(remove_columns)]]
# assume keep and remove are disjoint
kept = 0
if keep_columns:
for c in keep_columns:
if c in constant:
df[c] = constant[c]
kept += 1
df = df.reset_index(drop=True)
try:
df = df.drop("output_dir", axis=1)
except KeyError:
pass # output_dir not found
df.reindex(sorted(df.columns), axis=1).to_csv(output_filename, index=False)
print("***************** Report Created ******************")
print(f"Total lines: '{len(df)}'")
print(f"Number columns included: '{len(df.columns)}'")
print(f"Number columns excluded: '{len(constant)-kept}'")
print(f"Excluding number of exceptions caught: '{len(errors)}'")
print(f"Written report to '{output_filename}'")
if __name__ == "__main__":
parser = argparse.ArgumentParser(
prog="Acceleration Benchmarking Reporting Tool",
description="This script gathers a set benchmarks to produce a CSV report",
)
parser.add_argument(
"bench_outputs",
nargs="+",
help="list of directories from which to gather bench outputs.",
)
parser.add_argument(
"--result_file",
default="results.csv",
help="name of final csv report file.",
)
parser.add_argument(
"--remove_columns",
nargs="*",
help="list of columns to ignore from results.csv",
)
parser.add_argument(
"--keep_columns",
nargs="*",
help="list of columns to always include into results.csv",
)
args = parser.parse_args()
main(
*args.bench_outputs,
output_filename=args.result_file,
remove_columns=args.remove_columns,
keep_columns=args.keep_columns,
)