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/openaccel-lab/blob/main/bin/oal-check # openaccel-lab aien-dev/openaccel-lab Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `openaccel-lab / bin / oal-check` 34 lines ยท 1364 bytes Raw Blame History 1 #!/usr/bin/env python3 2 # SPDX-License-Identifier: Apache-2.0 3 # oal-check WORKLOAD CASE OUTPUTS 4 # Compare an entrant's outputs with the float64 reference under the workload's tolerance contract. 5 # stdout: one JSON verdict line. Exit 0 PASS, 1 FAIL, 2 usage or malformed input. 6 # INTERIM host glue (Python + numpy). Successor: oal-check in seeded Omega. 7 import os 8 import sys 9 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) 10 import json 11 from oal import case, check, manifest, ref 12 13 if len(sys.argv) != 4: 14 sys.stderr.write("usage: oal-check WORKLOAD CASE OUTPUTS\n") 15 sys.exit(2) 16 m = manifest.load(sys.argv[1]) 17 blob = open(sys.argv[2], "rb").read() 18 raw = open(sys.argv[3], "rb").read() 19 pvals, sizes, ins, warm, reps = case.unpack(blob) 20 params = dict(zip(manifest.params_of(m).keys(), pvals)) 21 import numpy as np 22 tensors = {} 23 for k, s in enumerate(m["inputs"]): 24 tensors[s["name"]] = np.frombuffer(ins[k], dtype=manifest.DTYPES[s["dtype"]][0]).reshape(manifest.shape(s, params)) 25 try: 26 got = case.split_outputs(m, params, raw) 27 except ValueError as e: 28 print(json.dumps({"workload": m["name"], "pass": False, "why": str(e)})) 29 sys.exit(1) 30 v = check.compare(m, params, ref.compute(m, params, tensors), got) 31 v["workload"] = m["name"] 32 v["case_sha256"] = case.sha256(blob) 33 print(json.dumps(v)) 34 sys.exit(0 if v["pass"] else 1)