"vscode:/vscode.git/clone" did not exist on "3ae5bd787fb107d98f4071b489ff83861a393e59"
Commit 9f243032 authored by one's avatar one
Browse files

[xcl-lens] Remove raw_lines set, enhance line processing, and improve...

[xcl-lens] Remove raw_lines set, enhance line processing, and improve environment variable reporting
parent fabbe778
...@@ -7,7 +7,6 @@ class RcclLogParser: ...@@ -7,7 +7,6 @@ class RcclLogParser:
def __init__(self): def __init__(self):
# (rank, content) -> None # (rank, content) -> None
self.log_entries = dict() self.log_entries = dict()
self.raw_lines = set()
# Pattern -> output string or as-is # Pattern -> output string or as-is
self.sys_patterns = { self.sys_patterns = {
...@@ -54,15 +53,12 @@ class RcclLogParser: ...@@ -54,15 +53,12 @@ class RcclLogParser:
} }
def collect(self, line): def collect(self, line):
self.raw_lines.add(line) self._preprocess_line(line)
def report(self): def report(self):
print(" RCCL Log Parser Report ".center(80, "=")) print(" RCCL Log Parser Report ".center(80, "="))
print() print()
for line in self.raw_lines:
self._preprocess_line(line)
self._report_sys() self._report_sys()
self._report_user_envs() self._report_user_envs()
self._report_graph_info() self._report_graph_info()
...@@ -88,7 +84,7 @@ class RcclLogParser: ...@@ -88,7 +84,7 @@ class RcclLogParser:
for (_, content), _ in self.log_entries.items(): for (_, content), _ in self.log_entries.items():
for pattern, out in self.sys_patterns.items(): for pattern, out in self.sys_patterns.items():
if re.search(pattern, content, re.IGNORECASE): if re.search(pattern, content, re.IGNORECASE):
reported.add(out if out else content) reported.add(out if out is not None else content)
break break
for line in sorted(reported): for line in sorted(reported):
print(line) print(line)
...@@ -102,9 +98,15 @@ class RcclLogParser: ...@@ -102,9 +98,15 @@ class RcclLogParser:
for (_, content), _ in self.log_entries.items(): for (_, content), _ in self.log_entries.items():
m = pattern.search(content) m = pattern.search(content)
if m: if m:
env_vars[m.group(1)] = m.group(2) var_name, var_value = m.group(1), m.group(2)
for key, value in sorted(env_vars.items()): env_vars.setdefault(var_name, set()).add(var_value)
print(f"{key}: {value}") for key, values in sorted(env_vars.items()):
if len(values) == 1:
print(f"{key}: {next(iter(values))}")
else:
print(
f"{key}: {', '.join(sorted(values))} (WARNING: Different values across ranks)"
)
print() print()
def _extract_and_print(self, title, filter_func, fields, mandatory, sort_cols, move_rank=True): def _extract_and_print(self, title, filter_func, fields, mandatory, sort_cols, move_rank=True):
...@@ -160,6 +162,13 @@ class RcclLogParser: ...@@ -160,6 +162,13 @@ class RcclLogParser:
"p2pnChannelsPerPeer", "p2pnChannelsPerPeer",
"p2pnChannels", "p2pnChannels",
"nChannelsMax", "nChannelsMax",
"crossNic",
"nChannels",
"sameChannels",
"slicesteps",
"nloops",
"nsteps",
"chunksize",
] ]
for col in numeric_columns: for col in numeric_columns:
if col in df.columns: if col in df.columns:
...@@ -188,11 +197,16 @@ class RcclLogParser: ...@@ -188,11 +197,16 @@ class RcclLogParser:
cols.insert(0, "rank") cols.insert(0, "rank")
df = df[cols] df = df[cols]
# SSort the data # Sort the data
sort_cols = [c for c in sort_cols if c in df.columns] sort_cols = [c for c in sort_cols if c in df.columns]
if sort_cols: if sort_cols:
df.sort_values(by=sort_cols, inplace=True) df.sort_values(by=sort_cols, inplace=True)
# Format integer columns to avoid trailing .0
for col in numeric_columns:
if col in df.columns:
df[col] = df[col].apply(lambda x: str(int(x)) if pd.notna(x) else x)
# Print the final table with NaN values replaced by "-" # Print the final table with NaN values replaced by "-"
print(df.fillna("-").to_string(index=False)) print(df.fillna("-").to_string(index=False))
print() print()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment