aboutsummaryrefslogtreecommitdiffstats
path: root/research/experiments/029-across-machines/compare.py
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-02 06:21:48 +0100
committereunhhu <[email protected]>2026-10-02 06:21:48 +0100
commit2be6928a4367ff35209484becad6627e34ac9768 (patch)
treee3af41b1611cdc064607553f33f3b82106164ffc /research/experiments/029-across-machines/compare.py
parent28e51430cc860adc8d8f384d7662d85ab09dc5c7 (diff)
downloadpure-2be6928a4367ff35209484becad6627e34ac9768.tar.gz
pure-2be6928a4367ff35209484becad6627e34ac9768.zip
Run Pure and aup on an x86_64 WSL2 and an M3 Mac against the Pi (029)
Every pure-run of aup's check (1,053 runs of 667 modules) gives the same output, errors and exit on the Pi, the WSL2 (x86_64, 4 KiB pages, gcc 13) and the Mac (Apple clang 21); the same events make byte-identical stores on the Pi and the Mac, and either opens the other's and goes on the same. Pure's checks pass one at a time in WSL (each_check.py); its wall clock is set back about 2 s every 32 s (clock.py). stores.py streams pure-run's output, whose size grows with the square of the events.
Diffstat (limited to 'research/experiments/029-across-machines/compare.py')
-rwxr-xr-xresearch/experiments/029-across-machines/compare.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/research/experiments/029-across-machines/compare.py b/research/experiments/029-across-machines/compare.py
new file mode 100755
index 0000000..8b96612
--- /dev/null
+++ b/research/experiments/029-across-machines/compare.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python3
+"""Two machines' records of pure-run (recorded-pure-run's logs): the
+modules each compiled, and for every run both made (the same module, the
+same arguments and input), whether output, errors and exit are the same.
+
+compare.py A.jsonl B.jsonl a JSON summary, and each run that differs"""
+import json
+import sys
+from collections import Counter
+
+
+def load(path):
+ runs = [json.loads(line) for line in open(path)]
+ return runs, Counter((r['module'], r['args'], r['input']) for r in runs)
+
+
+(a, keys_a), (b, keys_b) = load(sys.argv[1]), load(sys.argv[2])
+seen_a = {}
+for r in a:
+ seen_a.setdefault((r['module'], r['args'], r['input']), set()).add((r['output'], r['errors'], r['exit']))
+both, same, differ = 0, 0, []
+for r in b:
+ key = (r['module'], r['args'], r['input'])
+ if key not in seen_a:
+ continue
+ both += 1
+ if (r['output'], r['errors'], r['exit']) in seen_a[key]:
+ same += 1
+ else:
+ differ.append({'run': key, 'a': sorted(seen_a[key]), 'b': (r['output'], r['errors'], r['exit'])})
+modules_a, modules_b = {r['module'] for r in a}, {r['module'] for r in b}
+print(json.dumps({'runs_a': len(a), 'runs_b': len(b), 'modules_a': len(modules_a), 'modules_b': len(modules_b),
+ 'modules_both': len(modules_a & modules_b), 'runs_both': both, 'runs_same': same,
+ 'runs_differ': len(differ)}))
+for d in differ[:20]:
+ print(json.dumps(d))