Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
34 lines
1.7 KiB
Python
34 lines
1.7 KiB
Python
import re,json,glob,sys
|
|
root="/data/leleka-e2e/codex-compare/runs/main"
|
|
def lel(cell):
|
|
r=[]
|
|
for l in open(cell+"/engine-slice.log",errors="replace"):
|
|
if l.startswith("{") and '"ev":"request"' in l and '"comp":"engine"' in l:
|
|
j=json.loads(l)
|
|
r.append((j["otok"],j["dec_ms"],j["tier_vram_pct"],j["ptok"]-j["ctok"]))
|
|
return r
|
|
def van(cell):
|
|
hits=[];gen=[]
|
|
for l in open(cell+"/engine-slice.log",errors="replace"):
|
|
m=re.search(r"decode expert cache hit rate: [\d.]+% \((\d+) hits / (\d+) lookups\); (\d+) more.*?of all (\d+) routed",l)
|
|
if m: hits.append(100*int(m.group(1))/int(m.group(4)))
|
|
m=re.search(r"(\d+) generated in ([\d.]+) ms",l)
|
|
if m: gen.append((int(m.group(1)),float(m.group(2))))
|
|
return list(zip(gen,hits))
|
|
buckets=[(0,600),(600,2000),(2000,10**9)]
|
|
for task in ("nestng-crm","ttt"):
|
|
for arm in ("LEL","VANL"):
|
|
tot=0;acc={b:[0,0,0] for b in buckets} # time, time*hit, count
|
|
for cell in sorted([c for c in glob.glob(f"{root}/{arm}/{task}-r*") if not c.endswith(".out")]):
|
|
if arm=="LEL": rows=[(o,d,h) for o,d,h,_ in lel(cell)]
|
|
else: rows=[(g[0],g[1],h) for g,h in van(cell)]
|
|
for o,d,h in rows:
|
|
for b in buckets:
|
|
if b[0]<=o<b[1]:
|
|
acc[b][0]+=d;acc[b][1]+=d*h;acc[b][2]+=1
|
|
T=sum(a[0] for a in acc.values())
|
|
print(task,arm,"decode time %.0f s"%(T/1e3))
|
|
for b,a in acc.items():
|
|
if a[0]: print(" otok %5d-%-9d requests %3d time share %5.1f%% time-weighted vram-hit %.2f"%(b[0],b[1],a[2],100*a[0]/T,a[1]/a[0]))
|
|
print(" total time-weighted hit %.2f"%(sum(a[1] for a in acc.values())/T))
|