Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/gpu-head-to-head/blob/main/results/wolfram/analysis.wl # gpu-head-to-head aien-dev/gpu-head-to-head Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `gpu-head-to-head / results / wolfram / analysis.wl` 26 lines ยท 1695 bytes Raw Blame History 1 (* PROTOCOL.md sections 5 and 7, A3(b). Evaluated in the Wolfram MCP kernel, one call per arm, with 2 that arm's h2hRows (bench/extract.py) prepended. Row: {arm, round, metric, rep, batch, stream, 3 load1, tSend, tFirst, tLast, promptTokens, completionTokens, busyRetries, ok}. Output: RawJSON. *) 4 h2hStats[v_List] := If[Length[v] == 0, <|"n" -> 0|>, 5 <|"n" -> Length[v], "median" -> N[Median[v]], "q1" -> N[Quantile[v, 1/4]], "q3" -> N[Quantile[v, 3/4]], 6 "iqr" -> N[InterquartileRange[v]], "p50" -> N[Quantile[v, 1/2]], "p99" -> N[Quantile[v, 99/100]]|>]; 7 h2hAnalyse[rows_] := Module[{ok, bad, byMetric, perStream, perBatch, out = <||>}, 8 ok = Select[rows, #[[14]] === True &]; 9 bad = Counts[Select[rows, #[[14]] =!= True &][[All, 3]]]; 10 byMetric = GroupBy[ok, #[[3]] &]; 11 KeyValueMap[Function[{m, rs}, 12 Module[{batches = Values[GroupBy[rs, {#[[2]], #[[5]]} &]], ttft, dec, pre, tpot, agg}, 13 ttft = (#[[9]] - #[[8]]) & /@ rs; 14 dec = Select[rs, #[[12]] > 1 &]; 15 tpot = ((#[[10]] - #[[9]])/(#[[12]] - 1)) & /@ dec; 16 agg = (Total[#[[All, 12]]]/(Max[#[[All, 10]]] - Min[#[[All, 8]]])) & /@ batches; 17 pre = (#[[11]]/(#[[9]] - #[[8]])) & /@ rs; 18 out[m] = <|"rows_ok" -> Length[rs], "rows_failed" -> Lookup[bad, m, 0], 19 "busy_retries_total" -> Total[rs[[All, 13]]], 20 "ttft_s" -> h2hStats[ttft], 21 "stream_decode_tok_s" -> h2hStats[1/tpot], 22 "tpot_s" -> h2hStats[tpot], 23 "batch_aggregate_tok_s" -> h2hStats[agg], 24 "prefill_tok_s" -> h2hStats[pre]|>]], byMetric]; 25 KeyValueMap[(If[! KeyExistsQ[out, #1], out[#1] = <|"rows_ok" -> 0, "rows_failed" -> #2|>]) &, bad]; 26 ExportString[out, "RawJSON", "Compact" -> True]];