mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-15 07:35:27 +03:00
Fix device info
This commit is contained in:
parent
f1097539b0
commit
75ba023b5d
@ -339,7 +339,10 @@ def get_intel_gpu_stats() -> dict[str, str]:
|
|||||||
|
|
||||||
def try_get_info(f, h, default="N/A"):
|
def try_get_info(f, h, default="N/A"):
|
||||||
try:
|
try:
|
||||||
v = f(h)
|
if h:
|
||||||
|
v = f(h)
|
||||||
|
else:
|
||||||
|
v = f()
|
||||||
except nvml.NVMLError_NotSupported:
|
except nvml.NVMLError_NotSupported:
|
||||||
v = default
|
v = default
|
||||||
return v
|
return v
|
||||||
@ -443,14 +446,16 @@ def get_nvidia_driver_info() -> dict[str, any]:
|
|||||||
deviceCount = nvml.nvmlDeviceGetCount()
|
deviceCount = nvml.nvmlDeviceGetCount()
|
||||||
for i in range(deviceCount):
|
for i in range(deviceCount):
|
||||||
handle = nvml.nvmlDeviceGetHandleByIndex(i)
|
handle = nvml.nvmlDeviceGetHandleByIndex(i)
|
||||||
driver = try_get_info(nvml.nvmlSystemGetDriverVersion, handle, default=None)
|
driver = try_get_info(nvml.nvmlSystemGetDriverVersion, None, default=None)
|
||||||
cuda = try_get_info(
|
cuda_compute = try_get_info(
|
||||||
nvml.nvmlDeviceGetCudaComputeCapability, handle, default=None
|
nvml.nvmlDeviceGetCudaComputeCapability, handle, default=None
|
||||||
)
|
)
|
||||||
|
vbios = try_get_info(nvml.nvmlDeviceGetVbiosVersion, handle, default=None)
|
||||||
results[i] = {
|
results[i] = {
|
||||||
"name": nvml.nvmlDeviceGetName(handle),
|
"name": nvml.nvmlDeviceGetName(handle),
|
||||||
"driver": driver or "unknown",
|
"driver": driver or "unknown",
|
||||||
"cuda": cuda or "unknown",
|
"cuda_compute": cuda_compute or "unknown",
|
||||||
|
"vbios": vbios or "unknown",
|
||||||
}
|
}
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user