updated create csv and updated plots
This commit is contained in:
committed by
[Quy Anh] «Elliot» Nguyen
parent
daf75faaf3
commit
ac9ef23559
+16
-8
@@ -27,6 +27,14 @@ def num(pattern, text):
|
||||
#min cycles is the standard way to kill the OS/turbo noise.
|
||||
best = {}
|
||||
|
||||
# flop counter is uint32 and wraps at n=10000 (72*n^2+74*n = 7.2e9 > 2^32), so the logged
|
||||
# W(n)/I(n) are garbage there. compute work ourselves; matches the good logs exactly.
|
||||
# symmetry variants do half the pairs -> 36 n^2 + 110 n, everything else 72 n^2 + 74 n.
|
||||
def flops_per_iter(variant, n):
|
||||
if "symmetry" in variant:
|
||||
return 36 * n * n + 110 * n
|
||||
return 72 * n * n + 74 * n
|
||||
|
||||
for variant in sorted(os.listdir(ROOT)):
|
||||
logdir = os.path.join(ROOT, variant, "x86")
|
||||
if not os.path.isdir(logdir):
|
||||
@@ -48,20 +56,20 @@ for variant in sorted(os.listdir(ROOT)):
|
||||
cycles = num(r"T\(n\):\s*([\d.]+)", block)
|
||||
if cycles is None:
|
||||
continue
|
||||
W = num(r"W\(n\):\s*([\d.]+)", block)
|
||||
|
||||
key = (variant, n)
|
||||
if key not in best or cycles < best[key][2]:
|
||||
best[key] = (variant, n, cycles, n_iter, W,
|
||||
num(r"Q\(n\) per iteration:\s*([\d.]+)", block),
|
||||
num(r"I\(n\):\s*([\d.]+)", block))
|
||||
if key not in best or cycles < best[key][0]:
|
||||
best[key] = (cycles, n_iter,
|
||||
num(r"Q\(n\) per iteration:\s*([\d.]+)", block))
|
||||
|
||||
with open(OUT, "w", newline="") as f:
|
||||
w = csv.writer(f)
|
||||
w.writerow(["variant", "n", "n_iter", "W", "Q_per_iter", "I", "cycles", "flops_per_cycle"])
|
||||
for variant, n in sorted(best):
|
||||
_, _, cycles, n_iter, W, q, I = best[(variant, n)]
|
||||
cycles, n_iter, q = best[(variant, n)]
|
||||
w_iter = flops_per_iter(variant, n)
|
||||
W = w_iter * n_iter
|
||||
I = w_iter / q
|
||||
fc = W / cycles
|
||||
w.writerow([variant, n, n_iter, W, q, I, round(cycles, 1), round(fc, 3)])
|
||||
|
||||
w.writerow([variant, n, n_iter, W, q, round(I, 2), round(cycles, 1), round(fc, 3)])
|
||||
print("wrote", OUT, "with", len(best), "rows")
|
||||
Reference in New Issue
Block a user