Combine kernel and dispatch stats in the Top Stats section of analysis
Signed-off-by: colramos-amd <colramos@amd.com>
[ROCm/rocprofiler-compute commit: 2526e14802]
Этот коммит содержится в:
@@ -43,8 +43,13 @@ import logging
|
||||
top_stats_build_in_config = {
|
||||
0: {
|
||||
"id": 0,
|
||||
"title": "Top Stat",
|
||||
"title": "Top Kernels",
|
||||
"data source": [{"raw_csv_table": {"id": 1, "source": "pmc_kernel_top.csv"}}],
|
||||
},
|
||||
1: {
|
||||
"id": 1,
|
||||
"title": "Dispatch List",
|
||||
"data source": [{"raw_csv_table": {"id": 2, "source": "pmc_dispatch_info.csv"}}],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +87,7 @@ def create_df_kernel_top_stats(
|
||||
filter_gpu_ids,
|
||||
filter_dispatch_ids,
|
||||
time_unit,
|
||||
max_kernel_num,
|
||||
max_stat_num,
|
||||
sortby="sum",
|
||||
):
|
||||
"""
|
||||
@@ -142,14 +147,9 @@ def create_df_kernel_top_stats(
|
||||
# Sort by total time as default.
|
||||
if sortby == "sum":
|
||||
grouped = grouped.sort_values(by=("Sum" + time_unit_str), ascending=False)
|
||||
|
||||
grouped = grouped.head(max_kernel_num) # Display only the top n results
|
||||
|
||||
grouped.to_csv(os.path.join(raw_data_dir, "pmc_kernel_top.csv"), index=False)
|
||||
elif sortby == "kernel":
|
||||
grouped = grouped.sort_values("Kernel_Name")
|
||||
|
||||
grouped = grouped.head(max_kernel_num) # Display only the top n results
|
||||
grouped.to_csv(os.path.join(raw_data_dir, "pmc_kernel_top.csv"), index=False)
|
||||
|
||||
|
||||
|
||||
@@ -200,6 +200,12 @@ def show_all(args, runs, archConfigs, output):
|
||||
index=False,
|
||||
)
|
||||
|
||||
# Only show top N kernels (as specified in --max-kernel-num) in "Top Stats" section
|
||||
if(
|
||||
type == "raw_csv_table"
|
||||
and (table_config["source"] == "pmc_kernel_top.csv" or table_config["source"] == "pmc_dispatch_info.csv")
|
||||
):
|
||||
df = df.head(args.max_stat_num)
|
||||
# NB:
|
||||
# "columnwise: True" is a special attr of a table/df
|
||||
# For raw_csv_table, such as system_info, we transpose the
|
||||
@@ -226,30 +232,40 @@ def show_all(args, runs, archConfigs, output):
|
||||
print(ss, file=output)
|
||||
|
||||
|
||||
def show_kernels(args, runs, archConfigs, output):
|
||||
def show_kernel_stats(args, runs, archConfigs, output):
|
||||
"""
|
||||
Show the kernels from top stats.
|
||||
Show the kernels and dispatches from "Top Stats" section.
|
||||
"""
|
||||
print("\n" + "-" * 80, file=output)
|
||||
print("Detected Kernels", file=output)
|
||||
# print("\n" + "-" * 80, file=output)
|
||||
# print("Detected Kernels (sorted decending by duration)", file=output)
|
||||
|
||||
df = pd.DataFrame()
|
||||
for panel_id, panel in archConfigs.panel_configs.items():
|
||||
for data_source in panel["data source"]:
|
||||
for type, table_config in data_source.items():
|
||||
for run, data in runs.items():
|
||||
df = pd.DataFrame()
|
||||
single_df = data.dfs[table_config["id"]]
|
||||
# NB:
|
||||
# For pmc_kernel_top.csv, have to sort here if not
|
||||
# sorted when load_table_data.
|
||||
df = pd.concat([df, single_df["Kernel_Name"]], axis=1)
|
||||
if table_config["id"] == 1:
|
||||
print("\n" + "-" * 80, file=output)
|
||||
print("Detected Kernels (sorted decending by duration)", file=output)
|
||||
df = pd.concat([df, single_df["Kernel_Name"]], axis=1)
|
||||
|
||||
if table_config["id"] == 2:
|
||||
print("\n" + "-" * 80, file=output)
|
||||
print("Dispatch list", file=output)
|
||||
df = single_df
|
||||
|
||||
print(
|
||||
tabulate(
|
||||
df,
|
||||
headers="keys",
|
||||
tablefmt="fancy_grid",
|
||||
floatfmt="." + str(args.decimal) + "f",
|
||||
),
|
||||
file=output,
|
||||
)
|
||||
|
||||
print(
|
||||
tabulate(
|
||||
df,
|
||||
headers="keys",
|
||||
tablefmt="fancy_grid",
|
||||
floatfmt="." + str(args.decimal) + "f",
|
||||
),
|
||||
file=output,
|
||||
)
|
||||
|
||||
Ссылка в новой задаче
Block a user