CUDApp
CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.
Brought by drakestapleton
CUDApp / evidence / GEMM-TUNE-20261027 / extract.sh
| 1 | #!/bin/bash |
| 2 | # Bookkeeping only: collect kept samples per cell as a Wolfram list (no arithmetic here; medians/ratios are in Wolfram). |
| 3 | # Usage: extract.sh <run.log>... -> stdout: {{type,"MxNxK",lay,armA_main,armB_main,armA_mainpack,armB_mainpack},...} ; stderr: discard counts |
| 4 | # A sample is kept when rc=OK, wrong=0, if_before=0 and if_after=0 (AB-PLAN discard rule); others are counted as discarded. |
| 5 | awk ' |
| 6 | /^sample / { |
| 7 | delete f; for (i = 2; i <= NF; i++) { split($i, kv, "="); f[kv[1]] = kv[2] } |
| 8 | cell = f["type"] "|" f["M"] "x" f["N"] "x" f["K"] "|" f["lay"] |
| 9 | if (!(cell in seen)) { seen[cell] = 1; order[++n] = cell } |
| 10 | if (f["rc"] != "OK" || f["wrong"] != "0") { bad[cell]++; badtot++; next } |
| 11 | if (f["if_before"] != "0" || f["if_after"] != "0") { disc[cell]++; disctot++; next } |
| 12 | a = f["arm"]; mp = f["main_ns"] "+" f["pack_ns"] |
| 13 | m[cell, a] = m[cell, a] (m[cell, a] == "" ? "" : ",") f["main_ns"] |
| 14 | p[cell, a] = p[cell, a] (p[cell, a] == "" ? "" : ",") mp |
| 15 | kept[cell, a]++ |
| 16 | } |
| 17 | END { |
| 18 | printf "{" |
| 19 | for (i = 1; i <= n; i++) { |
| 20 | c = order[i]; split(c, q, "|") |
| 21 | printf "%s{\"%s\",\"%s\",%s,{%s},{%s},{%s},{%s}}", (i > 1 ? "," : ""), q[1], q[2], q[3], m[c, "A"], m[c, "B"], p[c, "A"], p[c, "B"] |
| 22 | printf "%s %s keptA=%d keptB=%d discarded=%d failed=%d\n", q[1], q[2], kept[c, "A"], kept[c, "B"], disc[c] + 0, bad[c] + 0 > "/dev/stderr" |
| 23 | } |
| 24 | printf "}\n" |
| 25 | printf "TOTAL discarded=%d failed=%d cells=%d\n", disctot + 0, badtot + 0, n > "/dev/stderr" |
| 26 | }' "$@" |