Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sorry for the messy commit log, I accidentally committed the
config.yaml
file, so I had to revert and push it again 😆What the PR is about:
I've observed that the monitor can't really handle systems with multiple graphics cards properly. It either averages things out or just picks one. This PR tries to fix that by letting you see stats (like temp, load, memory) for each GPU individually in the themes.
What it does:
Getting the data: I've refactored the sensor code (
sensors_python.py
,sensors_librehardwaremonitor.py
) so that it can grab stats and names for all GPUs it can find, not just one. It now returns this data as lists.Storing the data: The main
stats.py
file (specifically the Gpu class) was reworked quite a bit to hold these lists of data – one list for temps, one for loads, one for names, etc., for all detected GPUs.New Theme functionality: Themes can now use a new format. Inside the STATS -> GPU section, you can add subsections like GPU0:, GPU1:, etc. Underneath those, you define where and how to show the stats (PERCENTAGE, TEMPERATURE, NAME, etc.) for that specific card. I added a theme called
MultiGPUTest_3.5
as an example.Keeping old themes working (Backwards Compatibility): If a theme doesn't use the new GPU0/GPU1 format, the code (_render_legacy_gpu in stats.py) will automatically just show the stats for the first GPU it finds, using the old theme definitions. I also updated default.yaml to support both structures gracefully.
Handling missing data: Sometimes sensors don't report everything (especially fan speed or FPS). I modified the code in
stats.py
to handle these NaN values better, showing "N/A" or 0 instead of crashing.GPU Name fetching: GPU names can now be fetched with the right code. They default to vendor-specific names like
NVIDIA GPU
when the names are unable to fetch.File Changes Summary:
library/sensors/sensors_python.py
: Modified GPU methods to return List; added get_gpu_names(); improved fan detection logic.library/sensors/sensors_librehardwaremonitor.py
: Added get_all_gpus_and_update(); modified GPU methods to return List; added get_gpu_names().library/sensors/sensors_stub_*.py
: Updated GPU methods to return List for dummy GPUs; added get_gpu_names().library/stats.py
: Major refactor of Gpu class for per-GPU data; added new rendering (_render_multi_gpu) and legacy rendering (_render_legacy_gpu) logic; improved NaN handling.res/themes/default.yaml
: Added GPU0 default structure; kept legacy defaults for compatibility.res/themes/MultiGPUTest_3.5/theme.yaml
: Created/refined test theme demonstrating GPU0/GPU1 usage, name display, and background image.Testing:
I've tested this on my setup:
PYTHON
,STATIC
,STUB
It worked smoothly on my setup, but I haven't had a chance to test it on Windows, on AMD GPUs, on single GPUs or on different displays.
I don't have a Windows setup, so I didn't have a chance to test the LHM sensor.
Further testing would be very much appreciated.
Also, I do know that this is a fairly large bit of code, and this is my first real contribution to an open source project, so feel free to provide any advice or ask me about the code. Thanks.