Spaces:
Running on Zero
Running on Zero
File size: 1,060 Bytes
6d5047c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | """Card 9 runtime health check entrypoint for backend startup validation."""
from __future__ import annotations
import argparse
import json
from kimodo.runtime import runtime_health_report
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(description="Kimodo runtime/backend health check")
parser.add_argument(
"--device",
type=str,
default=None,
help="Requested device (auto, rocm, cuda, amd, cpu, mps, cuda:0, etc.)",
)
parser.add_argument(
"--require-accelerator",
action="store_true",
help="Fail if selected runtime device is CPU.",
)
return parser.parse_args()
def main() -> int:
args = parse_args()
report = runtime_health_report(args.device)
print(json.dumps(report.to_dict(), indent=2, sort_keys=True))
if args.require_accelerator and report.selected_device == "cpu":
print("ERROR: accelerator required but runtime selected CPU")
return 2
return 0
if __name__ == "__main__":
raise SystemExit(main()) |