59 lines
3.0 KiB
Python
59 lines
3.0 KiB
Python
"""Explicit experimental full9 inlet, exact original bodyless SRT control otherwise.
|
|
|
|
CPU preflight by default. No acceptance claim; requires separate GPU admission.
|
|
"""
|
|
import argparse
|
|
import hashlib
|
|
import math
|
|
import os
|
|
from pathlib import Path
|
|
import sys
|
|
|
|
HERE=Path(__file__).resolve().parent
|
|
ROOT=HERE.parents[2]
|
|
sys.path.insert(0,str(HERE.parent/'uniform_srt_diagnostic'))
|
|
import diagnose_uniform_srt as diagnostic
|
|
|
|
VARIANT='experimental_regularized_full9'
|
|
|
|
def configuration(source):
|
|
if source.resolve()!=ROOT.resolve():
|
|
raise ValueError('Experimental source must equal the executing harness checkout')
|
|
cfg,body,p,manifest=diagnostic.source_config(source,HERE/'source_manifest.json')
|
|
if cfg['method']['collision']!='SRT' or cfg['method']['inlet']['scheme']!='zou_he_local':
|
|
raise ValueError('Unexpected baseline factory')
|
|
cfg['method']['inlet']['scheme']=VARIANT
|
|
return cfg,diagnostic.select_body(body,True),p,manifest
|
|
|
|
def main():
|
|
parser=argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument('--source',type=Path,default=ROOT)
|
|
parser.add_argument('--output',type=Path,required=True)
|
|
parser.add_argument('--record-inlet-history',action='store_true')
|
|
parser.add_argument('--execute',action='store_true')
|
|
parser.add_argument('--gpu-admitted',action='store_true')
|
|
parser.add_argument('--wall-seconds',type=float)
|
|
a=parser.parse_args();a.source=a.source.resolve()
|
|
cfg,body,p,manifest=configuration(a.source)
|
|
from source_provenance import checkout_provenance
|
|
a.identity=dict(experimental_variant=VARIANT,
|
|
observation_mode='inlet_raw_history' if a.record_inlet_history else 'first_health_pair',
|
|
history_limit_bytes=diagnostic.HISTORY_LIMIT_BYTES if a.record_inlet_history else None,
|
|
history_requested_steps=[0,196] if a.record_inlet_history else None,
|
|
control='without_cylinder',force_observation='not_applicable_no_body',
|
|
baseline_diagnostic_commit='66a27410504fef477808d6079ce79ca1ae6b903c',
|
|
numerical_source_commit=manifest['commit'],
|
|
diagnostic_checkout=checkout_provenance(ROOT),numerical_checkout=checkout_provenance(a.source),
|
|
diagnostic_sha256=hashlib.sha256(Path(__file__).read_bytes()).hexdigest(),
|
|
shared_diagnostic_sha256=hashlib.sha256(Path(diagnostic.__file__).read_bytes()).hexdigest())
|
|
if a.output.exists() and any(a.output.iterdir()):raise ValueError('Use a new/empty output directory')
|
|
if a.execute and (not a.gpu_admitted or not os.environ.get('CUDA_VISIBLE_DEVICES') or
|
|
a.wall_seconds is None or not math.isfinite(a.wall_seconds) or a.wall_seconds<=0):
|
|
raise ValueError('Explicit root admission, device selection and finite wall ceiling required')
|
|
a.output.mkdir(parents=True,exist_ok=True)
|
|
diagnostic.dump(a.output/'preflight.json',dict(**a.identity,source=manifest,config=cfg,body=body,parameters=p,
|
|
max_steps=320,max_evidence_bytes=diagnostic.LIMIT_BYTES,executed=False))
|
|
return diagnostic.execute(a,cfg,body,p) if a.execute else 0
|
|
|
|
if __name__=='__main__':raise SystemExit(main())
|