Commit 19dbc9c6 authored by Brewer, Wes's avatar Brewer, Wes
Browse files

Add dragonfly congestion chord diagram visualization



- scripts/plot_dragonfly_congestion.py: new standalone script that reads
  a link-loads CSV (src,dst,bytes) and outputs a chord diagram PNG showing
  per-group intra/inter-group link utilization colored by the plasma colormap.
  Supports --demo mode for synthetic data, --system for raps YAML config,
  and --label-size for group label font size (default 12).
- raps/network/__init__.py: add NetworkModel.dump_link_loads() to export
  global_link_loads to CSV for use with the visualization script.

Co-Authored-By: default avatarClaude Sonnet 4.6 <noreply@anthropic.com>
parent efcc5204
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -298,6 +298,32 @@ class NetworkModel:
                tuple(sorted(edge)): 0.0 for edge in self.net_graph.edges()
            }

    def dump_link_loads(self, path: str, *, dt: float | None = None) -> None:
        """Write current global_link_loads to a CSV file (src, dst, bytes).

        The resulting CSV can be fed directly to
        ``scripts/plot_dragonfly_congestion.py``.

        Parameters
        ----------
        path : str | Path
            Destination CSV file path.
        dt   : float, optional
            Simulation timestep (seconds).  If supplied it is written to a
            header comment so the plot script can auto-detect it.
        """
        import csv as _csv
        from pathlib import Path as _Path
        _Path(path).parent.mkdir(parents=True, exist_ok=True)
        with open(path, "w", newline="") as f:
            if dt is not None:
                f.write(f"# dt={dt}\n")
            writer = _csv.writer(f)
            writer.writerow(["src", "dst", "bytes"])
            for (u, v), b in self.global_link_loads.items():
                if b > 0:
                    writer.writerow([u, v, f"{b:.0f}"])

    def plot_topology(self, output_dir):
        """Plot network topology - save as png file in output_dir."""
        if output_dir:
+504 −0

File added.

Preview size limit exceeded, changes collapsed.