Source identity
| Field | Recorded value |
|---|---|
| Source type | archive member |
| Original record | reproduce.py |
| Date | Not specified in source |
| Path or archive member | archives/libsrc-ef5e6c3ea329/quantum_mip_benchmark/code/reproduce.py |
| Original SHA-256 | 18140eb05e886c25839cac52bc5ef714361bca2bce179ab2fee6818bd51eedfb |
| Reading-copy SHA-256 | 18140eb05e886c25839cac52bc5ef714361bca2bce179ab2fee6818bd51eedfb |
| Archive source | {"sourceId": "libsrc-ef5e6c3ea329", "member": "quantum_mip_benchmark/code/reproduce.py"} |
Recovered source transcript
Download complete source text ↓27 lines · 1.2 KB
#!/usr/bin/env python3
"""Reproduce in a NEW workspace without overwriting the delivered evidence."""
from __future__ import annotations
import argparse, os, shutil, subprocess, sys
from pathlib import Path
def main():
parser=argparse.ArgumentParser()
parser.add_argument('--output',required=True,type=Path,help='New, nonexistent directory')
args=parser.parse_args()
source=Path(__file__).resolve().parents[1]
target=args.output.expanduser().resolve()
if target.exists():
raise SystemExit(f'Refusing to overwrite an existing path: {target}')
(target/'code').mkdir(parents=True)
for name in ('benchmark.py','analyze.py','diagnostic_unnormalized.py'):
shutil.copy2(source/'code'/name,target/'code'/name)
shutil.copy2(source/'protocol.json',target/'protocol.json')
env=os.environ.copy()
for key in ('OPENBLAS_NUM_THREADS','OMP_NUM_THREADS','MKL_NUM_THREADS','NUMBA_NUM_THREADS'):
env[key]='1'
for script in ('benchmark.py','analyze.py','diagnostic_unnormalized.py'):
subprocess.run([sys.executable,str(target/'code'/script)],check=True,env=env)
print(f'Reproduced results: {target}')
if __name__=='__main__':main()