Commit 9ec32af3 authored by Brewer, Wes's avatar Brewer, Wes
Browse files

fix(plot): derive date from data, make heatmap optional



- Title date range is now computed from the snapshot timestamps
  instead of being hardcoded, so any analysis window is labelled correctly
- Snapshot count and job count in the stats box are also derived from data
- Heatmap inset is now off by default; pass --heatmap to enable it

Co-Authored-By: default avatarClaude Sonnet 4.6 <noreply@anthropic.com>
parent 2032d408
Loading
Loading
Loading
Loading
+35 −22
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ def main():
    p.add_argument("--a2a",     default="results/lassen_a2a",     help="All-to-all output prefix")
    p.add_argument("--stencil", default="results/lassen_stencil", help="Stencil-3d output prefix")
    p.add_argument("--output",  default="results/congestion_timeline.png")
    p.add_argument("--heatmap", action="store_true", help="Show hour×day heatmap inset on top panel")
    args = p.parse_args()

    a2a_s, a2a_j     = load(args.a2a)
@@ -132,22 +133,34 @@ def main():
    ax_jobs.tick_params(axis="x", labelsize=9)

    # ── title + summary stats box ───────────────────────────────────────
    t_min = a2a_s["timestamp"].min()
    t_max = a2a_s["timestamp"].max()
    if t_min.year == t_max.year:
        date_range = f"{t_min.strftime('%b %d')}{t_max.strftime('%b %d, %Y')}"
    else:
        date_range = f"{t_min.strftime('%b %d, %Y')}{t_max.strftime('%b %d, %Y')}"

    fig.suptitle(
        "Lassen – Simulated Inter-Job Network Congestion  (Aug 22–28, 2019)",
        f"Lassen – Simulated Inter-Job Network Congestion  ({date_range})",
        fontsize=13, fontweight="bold", y=0.97,
    )

    n_snaps = len(a2a_s)
    a2a_jobs  = pd.read_csv(f"{args.a2a}_jobs.csv")
    n_jobs = len(a2a_jobs)
    ratio = (stencil_s["max_link_util"] / a2a_s["max_link_util"].replace(0, float("nan"))).mean()
    stats_text = (
        f"168 hourly snapshots  |  5 181 jobs ≥ 2 nodes  |  Fat-tree k=32, IB EDR 100 Gbps\n"
        f"{n_snaps} hourly snapshots  |  {n_jobs:,} jobs ≥ 2 nodes  |  Fat-tree k=32, IB EDR 100 Gbps\n"
        f"All-to-all:   peak {a2a_s['max_link_util'].max():.1f}×,  mean {a2a_s['max_link_util'].mean():.1f}×    "
        f"Stencil-3D:  peak {stencil_s['max_link_util'].max():.1f}×,  mean {stencil_s['max_link_util'].mean():.1f}×    "
        f"Ratio: {(stencil_s['max_link_util']/a2a_s['max_link_util']).mean():.2f}× avg"
        f"Ratio: {ratio:.2f}× avg"
    )
    fig.text(0.5, 0.935, stats_text, ha="center", va="top",
             fontsize=8.2, color="#444444",
             bbox=dict(boxstyle="round,pad=0.4", fc="white", ec="#cccccc", alpha=0.9))

    # ── inset: daily heatmap ────────────────────────────────────────────
    # ── inset: daily heatmap (optional) ─────────────────────────────────
    if args.heatmap:
        ax_inset = ax_max.inset_axes([0.72, 0.08, 0.27, 0.50])
        ax_inset.set_facecolor("#E8E8E8")