| 139 | ) |
| 140 | |
| 141 | def intersect(self, other: "ProfilerConfig") -> "ProfilerConfig": |
| 142 | assert self.tool == other.tool, ( |
| 143 | f"Cannot intersect ProfilerConfig with different tools: {self.tool} vs {other.tool}" |
| 144 | ) |
| 145 | return ProfilerConfig( |
| 146 | tool=self.tool, |
| 147 | enable=self.enable and other.enable, |
| 148 | all_ranks=self.all_ranks and other.all_ranks, |
| 149 | ranks=list(set(self.ranks or []) & set(other.ranks or [])), |
| 150 | save_path=self.save_path, |
| 151 | tool_config=self.tool_config, |
| 152 | global_tool_config=self.global_tool_config if self.global_tool_config else other.global_tool_config, |
| 153 | ) |
| 154 | |
| 155 | def __post_init__(self) -> None: |
| 156 | """config validation logics go here""" |