Skip to content

Commit 194c482

Browse files
committed
Improve log to indicate how much GPU has been found
1 parent 029adf3 commit 194c482

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

library/sensors/sensors_librehardwaremonitor.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,21 +107,19 @@ def get_gpu_name() -> str:
107107

108108
if len(hw_gpus) == 0:
109109
# No supported GPU found on the system
110-
logger.debug("No supported GPU found")
110+
logger.warning("No supported GPU found")
111111
return ""
112112
elif len(hw_gpus) == 1:
113113
# Found one supported GPU
114114
logger.debug("Found one supported GPU: %s" % hw_gpus[0].Name)
115115
return str(hw_gpus[0].Name)
116116
else:
117117
# Found multiple GPUs, try to determine which one to use
118-
logger.warning(
119-
"Found multiple GPUs on your system. Will use dedicated GPU (AMD/Nvidia) for stats if possible.")
120118
amd_gpus = 0
121119
intel_gpus = 0
122120
nvidia_gpus = 0
123121

124-
gpu_to_use = None
122+
gpu_to_use = ""
125123

126124
# Count GPUs by manufacturer
127125
for gpu in hw_gpus:
@@ -132,6 +130,10 @@ def get_gpu_name() -> str:
132130
elif gpu.HardwareType == Hardware.HardwareType.GpuNvidia:
133131
nvidia_gpus += 1
134132

133+
logger.warning(
134+
"Found %d GPUs on your system (%d AMD/%d Nvidia/%d Intel). Try to identify which GPU to use." % (
135+
len(hw_gpus), amd_gpus, nvidia_gpus, intel_gpus))
136+
135137
if nvidia_gpus >= 1:
136138
# One (or more) Nvidia GPU: use first available for stats
137139
gpu_to_use = get_hw_and_update(Hardware.HardwareType.GpuNvidia).Name
@@ -153,7 +155,7 @@ def get_gpu_name() -> str:
153155
if gpu_to_use:
154156
logger.debug("This GPU will be used for stats: %s" % gpu_to_use)
155157
else:
156-
logger.debug("No supported GPU found (no GPU with load sensor)")
158+
logger.warning("No supported GPU found (no GPU with load sensor)")
157159

158160
return gpu_to_use
159161

0 commit comments

Comments
 (0)