research: preserve solver experiments and reproducible benchmarks
This commit is contained in:
parent
12e4266950
commit
e93bc20b0a
85 changed files with 518443 additions and 0 deletions
28
research/experiments/normal_search/run.py
Normal file
28
research/experiments/normal_search/run.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env python3
|
||||
import subprocess,json,statistics,hashlib,random,datetime
|
||||
from pathlib import Path
|
||||
HERE=Path(__file__).resolve().parent
|
||||
POS=HERE.parent/'full_search_feasibility'/'positions'
|
||||
OUT=HERE/'results'
|
||||
OUT.mkdir(exist_ok=True)
|
||||
subprocess.run(['nvcc','-O3','-std=c++17','-arch=sm_86',str(HERE/'cuda_bench.cu'),'-o','/tmp/slime_normal_cuda'],check=True)
|
||||
subprocess.run(['g++','-O3','-std=c++17','-Wall','-Wextra',str(HERE/'cpu_verify.cpp'),'-o','/tmp/slime_normal_verify'],check=True)
|
||||
validation=subprocess.check_output(['/tmp/slime_normal_verify'],text=True)
|
||||
(OUT/'cpu_verify.json').write_text(validation)
|
||||
rng=random.Random(2026101104)
|
||||
fresh=HERE/'fresh65536.txt'
|
||||
fresh.write_text(''.join(f'{rng.randrange(-1875000,1875000)} {rng.randrange(-1875000,1875000)}\n' for _ in range(65536)))
|
||||
summary={'metadata':{'date':datetime.datetime.now().astimezone().isoformat(),'cpu_validation':json.loads(validation),'gpu':subprocess.check_output(['nvidia-smi','--query-gpu=name,driver_version','--format=csv'],text=True)}}
|
||||
for name in ['known','stress','random4096','random65536','fresh65536']:
|
||||
cmd=['/tmp/slime_normal_cuda',str(fresh if name=='fresh65536' else POS/(name+'.txt')),'normal','7']
|
||||
r=subprocess.run(cmd,capture_output=True,text=True,timeout=300)
|
||||
(OUT/(name+'.jsonl')).write_text(r.stdout)
|
||||
(OUT/(name+'.stderr')).write_text(r.stderr)
|
||||
if r.returncode: raise RuntimeError(r.stderr)
|
||||
rows=[json.loads(s) for s in r.stdout.splitlines()]
|
||||
summary[name]={str(m):statistics.median(v['kernel_ms'] for v in rows if v['type']=='search_timing' and v['mode']==m) for m in [3,4,5,6,7]}
|
||||
summary[name]['info']=next(v for v in rows if v['type']=='search_info')
|
||||
print(name,json.dumps(summary[name]),flush=True)
|
||||
summary['source_sha256']={name:hashlib.sha256((HERE/name).read_bytes()).hexdigest() for name in ['cuda_bench.cu','grouped.hpp','cpu_verify.cpp','run.py']}
|
||||
summary['shared_headers_sha256']={name:hashlib.sha256((HERE.parents[2]/'include'/'slime'/name).read_bytes()).hexdigest() for name in ['solver_core.hpp','upper_interval.hpp']}
|
||||
(OUT/'summary.json').write_text(json.dumps(summary,indent=2))
|
||||
Loading…
Add table
Add a link
Reference in a new issue