From d67d888e14fbf7e328df3cd013dbd6f656bcab53 Mon Sep 17 00:00:00 2001 From: colramos-amd Date: Wed, 9 Nov 2022 12:25:20 -0600 Subject: [PATCH] Reduce default content in GUI #9 Signed-off-by: colramos-amd [ROCm/rocprofiler-compute commit: d4bf9d1c162dd966ca83e842ce945c68df97627d] --- .../src/omniperf_cli/omniperf_cli.py | 4 +--- .../src/omniperf_cli/utils/gui.py | 23 +++++++++++++++---- .../src/omniperf_cli/utils/parser.py | 17 +++++++------- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/projects/rocprofiler-compute/src/omniperf_cli/omniperf_cli.py b/projects/rocprofiler-compute/src/omniperf_cli/omniperf_cli.py index bf900c9d27..e7a03dc32e 100644 --- a/projects/rocprofiler-compute/src/omniperf_cli/omniperf_cli.py +++ b/projects/rocprofiler-compute/src/omniperf_cli/omniperf_cli.py @@ -175,9 +175,7 @@ def omniperf_cli(args): args.path[0][0] ) # create mega df is_gui = False - # parser.load_table_data( - # runs[args.path[0][0]], args.path[0][0], is_gui, args.g - # ) # create the loaded table + parser.load_kernel_top(runs[args.path[0][0]], args.path[0][0]) input_filters = { "kernel": runs[args.path[0][0]].filter_kernel_ids, diff --git a/projects/rocprofiler-compute/src/omniperf_cli/utils/gui.py b/projects/rocprofiler-compute/src/omniperf_cli/utils/gui.py index 1c347e2088..fb67974b26 100644 --- a/projects/rocprofiler-compute/src/omniperf_cli/utils/gui.py +++ b/projects/rocprofiler-compute/src/omniperf_cli/utils/gui.py @@ -308,9 +308,7 @@ def build_layout( Build gui layout """ comparable_columns = parser.build_comparable_columns(time_unit) - base_run, base_data = next(iter(runs.items())) - app.layout = html.Div(style={"backgroundColor": "rgb(50, 50, 50)" if IS_DARK else ""}) filt_kernel_names = [] @@ -343,6 +341,7 @@ def build_layout( ) def generate_from_filter(disp_filt, kernel_filter, gcd_filter, div_children): runs[path_to_dir].dfs = copy.deepcopy(archConfigs.dfs) # reset the equations + panel_configs = copy.deepcopy(archConfigs.panel_configs) # Generate original raw df runs[path_to_dir].raw_pmc = file_io.create_df_pmc(path_to_dir) if verbose >= 1: @@ -361,11 +360,27 @@ def build_layout( time_unit, num_results, ) - # Evaluate metrics and table data from the raw df is_gui = True + # Only display basic metrics if no filters are applied + if not (disp_filt or kernel_filter or gcd_filter): + temp = {} + keep = [1, 201, 101, 1901] + for key in runs[path_to_dir].dfs: + if keep.count(key) != 0: + temp[key] = runs[path_to_dir].dfs[key] + + runs[path_to_dir].dfs = temp + temp = {} + keep = [0, 100, 200, 1900] + for key in panel_configs: + if keep.count(key) != 0: + temp[key] = panel_configs[key] + panel_configs = temp + parser.load_table_data( runs[path_to_dir], path_to_dir, True, debug ) # Note: All the filtering happens in this function + div_children = [] div_children.append( get_memchart(archConfigs.panel_configs[1900]["data source"], base_data) @@ -379,7 +394,7 @@ def build_layout( ) ) # Iterate over each section as defined in panel configs - for panel_id, panel in archConfigs.panel_configs.items(): + for panel_id, panel in panel_configs.items(): title = str(panel_id // 100) + ". " + panel["title"] section_title = ( panel["title"] diff --git a/projects/rocprofiler-compute/src/omniperf_cli/utils/parser.py b/projects/rocprofiler-compute/src/omniperf_cli/utils/parser.py index de416ac174..4b674ab592 100644 --- a/projects/rocprofiler-compute/src/omniperf_cli/utils/parser.py +++ b/projects/rocprofiler-compute/src/omniperf_cli/utils/parser.py @@ -650,7 +650,6 @@ def apply_filters(workload, is_gui, debug): # NB: support ignoring the 1st n dispatched execution by '> n' # The better way may be parsing python slice string for d in workload.filter_dispatch_ids: - print("len of ret_df is ", len(ret_df)) if int(d) > len(ret_df) - 2: # subtract 2 bc of the two header rows print("{} is an invalid dispatch id.".format(d)) sys.exit(1) @@ -674,12 +673,7 @@ def apply_filters(workload, is_gui, debug): return ret_df -def load_table_data(workload, dir, is_gui, debug): - """ - Load data for all "raw_csv_table". - Calculate mertric value for all "metric_table". - """ - +def load_kernel_top(workload, dir): # NB: # - Do pmc_kernel_top.csv loading before eval_metric because we need the kernel names. # - There might be a better way/timing to load raw_csv_table. @@ -698,9 +692,16 @@ def load_table_data(workload, dir, is_gui, debug): # All transposed columns should be marked with a general header, # so tty could detect them and show them correctly in comparison. tmp[id].columns = ["Info"] - workload.dfs.update(tmp) + +def load_table_data(workload, dir, is_gui, debug): + """ + Load data for all "raw_csv_table". + Calculate mertric value for all "metric_table". + """ + load_kernel_top(workload, dir) + eval_metric( workload.dfs, workload.dfs_type,