CUDApp
CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.
Brought by drakestapleton
CUDApp / tests / amd-exec / fp8block_fast_notebook / finalize.py
| 1 | #!/usr/bin/env python3 |
| 2 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | """Generate notebook evidence index and checksums from captured acceptance data.""" |
| 4 | import argparse |
| 5 | import hashlib |
| 6 | import json |
| 7 | from pathlib import Path |
| 8 | import platform |
| 9 | import sys |
| 10 | import numpy |
| 11 | |
| 12 | HERE=Path(__file__).resolve().parent |
| 13 | |
| 14 | def digest(p): return hashlib.sha256(p.read_bytes()).hexdigest() |
| 15 | |
| 16 | def main(): |
| 17 | parser=argparse.ArgumentParser() |
| 18 | parser.add_argument('--log',type=Path,action='append',required=True) |
| 19 | parser.add_argument('--pool-lock',required=True,type=Path) |
| 20 | args=parser.parse_args() |
| 21 | report=json.loads((HERE/'selfcheck.json').read_text()) |
| 22 | out=Path(report['runs'][0]['output']).parent.parent |
| 23 | record=dict(interpreter=sys.executable,python=platform.python_version(),numpy=numpy.__version__, |
| 24 | cwd=str(HERE),cpu_lock=str(args.pool_lock.resolve()),nice=10, |
| 25 | build_argv=[sys.executable,'build.py'],selfcheck_argv=[sys.executable,'selfcheck.py','--out',str(out)], |
| 26 | child_exits=[dict(mode=r['mode'],exit=r['exit'],result=r['result']) for r in report['runs']], |
| 27 | selfcheck_report=dict(file='selfcheck.json',sha256=digest(HERE/'selfcheck.json')), |
| 28 | logs=[dict(path=str(p),sha256=digest(p)) for p in args.log], |
| 29 | hardware='NOT_RUN',performance='NOT_RUN') |
| 30 | (HERE/'cell-commands.json').write_text(json.dumps(record,indent=2)+'\n') |
| 31 | (HERE/'selfcheck.log').write_bytes(args.log[-1].read_bytes()) |
| 32 | files=sorted(p for p in HERE.rglob('*') if p.is_file() and p.name!='SHA256SUMS' and '__pycache__' not in p.parts) |
| 33 | (HERE/'SHA256SUMS').write_text(''.join('%s %s\n' % (digest(p),p.relative_to(HERE)) for p in files)) |
| 34 | build=json.loads((HERE/'build.json').read_text()) |
| 35 | print('FINAL cell=%s bytes=%d sha256=%s checksummed_files=%d' % (build['file'],build['bytes'],build['sha256'],len(files))) |
| 36 | |
| 37 | if __name__=='__main__': main() |