Skip to content

Commit 0535e7f

Browse files
authored
Extract logic from main in build_report.py to make it reusable as a library (#3892)
Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
1 parent 9e93abe commit 0535e7f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

benchmarks/triton_kernels_benchmark/build_report.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def check_cols(target_cols, all_cols):
5050
raise ValueError(f"Couldn't find required columns: '{diff}' among available '{all_cols}'")
5151

5252

53-
def transform_df(df, args: PassedArgs) -> pd.DataFrame:
53+
def build_report(args: PassedArgs):
54+
df = pd.read_csv(args.source)
5455
param_cols = args.param_cols.split(",")
5556
hbm_col = args.hbm_col
5657
check_cols(param_cols, df.columns)
@@ -108,14 +109,12 @@ def transform_df(df, args: PassedArgs) -> pd.DataFrame:
108109
for name, val in host_info.items():
109110
df_results[name] = val
110111

111-
return df_results
112+
df_results.to_csv(args.target, index=False)
112113

113114

114115
def main():
115116
args = parse_args()
116-
df = pd.read_csv(args.source)
117-
result_df = transform_df(df, args)
118-
result_df.to_csv(args.target, index=False)
117+
build_report(args)
119118

120119

121120
if __name__ == "__main__":

0 commit comments

Comments
 (0)