modeld: avoid using USB GPU on a AMD laptop (#35602)

modeld: avoid using usb GPU if 'USBGPU' is not in os.environ

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
pull/35617/head
eFini 2 days ago committed by GitHub
parent 9e2fc078cb
commit c3c5992f88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 26
      selfdrive/modeld/SConscript

@ -56,17 +56,15 @@ for model_name in ['driving_vision', 'driving_policy', 'dmonitoring_model']:
tg_compile(flags, model_name) tg_compile(flags, model_name)
# Compile BIG model if USB GPU is available # Compile BIG model if USB GPU is available
import subprocess if "USBGPU" in os.environ:
from tinygrad import Device import subprocess
# because tg doesn't support multi-process
# because tg doesn't support multi-process devs = subprocess.check_output('python3 -c "from tinygrad import Device; print(list(Device.get_available_devices()))"', shell=True, cwd=env.Dir('#').abspath)
devs = subprocess.check_output('python3 -c "from tinygrad import Device; print(list(Device.get_available_devices()))"', shell=True, cwd=env.Dir('#').abspath) if b"AMD" in devs:
if b"AMD" in devs: print("USB GPU detected... building")
del Device flags = "AMD=1 AMD_IFACE=USB AMD_LLVM=1 NOLOCALS=0 IMAGE=0"
print("USB GPU detected... building") bp = tg_compile(flags, "big_driving_policy")
flags = "AMD=1 AMD_IFACE=USB AMD_LLVM=1 NOLOCALS=0 IMAGE=0" bv = tg_compile(flags, "big_driving_vision")
bp = tg_compile(flags, "big_driving_policy") lenv.SideEffect('lock', [bp, bv]) # tg doesn't support multi-process so build serially
bv = tg_compile(flags, "big_driving_vision") else:
lenv.SideEffect('lock', [bp, bv]) # tg doesn't support multi-process so build serially print("USB GPU not detected... skipping")
else:
print("USB GPU not detected... skipping")

Loading…
Cancel
Save