Python 3 script that allows user to monitor AMD GPUs in KSysGuard (AMDGPU driver only)
- calculates average values of every sensor (looking at you
gpu_busy_percent) - supports multiple GPUs
- detects min and max values of sensors automatically
- doesn't require any special dependencies
- no root needed
- respects
Update intervalset inTab propertiesin KSysGuard
NOTE: Some sensors (notably GPU & VRAM Voltages) require amdgpu.ppfeaturemask=0xfffd7fff boot parameter - more info
- AMD GPU using AMDGPU driver
- Python 3 (tested with 3.8)
- read permission for files in
/sys/bus/pci/drivers/amdgpu/<PCI_SLOT>/* - having the most recent version of the Linux Kernel is highly recommended (especially for newer GPUs)
Based on Linux Kernel Documentation:
| Sensor | Unit |
|---|---|
| GPU Usage | % |
| GPU Clock | MHz |
| GPU Voltage | mV |
| VRAM Usage | MiB |
| VRAM Clock | MHz |
| VRAM Voltage | mV |
| GTT Usage | MiB |
| Temperature | °C |
| Power | W |
| Fan | RPM |
| Fan PWM | |
| SoC Clock (>= Vega10) | MHz |
| DCEF Clock (>= Vega10) | MHz |
| F Clock (>= Vega20) | MHz |
| Argument | Type | Description |
|---|---|---|
| --tick | float | Time (in sec) how often should the sensor data be collected |
| --logging | bool | Enables logging - use it when something isn't working. Do not use this argument when adding the script to KSysGuard! |
- Make sure the
sensor.pyfile has an executable permission - Open KSysGuard
- Open
File->Monitor Remote Machine...and fill the window appropriately:- Host:
AMDGPU(or whatever you want) - Connection type:
Custom command - Command:
<PATH TO sensor.py> [arguments]
- Host:
If everything went OK, new sensors should be available in the Sensor Browser. Then just grab the sensor from the list and drop it in a desired place.
HINT: If the Monitor Remote Machine... is missing, create new tab.
- If you have a GPU from Vega 20 series or later,
VRAM Voltagesensor might be missing - with these GPUs the driver reports some data (pp_od_clk_voltagefile to be exact) in a different way and I haven't figured out (yet) a way how to detect it. Check Issue if you would like to help! - If a sensor is missing or its values are
-1or0, it means that the script failed to read and/or parse a file - please read Testing and include the output (with errors from--loggingargument) when creating an Issue. Also, please include Linux Kernel version you're using.
It's possible to test the script manually by executing it in the terminal. If you do it with a --logging argument, you might see some errors get printed out after running it. Include them when creating an Issue!
Either way, the script now should print out:
ksysguardd 1.2.0
ksysguardd>
- Type
monitorsto get list of all available monitors (inPCI_SLOT/SENSORformat)
ksysguardd> monitors
0000:01:00.0/gpu_usage integer
0000:01:00.0/gpu_clock integer
[...]
- Now type
PCI_SLOT/SENSOR?to get info about a specific sensor - it should print out monitor info in aname min max unitformat. This command is required for the one from next step to work!
ksysguardd> 0000:01:00.0/gpu_usage?
GPU Usage 0 100 %
- Now type
PCI_SLOT/SENSORto get current value of the sensor
ksysguardd> 0000:01:00.0/gpu_usage
8
- Add support for Vega 20 series VRAM voltage (Issue)
- Add support for Northbridge voltages (Issue)
- Add support for non-average values
- Add support for multiple temperature and fan sensors
- Add support for multiple hwmons (I'm not sure if it's even needed)
- Improve performance and code quality (any pointers are welcome)
- Add support for more units (if requested)
