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/coldstart/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 / coldstart / analysis.wl` 35 lines ยท 2493 bytes Raw Blame History 1 (* coldstart/PROTOCOL.md section 7. Evaluated in the Wolfram MCP kernel with results/coldstart//rows.wl 2 (coldstart/run.py) prepended. csRows row: {arm, round, ok, load1, build, ready, firstResult, proc, exec}, ns. 3 csWarm row: {arm, round, ok, {10 warm build times, ns}}. Statistics are h2hStats of results/wolfram/analysis.wl, 4 in microseconds. A comparison is a WIN or LOSS only when the two IQRs [q1, q3] do not overlap; otherwise 5 OVERLAPPING. No significance tests. Output: RawJSON. *) 6 h2hStats[v_List] := If[Length[v] == 0, <|"n" -> 0|>, 7 <|"n" -> Length[v], "median" -> N[Median[v]], "q1" -> N[Quantile[v, 1/4]], "q3" -> N[Quantile[v, 3/4]], 8 "iqr" -> N[InterquartileRange[v]], "p50" -> N[Quantile[v, 1/2]], "p99" -> N[Quantile[v, 99/100]]|>]; 9 csArms = {"CUDAPP", "PTXC", "NVRTC"}; 10 csMetrics = {"build" -> 5, "ready" -> 6, "firstResult" -> 7, "proc" -> 8, "exec" -> 9}; 11 (* valid rows: process ok and load1 < 6 at spawn (section 6) *) 12 csValid[rows_] := Select[rows, #[[3]] === True && #[[4]] < 6 &]; 13 csCall[a_Association, b_Association] := Which[ 14 a["q3"] < b["q1"], "CUDAPP_LOWER", b["q3"] < a["q1"], "CUDAPP_HIGHER", True, "OVERLAPPING"]; 15 csAnalyse[rows_, warm_] := Module[{valid, per, warmPer, out = <||>, cmp = <||>}, 16 valid = csValid[rows]; 17 per = AssociationMap[Function[arm, Module[{rs = Select[valid, #[[1]] == arm &]}, 18 Join[<|"rows_measured" -> Count[rows, r_ /; r[[1]] == arm], 19 "rows_valid" -> Length[rs], 20 "rows_failed" -> Count[rows, r_ /; r[[1]] == arm && r[[3]] =!= True], 21 "rows_load_excluded" -> Count[rows, r_ /; r[[1]] == arm && r[[3]] === True && r[[4]] >= 6], 22 "arm_valid" -> Length[rs] >= 28|>, 23 Association[(First[#] -> h2hStats[N[rs[[All, Last[#]]]/1000]]) & /@ csMetrics]]]], csArms]; 24 warmPer = AssociationMap[Function[arm, 25 h2hStats[N[Median[#[[4]]]/1000] & /@ Select[warm, #[[1]] == arm && #[[3]] === True && Length[#[[4]]] > 0 &]]], csArms]; 26 Do[cmp[other] = Association[Function[m, m -> <| 27 "call" -> If[per["CUDAPP"]["arm_valid"] && per[other]["arm_valid"], 28 csCall[per["CUDAPP"][m], per[other][m]], "NO_VERDICT"], 29 "median_ratio_other_over_cudapp" -> N[per[other][m]["median"]/per["CUDAPP"][m]["median"]]|>] /@ Keys[csMetrics]], 30 {other, {"PTXC", "NVRTC"}}]; 31 out["unit"] = "microseconds"; 32 out["arms"] = per; 33 out["warm_build_per_process_median"] = warmPer; 34 out["cudapp_vs"] = cmp; 35 ExportString[out, "RawJSON", "Compact" -> True]];