From bbb254ef43c0e0f01e4c52d786501ac45ed4111d Mon Sep 17 00:00:00 2001 From: josantos Date: Thu, 10 Aug 2023 11:16:50 -0500 Subject: [PATCH] reformatting Signed-off-by: josantos --- src/omniperf_analyze/omniperf_analyze.py | 16 +++++++++------- src/utils/csv_converter.py | 22 ++++++++++++---------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/omniperf_analyze/omniperf_analyze.py b/src/omniperf_analyze/omniperf_analyze.py index 2a657d3d30..123bdd15a0 100644 --- a/src/omniperf_analyze/omniperf_analyze.py +++ b/src/omniperf_analyze/omniperf_analyze.py @@ -222,15 +222,17 @@ def run_cli(args, runs): # If we assume the panel layout for all archs are similar, it doesn't matter # which archConfig passed into show_all function. # After decide to how to manage kernels display patterns, we can revisit it. - cache =dict() + cache = dict() for d in args.path: - #demangle + # demangle for filename in os.listdir(d[0]): - if filename.endswith('.csv'): - df = pd.read_csv(os.path.join(d[0],filename)) - new_df = csv_converter.kernel_name_shortener(df, cache, args.kernelVerbose) - new_df.to_csv(os.path.join(d[0],filename), index=False) - + if filename.endswith(".csv"): + df = pd.read_csv(os.path.join(d[0], filename)) + new_df = csv_converter.kernel_name_shortener( + df, cache, args.kernelVerbose + ) + new_df.to_csv(os.path.join(d[0], filename), index=False) + file_io.create_df_kernel_top_stats( d[0], runs[d[0]].filter_gpu_ids, diff --git a/src/utils/csv_converter.py b/src/utils/csv_converter.py index 35bc5a649f..48726bf038 100644 --- a/src/utils/csv_converter.py +++ b/src/utils/csv_converter.py @@ -39,6 +39,7 @@ cache = dict() supported_arch = {"gfx906": "mi50", "gfx908": "mi100", "gfx90a": "mi200"} MAX_SERVER_SEL_DELAY = 5000 # 5 sec connection timeout + def kernel_name_shortener(df, cache, level): if level >= 5: return df @@ -116,6 +117,7 @@ def kernel_name_shortener(df, cache, level): return df + # Verify target directory and setup connection def parse(args, profileAndExport): host = args.host @@ -243,16 +245,16 @@ def convert_folder(connectionInfo, Extractionlvl): # os.system(cmd) # else: cmd = ( - "mongoimport --quiet --uri mongodb://{}:{}@{}:{}/{}?authSource=admin --file {} -c {} --drop --type csv --headerline" - ).format( - connectionInfo["username"], - connectionInfo["password"], - connectionInfo["host"], - connectionInfo["port"], - connectionInfo["db"], - connectionInfo["workload"] + "/" + file, - fileName, - ) + "mongoimport --quiet --uri mongodb://{}:{}@{}:{}/{}?authSource=admin --file {} -c {} --drop --type csv --headerline" + ).format( + connectionInfo["username"], + connectionInfo["password"], + connectionInfo["host"], + connectionInfo["port"], + connectionInfo["db"], + connectionInfo["workload"] + "/" + file, + fileName, + ) os.system(cmd) i += 1 except pd.errors.EmptyDataError: