Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/tools/uxl/level1/oracle/run-all.py # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tools / uxl / level1 / oracle / run-all.py` 51 lines ยท 3530 bytes Raw Blame History 1 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 from pathlib import Path 3 import hashlib,json,os,runpy,shutil,subprocess,sys,tarfile,traceback,zipfile 4 D=Path(__file__).resolve().parent;os.chdir(D) 5 import platform,datetime 6 job={'phase':'verify'} 7 environment={'captured_utc':datetime.datetime.now(datetime.timezone.utc).isoformat(),'platform':platform.platform(),'nodes':{}} 8 for p in Path('/sys/class/kfd/kfd/topology/nodes').glob('*/properties'): 9 try:environment['nodes'][p.parent.name]={'gpu_id':(p.parent/'gpu_id').read_text(),'properties':p.read_text()} 10 except OSError:pass 11 (D/'environment.json').write_text(json.dumps(environment,indent=2)) 12 def snapshot(): 13 files=[p for p in D.rglob('*') if p.is_file() and 'source' not in p.relative_to(D).parts and p.suffix in ('.py','.json','.stdout','.stderr','.txt','.mark')] 14 files += [D/'omega-launch',D/'vadd-lds.hsaco',D/'vadd.hsaco'] 15 tmp=D.parent/'refusal-results.tmp' 16 with zipfile.ZipFile(tmp,'w',zipfile.ZIP_DEFLATED) as z: 17 for p in files:z.write(p,str(p.relative_to(D))) 18 z.writestr('DELIVERY_SHA256.json',json.dumps({str(p.relative_to(D)):hashlib.sha256(p.read_bytes()).hexdigest() for p in files},indent=2)) 19 tmp.replace(D.parent/'omega-refusal-results.zip') 20 def save(): 21 (D/'job-state.json').write_text(json.dumps(job,indent=2));print(json.dumps(job),flush=True);snapshot() 22 try: 23 for n,h in json.loads((D/'MANIFEST.json').read_text()).items():assert hashlib.sha256((D/n).read_bytes()).hexdigest()==h,n 24 S=D/'source';S.mkdir(exist_ok=True) 25 with tarfile.open(D/'cap-data.tar.xz','r:xz') as z: 26 for m in z.getmembers(): 27 assert m.isfile() and Path(m.name).name==m.name 28 (S/m.name).write_bytes(z.extractfile(m).read()) 29 manifest=json.loads((S/'MANIFEST.json').read_text()) 30 for n,h in manifest.items():assert hashlib.sha256((S/n).read_bytes()).hexdigest()==h,n 31 (S/'MANIFEST.original.json').write_bytes((S/'MANIFEST.json').read_bytes()) 32 shutil.copytree(D/'code',S/'code',dirs_exist_ok=True);shutil.copyfile(D/'omega-launch',S/'omega-launch');(S/'omega-launch').chmod(0o755) 33 manifest['omega-launch']=hashlib.sha256((S/'omega-launch').read_bytes()).hexdigest();(S/'MANIFEST.json').write_text(json.dumps(manifest)) 34 job['phase']='checkpoint';save();runpy.run_path(str(D/'driver-real2.py'),run_name='prepare-import')['prepare']() 35 job['phase']='nonzero-LDS';save() 36 for name in ('vadd-lds.hsaco','vadd.hsaco'): 37 p=subprocess.run([str(S/'omega-launch'),'vadd',str(D/name),'vadd','`10000000000`'],capture_output=True,timeout=120) 38 (D/(name+'.stdout')).write_bytes(p.stdout);(D/(name+'.stderr')).write_bytes(p.stderr) 39 assert p.returncode==0 and b'OMEGA vadd=PASS count=256' in p.stdout,(name,p.returncode) 40 job['phase']='coding24';save() 41 with (D/'coding24-check.stdout').open('w') as o,(D/'coding24-check.stderr').open('w') as e: 42 p=subprocess.run([sys.executable,str(D/'coding24-check.py')],stdout=o,stderr=e,timeout=300) 43 assert p.returncode==0 and json.loads((D/'coding24.json').read_text())['phase']=='complete' 44 job['phase']='lighthouse-five';save() 45 env=dict(os.environ,SOURCE_PLAN_DIR=str(S),HIP_ORACLE_JSON=str(D/'independent-hip-graph.json')) 46 with (D/'benchmark.stdout').open('w') as o,(D/'benchmark.stderr').open('w') as e: 47 p=subprocess.run([sys.executable,str(D/'benchmark-qualified.py')],stdout=o,stderr=e,env=env,timeout=900) 48 assert p.returncode==0 and json.loads((D/'state.json').read_text())['phase']=='complete' 49 job['phase']='complete';save() 50 except BaseException: 51 job.update(phase='exception',detail=traceback.format_exc());save();raise