Fix python formatting

Signed-off-by: colramos-amd <colramos@amd.com>
This commit is contained in:
colramos-amd
2024-03-04 12:57:25 -06:00
committed by Karl W. Schulz
parent 99bf4fae09
commit f2aac37178
22 changed files with 330 additions and 356 deletions
+21 -19
View File
@@ -419,7 +419,7 @@ def calc_builtin_var(var, sys_info):
elif isinstance(var, str) and var.startswith("$total_l2_chan"):
return sys_info.total_l2_chan
else:
console_error("Built-in var \" %s \" is not supported" % var)
console_error('Built-in var " %s " is not supported' % var)
def build_dfs(archConfigs, filter_metrics, sys_info):
@@ -783,18 +783,23 @@ def eval_metric(dfs, dfs_type, sys_info, raw_pmc_df, debug):
)
print("~" * 40)
except TypeError:
console_warning("Skipping entry. Encountered a missing counter\n{} has been assigned to None\n{}".format(expr, np.nan))
console_warning(
"Skipping entry. Encountered a missing counter\n{} has been assigned to None\n{}".format(
expr, np.nan
)
)
except AttributeError as ae:
if (
str(ae)
== "'NoneType' object has no attribute 'get'"
):
console_warning("Skipping entry. Encountered a missing csv\n{}".format(np.nan))
else:
console_error(
"analysis",
str(ae)
console_warning(
"Skipping entry. Encountered a missing csv\n{}".format(
np.nan
)
)
else:
console_error("analysis", str(ae))
# print("eval_metric", id, expr)
try:
@@ -814,10 +819,7 @@ def eval_metric(dfs, dfs_type, sys_info, raw_pmc_df, debug):
):
row[expr] = ""
else:
console_error(
"analysis",
str(ae)
)
console_error("analysis", str(ae))
else:
# If not insert nan, the whole col might be treated
@@ -843,8 +845,7 @@ def apply_filters(workload, dir, is_gui, debug):
]
if ret_df.empty:
console_error(
"analysis",
"{} is an invalid gpu-id".format(workload.filter_gpu_ids)
"analysis", "{} is an invalid gpu-id".format(workload.filter_gpu_ids)
)
# NB:
@@ -883,17 +884,17 @@ def apply_filters(workload, dir, is_gui, debug):
)
ret_df = ret_df.loc[df_cleaned.isin(workload.filter_kernel_ids)]
else:
console_error("analyze", "Mixing kernel indices and string filters is not currently supported")
console_error(
"analyze",
"Mixing kernel indices and string filters is not currently supported",
)
if workload.filter_dispatch_ids:
# 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:
if int(d) >= len(ret_df): # subtract 2 bc of the two header rows
console_error(
"analysis",
"{} is an invalid dispatch id.".format(d)
)
console_error("analysis", "{} is an invalid dispatch id.".format(d))
if ">" in workload.filter_dispatch_ids[0]:
m = re.match(r"\> (\d+)", workload.filter_dispatch_ids[0])
ret_df = ret_df[
@@ -985,7 +986,8 @@ def correct_sys_info(mspec, specs_correction: dict):
for k, v in pairs.items():
if not hasattr(mspec, str(k)):
console_error(
"analyze", f"Invalid specs correction '{k}'. Please use --specs option to peak valid specs"
"analyze",
f"Invalid specs correction '{k}'. Please use --specs option to peak valid specs",
)
setattr(mspec, str(k), v)
return mspec.get_class_members()