From 1b1fc2585b42e9630671d8dcec5d6bb61d592c72 Mon Sep 17 00:00:00 2001 From: Liyan Zheng Date: Wed, 2 Nov 2022 17:38:08 +0800 Subject: [PATCH] Add: save optime result --- python/infinitensor/evalute_onnx.py | 2 +- python/infinitensor/rules.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/python/infinitensor/evalute_onnx.py b/python/infinitensor/evalute_onnx.py index d400d58c..1e8eb9af 100644 --- a/python/infinitensor/evalute_onnx.py +++ b/python/infinitensor/evalute_onnx.py @@ -475,4 +475,4 @@ if __name__ == "__main__": # parser.add_argument("--output", help="Output file") args = parser.parse_args() import_onnx(args.model, args.bs) - print_result() \ No newline at end of file + print_result(args.model) \ No newline at end of file diff --git a/python/infinitensor/rules.py b/python/infinitensor/rules.py index 060cac07..6d7d1271 100644 --- a/python/infinitensor/rules.py +++ b/python/infinitensor/rules.py @@ -1,6 +1,8 @@ import pandas as pd import numpy as np from operator_timer import * +from datetime import datetime + pd.options.display.float_format = '{:,.3f}'.format df= pd.DataFrame(columns=['n', 'c', 'h', 'w', 'f', 'r', 's', 'ph', 'pw', 'sh', 'sw', 'dh', 'dw', 'oph', 'opw', 'group']) @@ -72,9 +74,11 @@ def conv_tranpsposed2d_togemm(name, n, c, h, w, f, r, s, ph, pw, sh, sw, dh, dw, conv_transposed2d_rules=[conv_tranpsposed2d_original, conv_tranpsposed2d_togemm] -def print_result(): +def print_result(model_fn): + pd.set_option('display.max_rows', 500) df['t_min'] = df.filter(regex=("^t_.*")).min(axis=1) print(df) print(f'Origin: {df["t_original"].sum():.3f} ms') print(f'Min: {df["t_min"].sum():.3f} ms') - print(f'Speedup: {df["t_original"].sum()/df["t_min"].sum():.3f} x') \ No newline at end of file + print(f'Speedup: {df["t_original"].sum()/df["t_min"].sum():.3f} x') + df.to_pickle(f'optime_{model_fn.split("/")[-1]}_{datetime.now().strftime("%m_%d_%H_%M_%S")}.pkl') \ No newline at end of file