hardware-counters
xplat_diag.py
"""Diagnose two anomalies in the cross-platform results."""
import sys, numpy as np, pandas as pd
sys.path.insert(0, "/work/project/project/user/analysis")
from crossplatform import load, features, F_PEAK
D = "/work/project/project/user"
a2 = load(f"{D}/data/runs_expanded.csv", "archer2")
cir = load(f"{D}/data/cirrus_persets.csv", "cirrus")
print("=== A1: why is branch_miss_rate 0% on ARCHER2? ===")
for name, df in [("archer2", a2), ("cirrus", cir)]:
have = [c for c in ("PAPI_BR_INS", "PAPI_BR_MSP") if c in df.columns]
print(f" {name}: columns present = {have}")
for c in have:
print(f" {c} non-null {df[c].notna().mean()*100:.0f}%")
print(" -> if BR_INS/BR_MSP are absent on ARCHER2 the feature cannot be in the")
print(" intersection; it must be moved to the platform-specific group.")
print("\n=== A2: why is Cirrus harder to predict than ARCHER2? ===")
both = pd.concat([a2, cir], ignore_index=True)
fpk = both.platform.map(F_PEAK).values
t_an = pd.to_numeric(both.PAPI_TOT_CYC, errors="coerce").values / fpk
eta = t_an / both.runtime_s.values
both = both.assign(eta=eta, t_an=t_an)
ok = both[(both.eta > 0) & (both.eta <= 1.5)]
print(ok.groupby("platform").eta.describe()[["count","mean","std","min","50%","max"]].round(3).to_string())
print("\n spread of log10(eta) (higher = harder target):")
print(ok.groupby("platform").apply(lambda g: np.log10(g.eta).std()).round(4).to_string())
print("\n runtime distribution:")
print(ok.groupby("platform").runtime_s.describe()[["min","25%","50%","75%","max"]].round(2).to_string())
print("\n fraction of runs under 1 second (short runs are overhead-dominated):")
print((ok.assign(short=ok.runtime_s < 1.0).groupby("platform").short.mean()*100).round(1).to_string())
print("\n=== A3: implied clock per platform ===")
ok2 = ok.assign(ghz=pd.to_numeric(ok.PAPI_TOT_CYC)/ok.runtime_s/1e9)
print(ok2.groupby(["platform","app"]).ghz.median().round(2).to_string())