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/CUDApp/blob/main/evidence/FLASH-NEXT-CONTROL-FIX-20261118/exercise.py # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / evidence / FLASH-NEXT-CONTROL-FIX-20261118 / exercise.py` 72 lines · 3676 bytes Raw Blame History 1 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 # exercise.py: re-run every matrix whose historical midpoint flip was reported as missed 3 # (flip_detected 0 in the fullcover JSONL), plus one clean control per miss, through the historical 4 # binary (reproduces the old verdict) and rowrans_strict (says why). Measuring instrument only. 5 # Reads each tensor by byte range from the local checkpoint into one temporary file in /dev/shm (removed 6 # after use); no checkpoint copy is kept. Writes one JSON object per run to OUT_JSONL. 7 # usage: python3 -I exercise.py FULLCOVER_OUT MODEL_DIR HIST_BIN STRICT_BIN OUT_JSONL 8 import glob, hashlib, json, mmap, os, struct, subprocess, sys 9 10 FC, MODEL, HIST, STRICT, OUT = sys.argv[1:6] 11 12 13 def kv(line): 14 return dict(t.split('=', 1) for t in line.split()[1:]) 15 16 17 def run(cmd): 18 return subprocess.check_output(cmd, text=True) 19 20 21 def main(): 22 shards = sorted(glob.glob(os.path.join(FC, '*.jsonl'))) 23 work = [] # (shard, name, role, historical record) 24 for p in shards: 25 recs = [json.loads(l) for l in open(p)] 26 assert recs[-1].get('done') == 1, p 27 recs = recs[:-1] 28 for i, r in enumerate(recs): 29 if r['flip_detected'] == 0: 30 work.append((os.path.basename(p)[:-6], r['name'], 'missed', r)) 31 # control: the next matrix in the same shard whose historical flip was detected 32 for j in list(range(i + 1, len(recs))) + list(range(0, i)): 33 if recs[j]['flip_detected'] == 1: 34 work.append((os.path.basename(p)[:-6], recs[j]['name'], 'control', recs[j])) 35 break 36 tmp = f'/dev/shm/control-fix-{os.getpid()}.raw' 37 with open(OUT, 'w') as g: 38 by_shard = {} 39 for sh, name, role, rec in work: 40 by_shard.setdefault(sh, []).append((name, role, rec)) 41 for sh in sorted(by_shard): 42 with open(os.path.join(MODEL, sh), 'rb') as f: 43 n = struct.unpack('