mirror of
https://github.com/immich-app/immich.git
synced 2025-06-23 15:30:51 -04:00
Check if NPU drivers is loaded or not.
This commit is contained in:
parent
23d0ea0e7b
commit
416211916d
@ -1,6 +1,7 @@
|
|||||||
# This code is from leafqycc/rknn-multi-threaded
|
# This code is from leafqycc/rknn-multi-threaded
|
||||||
# Following Apache License 2.0
|
# Following Apache License 2.0
|
||||||
|
|
||||||
|
import os
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
|
|
||||||
@ -10,8 +11,6 @@ try:
|
|||||||
from rknnlite.api import RKNNLite
|
from rknnlite.api import RKNNLite
|
||||||
|
|
||||||
with open("/proc/device-tree/compatible") as f:
|
with open("/proc/device-tree/compatible") as f:
|
||||||
# Keep in mind that this is not in container by default.
|
|
||||||
# and this way of checking can't check if the rknpu driver is running or not.
|
|
||||||
device_compatible_str = f.read()
|
device_compatible_str = f.read()
|
||||||
for soc in supported_socs:
|
for soc in supported_socs:
|
||||||
if soc in device_compatible_str:
|
if soc in device_compatible_str:
|
||||||
@ -19,6 +18,7 @@ try:
|
|||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
is_available = False
|
is_available = False
|
||||||
|
is_available = os.path.exists("/sys/kernel/debug/rknpu/load")
|
||||||
except (FileNotFoundError, ImportError):
|
except (FileNotFoundError, ImportError):
|
||||||
is_available = False
|
is_available = False
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user