Skip to content

A Python module/TUI that provides AMD GPU statistics

License

Notifications You must be signed in to change notification settings

joshlay/amdgpu_stats

Repository files navigation

amdgpu_stats

A Python module/TUI for AMD GPU statistics. Please file an issue with feature requests or bug reports!

Screenshots

Main screen / stats

Screenshot of the main stats table

Usage graphs

Screenshot of the 'graphing' scroll bars

Logs

Screenshot of the 'Logs' tab pane

Requirements

Only Linux is supported. Information is completely sourced from the amdgpu driver via sysfs

Installation

pip install amdgpu-stats

To use the TUI, run amdgpu-stats in your terminal of choice. For the module, see below!

Module

Introduction:

In [1]: import amdgpu_stats.utils

In [2]: amdgpu_stats.utils.CARDS
Out[2]: {'card0': '/sys/class/drm/card0/device/hwmon/hwmon9'}

In [3]: amdgpu_stats.utils.get_core_stats('card0')
Out[3]: {'sclk': 640000000, 'mclk': 1000000000, 'voltage': 0.79, 'util_pct': 65}

In [4]: amdgpu_stats.utils.get_clock('core', format_freq=True)
Out[4]: '659 MHz' 

Attempts are made to provide guidance as ValueErrors. For example:

In [2]: amdgpu_stats.utils.CARDS
Out[2]: {'card1': '/sys/class/drm/card1/device/hwmon/hwmon3'}

In [3]: amdgpu_stats.utils.get_core_stats('card0')
[...]
File ~/.local/lib/python3.12/site-packages/amdgpu_stats/utils.py:82, in validate_card(card)
     80     raise ValueError("No AMD GPUs or hwmon directories found")
     81 # if 'card' was specified (not None) but invalid (not in 'CARDS'), raise a helpful error
---> 82 raise ValueError(f"Invalid card: '{card}'. Must be one of: {list(CARDS.keys())}")

ValueError: Invalid card: 'card0'. Must be one of: ['card1']

For more information on what the module provides, please see:

About

A Python module/TUI that provides AMD GPU statistics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published