19 lines
838 B
Python
19 lines
838 B
Python
"""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')
|