Update logic in CLI baseline comparison
Signed-off-by: colramos425 <colramos@amd.com>
[ROCm/rocprofiler-compute commit: 03b93fb06b]
This commit is contained in:
@@ -143,7 +143,8 @@ def run_gui(args, runs):
|
|||||||
num_results,
|
num_results,
|
||||||
)
|
)
|
||||||
runs[args.path[0][0]].raw_pmc = file_io.create_df_pmc(
|
runs[args.path[0][0]].raw_pmc = file_io.create_df_pmc(
|
||||||
args.path[0][0]
|
args.path[0][0],
|
||||||
|
args.verbose
|
||||||
) # create mega df
|
) # create mega df
|
||||||
parser.load_kernel_top(runs[args.path[0][0]], args.path[0][0])
|
parser.load_kernel_top(runs[args.path[0][0]], args.path[0][0])
|
||||||
|
|
||||||
@@ -188,7 +189,7 @@ def run_cli(args, runs):
|
|||||||
args.time_unit,
|
args.time_unit,
|
||||||
num_results,
|
num_results,
|
||||||
)
|
)
|
||||||
runs[d[0]].raw_pmc = file_io.create_df_pmc(d[0]) # creates mega dataframe
|
runs[d[0]].raw_pmc = file_io.create_df_pmc(d[0], args.verbose) # creates mega dataframe
|
||||||
is_gui = False
|
is_gui = False
|
||||||
parser.load_table_data(
|
parser.load_table_data(
|
||||||
runs[d[0]], d[0], is_gui, args.g, args.verbose
|
runs[d[0]], d[0], is_gui, args.g, args.verbose
|
||||||
@@ -203,6 +204,7 @@ def run_cli(args, runs):
|
|||||||
args.decimal,
|
args.decimal,
|
||||||
args.time_unit,
|
args.time_unit,
|
||||||
args.cols,
|
args.cols,
|
||||||
|
args.verbose,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ def create_df_kernel_top_stats(
|
|||||||
grouped.to_csv(os.path.join(raw_data_dir, "pmc_kernel_top.csv"), index=False)
|
grouped.to_csv(os.path.join(raw_data_dir, "pmc_kernel_top.csv"), index=False)
|
||||||
|
|
||||||
|
|
||||||
def create_df_pmc(raw_data_dir):
|
def create_df_pmc(raw_data_dir, verbose):
|
||||||
"""
|
"""
|
||||||
Load all raw pmc counters and join into one df.
|
Load all raw pmc counters and join into one df.
|
||||||
"""
|
"""
|
||||||
@@ -200,8 +200,8 @@ def create_df_pmc(raw_data_dir):
|
|||||||
coll_levels.append(f[:-4])
|
coll_levels.append(f[:-4])
|
||||||
final_df = pd.concat(dfs, keys=coll_levels, axis=1, copy=False)
|
final_df = pd.concat(dfs, keys=coll_levels, axis=1, copy=False)
|
||||||
# TODO: join instead of concat!
|
# TODO: join instead of concat!
|
||||||
|
if verbose >= 2:
|
||||||
# print("pmc_raw_data final_df ", final_df.info())
|
print("pmc_raw_data final_df ", final_df.info())
|
||||||
return final_df
|
return final_df
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ def build_layout(
|
|||||||
base_data = initialize_run(args, norm_filt) # Re-initalize everything
|
base_data = initialize_run(args, norm_filt) # Re-initalize everything
|
||||||
panel_configs = copy.deepcopy(archConfigs.panel_configs)
|
panel_configs = copy.deepcopy(archConfigs.panel_configs)
|
||||||
# Generate original raw df
|
# Generate original raw df
|
||||||
base_data[base_run].raw_pmc = file_io.create_df_pmc(path_to_dir)
|
base_data[base_run].raw_pmc = file_io.create_df_pmc(path_to_dir, verbose)
|
||||||
if verbose >= 1:
|
if verbose >= 1:
|
||||||
print("disp-filter is ", disp_filt)
|
print("disp-filter is ", disp_filt)
|
||||||
print("kernel-filter is ", kernel_filter)
|
print("kernel-filter is ", kernel_filter)
|
||||||
|
|||||||
@@ -44,19 +44,20 @@ def string_multiple_lines(source, width, max_rows):
|
|||||||
return "\n".join(lines)
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
def show_all(runs, archConfigs, output, decimal, time_unit, selected_cols):
|
def show_all(runs, archConfigs, output, decimal, time_unit, selected_cols, verbose):
|
||||||
"""
|
"""
|
||||||
Show all panels with their data in plain text mode.
|
Show all panels with their data in plain text mode.
|
||||||
"""
|
"""
|
||||||
comparable_columns = parser.build_comparable_columns(time_unit)
|
comparable_columns = parser.build_comparable_columns(time_unit)
|
||||||
|
|
||||||
for panel_id, panel in archConfigs.panel_configs.items():
|
for panel_id, panel in archConfigs.panel_configs.items():
|
||||||
|
# Skip panels that don't support baseline comparison
|
||||||
|
if panel_id == 1900:
|
||||||
|
continue
|
||||||
ss = "" # store content of all data_source from one pannel
|
ss = "" # store content of all data_source from one pannel
|
||||||
|
|
||||||
for data_source in panel["data source"]:
|
for data_source in panel["data source"]:
|
||||||
for type, table_config in data_source.items():
|
for type, table_config in data_source.items():
|
||||||
|
|
||||||
# take the 1st run as baseline
|
# take the 1st run as baseline
|
||||||
base_run, base_data = next(iter(runs.items()))
|
base_run, base_data = next(iter(runs.items()))
|
||||||
base_df = base_data.dfs[table_config["id"]]
|
base_df = base_data.dfs[table_config["id"]]
|
||||||
@@ -102,18 +103,21 @@ def show_all(runs, archConfigs, output, decimal, time_unit, selected_cols):
|
|||||||
):
|
):
|
||||||
if run != base_run:
|
if run != base_run:
|
||||||
# calc percentage over the baseline
|
# calc percentage over the baseline
|
||||||
|
base_df[header]=[float(x) if x != '' else float(0) for x in base_df[header]]
|
||||||
|
cur_df[header]=[float(x) if x != '' else float(0) for x in cur_df[header]]
|
||||||
t_df = (
|
t_df = (
|
||||||
pd.concat(
|
pd.concat(
|
||||||
[
|
[
|
||||||
base_df[header].astype("double"),
|
base_df[header],
|
||||||
cur_df[header].astype("double"),
|
cur_df[header],
|
||||||
],
|
],
|
||||||
axis=1,
|
axis=1,
|
||||||
)
|
)
|
||||||
.pct_change(axis="columns")
|
.pct_change(axis="columns")
|
||||||
.iloc[:, 1]
|
.iloc[:, 1]
|
||||||
)
|
)
|
||||||
# print("---------", header, t_df)
|
if verbose >= 2:
|
||||||
|
print("---------", header, t_df)
|
||||||
|
|
||||||
# show value + percentage
|
# show value + percentage
|
||||||
# TODO: better alignment
|
# TODO: better alignment
|
||||||
|
|||||||
Reference in New Issue
Block a user