Implement bounded O1 geometry preparation with METIS and synthetic acceptance

This commit is contained in:
Frank14f committed 2026-11-17 04:52:02 +08:00
1 parent 7f820b76ea
commit afec2dce6a
34 files changed
+124863

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
"""Synthetic partition fingerprint from one fresh process, never real data."""
import argparse
import hashlib
import json
import os
from pathlib import Path
from test_o1_partition import box
from o1_partition import canonical_mesh, graph, Metis, partition_metrics
if __name__=='__main__':
p=argparse.ArgumentParser();p.add_argument('output',type=Path);a=p.parse_args()
mesh=canonical_mesh(*box());g=graph(mesh);labels,call=Metis().partition(g,mesh['raw_cells'],0)
record=dict(pid=os.getpid(),seed=0,synthetic_only=True,labels_sha256=hashlib.sha256(labels.tobytes()).hexdigest(),
graph_sha256={k:hashlib.sha256(g[k].tobytes()).hexdigest() for k in ['xadj','adjncy','vwgt','adjwgt']},
options=call['options'],metrics=partition_metrics(mesh,g,labels))
a.output.write_text(json.dumps(record,indent=2)+'\n')