Commit 0ca55744 authored by one's avatar one
Browse files

[xcl-lens] Move instance members to class members

parent 3e48fc9b
import re
from typing import Final
import pandas as pd
class RcclLogParser:
def __init__(self, verbose=False, hosts=None, ranks=None):
# Deduplicated set of (host, rank, content) tuples
self.log_entries: set[tuple[str, int, str]] = set()
# Verbosity flag used by report sections
self._verbose = verbose
# Filters
self._hosts = hosts if hosts is not None else []
self._ranks = [int(r) for r in ranks] if ranks is not None else []
# Pattern -> output string or as-is
self.sys_patterns = {
sys_patterns: Final = {
r"kernel version": None,
r"ROCr version": None,
r"RCCL version": None,
......@@ -29,7 +19,7 @@ class RcclLogParser:
}
# Pattern -> column with strict validation
self.graph_info_fields = {
graph_info_fields: Final = {
r"Pattern": ("Pattern", r"\d+"),
r"crossNic": ("crossNic", r"\d+"),
r"nChannels": ("nChannels", r"\d+"),
......@@ -39,7 +29,7 @@ class RcclLogParser:
}
# Pattern -> column with strict validation
self.cl_transfer_fields = {
cl_transfer_fields: Final = {
r"protocol": ("protocol", r"Simple|LL|LL128"),
r"nbytes": ("nbytes", r"\d+"),
r"algorithm": ("algorithm", r"Tree|Ring"),
......@@ -51,7 +41,7 @@ class RcclLogParser:
}
# Pattern -> column with strict validation
self.p2p_fields = {
p2p_fields: Final = {
r"p2p : rank": ("local", r"\d+"),
r"send rank": ("send", r"\d+"),
r"recv rank": ("recv", r"\d+"),
......@@ -61,6 +51,17 @@ class RcclLogParser:
r"protocol": ("protocol", r"Simple|LL|LL128"),
}
def __init__(self, verbose=False, hosts=None, ranks=None):
# Deduplicated set of (host, rank, content) tuples
self.log_entries: set[tuple[str, int, str]] = set()
# Verbosity flag used by report sections
self._verbose = verbose
# Filters
self._hosts = hosts if hosts is not None else []
self._ranks = [int(r) for r in ranks] if ranks is not None else []
def collect(self, line):
self._preprocess_line(line)
......
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