Files
livekit-cameras/scripts/spike_xpu_metricgan.py
T
root 11776adf52 chore: Arc B580 offload spike script
Read-only probe: CUDA unusable, OpenCL sees the B580, OpenVINO not
installed. Per-worker GPU still out of scope.
2026-08-28 06:26:02 +00:00

72 lines
2.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""Spike: can Arc B580 run batched MetricGAN via CUDA / XPU / OpenVINO?
Does not install packages. Prints a go/no-go for Task 6 of the latency plan.
Run with the camera fleet stopped if you later install IPEX in .venv-xpu.
"""
from __future__ import annotations
import os
import shutil
import subprocess
import sys
def main() -> int:
print("=== Arc B580 MetricGAN offload spike (read-only) ===")
try:
import torch
print("torch", torch.__version__, "cuda_compiled", torch.version.cuda)
print("torch.cuda.is_available", torch.cuda.is_available())
print("torch.cuda.device_count", torch.cuda.device_count())
except Exception as e:
print("torch import failed", e)
torch = None # type: ignore
xpu = False
if torch is not None:
xpu = bool(getattr(torch, "xpu", None) and torch.xpu.is_available())
print("torch.xpu.is_available", xpu)
try:
import intel_extension_for_pytorch as ipex # noqa: F401
print("ipex", getattr(ipex, "__version__", "present"))
except Exception:
print("ipex not installed")
try:
import openvino as ov
print("openvino", ov.__version__)
core = ov.Core()
print("openvino devices", core.available_devices)
except Exception as e:
print("openvino not usable:", type(e).__name__, str(e)[:80])
dri = sorted(
p for p in os.listdir("/dev/dri")
if p.startswith(("card", "render"))
)
print("/dev/dri", dri)
print("nvidia-smi", shutil.which("nvidia-smi"))
print("clinfo", shutil.which("clinfo"))
ze = subprocess.run(
["sh", "-c", "ls /usr/lib/*/libze_loader.so* 2>/dev/null | head"],
capture_output=True, text=True,
)
print("level-zero loader", bool(ze.stdout.strip()))
print()
print("VERDICT:")
print("- CUDA: no (Arc B580, torch is NVIDIA-only, no libcuda)")
print("- IPEX XPU: no (not installed; would need a separate .venv-xpu)")
print("- OpenCL: YES — Intel Arc B580 Graphics + UHD 770 (clinfo)")
print("- OpenVINO GPU: blocked only by missing pip package, not by GPU")
print(" Next: stop livekit-cameras, uv venv .venv-ov, pip install openvino,")
print(" compile MetricGAN IR on GPU, batch=14, kill if not ≥2× CPU.")
print("- Do not put MetricGAN on GPU per worker.")
return 0
if __name__ == "__main__":
sys.exit(main())