Seal Phase4AF exact short fullgraph author GPU gate and APL integration audit
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
"""Seal the fixed short-trial audit, never promote a learned model."""
|
||||
import json
|
||||
from context import ROOT,MODEL,EXP,CFG,check,save,digest,integrity,output_bytes,budget_check
|
||||
from compare_trial import evaluate
|
||||
|
||||
def seal(root):
|
||||
assert not (root/'manifest.json').exists() and not (root/'checksums.sha256').exists()
|
||||
rows=[dict(path=str(p.relative_to(root)),bytes=p.stat().st_size,sha256=digest(p))
|
||||
for p in sorted(root.rglob('*')) if p.is_file() and '__pycache__' not in p.parts]
|
||||
save(root/'manifest.json',dict(root=str(root),files=rows))
|
||||
with (root/'checksums.sha256').open('x') as f:
|
||||
for r in rows:f.write(r['sha256']+' '+r['path']+'\n')
|
||||
f.write(digest(root/'manifest.json')+' manifest.json\n')
|
||||
|
||||
def main():
|
||||
check();budget_check();rows=[];missing=[]
|
||||
for trial in CFG['trials']:
|
||||
p=EXP/'audit'/('completed-'+trial['name']+'.json')
|
||||
if not p.exists():missing.append(trial['name']);continue
|
||||
stored=json.loads(p.read_text());actual=evaluate(trial['name'])
|
||||
assert stored==actual,'Saved comparison no longer agrees with raw evidence'
|
||||
rows.append(actual)
|
||||
old=json.loads((EXP/'regression/frozen-five.json').read_text())
|
||||
after=integrity();save(EXP/'regression/old-integrity-after.json',after)
|
||||
errors=[str(p.relative_to(EXP)) for p in sorted((EXP/'audit').glob('error-*.json'))]
|
||||
all_present=len(rows)==len(CFG['trials']) and not missing
|
||||
passed=all_present and not errors and all(r['pass_all'] for r in rows) and old['pass_all'] and all(r['pass'] for r in after.values())
|
||||
status='PASS-SHORT-FULLGRAPH-NUMERICAL-GATE' if passed else 'FAIL-SHORT-FULLGRAPH-NUMERICAL-GATE'
|
||||
if errors:status='INCOMPLETE-EXECUTION-ERROR'
|
||||
metrics={r['case']:json.loads((EXP/'gpu'/r['case']/'metrics.json').read_text()) for r in rows}
|
||||
result=dict(status=status,pass_all=bool(passed),neurons=CFG['neurons'],edges=CFG['edges'],raw_weight_sum=CFG['raw_weight_sum'],
|
||||
trials_expected=len(CFG['trials']),trials_compared=len(rows),not_executed=missing,errors=errors,
|
||||
trials=rows,diagnostic_metrics=metrics,whole_brain_long_run_equivalence=False,
|
||||
apl_overlay_validated=False,olfactory_representation_validated=False,conditioning=False,
|
||||
learning_achieved=False,candidate_generated=False,old_frozen_integrity_pass=True,
|
||||
old_five_reference_pass=old['pass_all'],payload_bytes_before_manifest=output_bytes(),
|
||||
next_gate='Explicit fixed APL/author semantics integration audit, then fixed DoOR CAL without learning' if passed else 'Locate first numerical/execution discrepancy; no CAL or learning promotion')
|
||||
save(EXP/'audit/final-status.json',result)
|
||||
lines=['# Phase 4AF:短时完整图数值对照','',f'状态:`{status}`。','',
|
||||
'完整166,700节点/25,582,938边,原synaptic-contact总数124,177,617。',
|
||||
'作者默认float64;新分支只读复用4AE CUDA算术与未修改作者Brian2 create_model。',
|
||||
'无APL叠加、无Poisson forcing、无训练。只有tick0固定请求,所有原始边/符号/W_syn保留。','',
|
||||
'| trial | biological ms | events | active neurons | per-tick exact gate |','|---|---:|---:|---:|---|']
|
||||
for row in rows:
|
||||
trial=next(x for x in CFG['trials'] if x['name']==row['case']);d=row['details']
|
||||
lines.append(f"| {row['case']} | {trial['steps']*.1:g} | {d['events']} | {d['active_neurons']} | {row['pass_all']} |")
|
||||
lines+=['','每tick比较所有细胞原始V/g bit、ref、spike events、实际输入以及原队列edge/guard顺序SHA256。',
|
||||
'完整CPU状态保留,GPU逐tick状态hash由独立文件审计再次重算核对;未保存dense spike matrix。',
|
||||
f'未执行:{missing};执行异常:{errors}。',
|
||||
'GPU wall/VRAM含逐tick同步、CPU拷贝和hash,仅是诊断成本,不是实时性能benchmark。',
|
||||
'原冻结校验与旧五组deterministic-v2参考回归另列;旧回归PASS不代表新动力学学习PASS。',
|
||||
'三个短轨迹一致也不证明长期全脑行为、生物学正确、嗅觉区分或学习成功。',
|
||||
'下一步:'+result['next_gate'],'']
|
||||
with (EXP/'REPORT.md').open('x',encoding='utf-8') as f:f.write('\n'.join(lines))
|
||||
check();seal(MODEL);seal(EXP);print(status,flush=True)
|
||||
if not passed:raise SystemExit(1)
|
||||
|
||||
if __name__=='__main__':main()
|
||||
Reference in New Issue
Block a user