Skip to main content

Fan monitor and controller for AMD gpus in Linux

Project description

AmdFan

Python package

Is a fork of amdgpu-fan, with security updates and added functionality.

Why fork?

  • alternatives abandoned
  • lacking required features
  • security fixes not addressed
  • basic functionality not working

Amdgpu_fan abandoned

As of a couple years ago, and isn’t applying any security fixes to their project or improvements. There were also some bugs that bothered me with the project when I tried to get it up and running. Features missing

There are a number of features that I wanted, but weren’t available.

  • Thresholds allow temperature range before changing fan speed
  • Frequency setting to allow better control
  • Monitoring to be able to see real-time fan speeds and temperature

Security Fixes

There are some un-addressed pull requests for some recent YAML vulnerabilities that are still present in the old amdgpu_fan project, that I’ve addressed in this fork.

Basic functionality

Setting the card to system managed using the amdgpu_fan pegs your GPU fan at 100%, instead of allowing the system to manage the fan settings. I fixed that bug as well in this release.

These are all addressed in Amdfan, and as long as I’ve still got some AMD cards I intend to at least maintain this for myself. And anyone’s able to help out since this is open source. I would have liked to just contribute these fixes to the main project, but it’s now inactive.

Documentation

Usage

Usage: amdfan.py [OPTIONS]

Options:
  --daemon         Run as daemon applying the fan curve
  --monitor        Run as a monitor showing temp and fan speed
  --manual         Manually set the fan speed value of a card
  --configuration  Prints out the default configuration for you to use
  --service        Prints out the amdfan.service file to use with systemd
  --help           Show this message and exit.

Daemon

Amdfan is also runnable as a systemd service, with the provided amdfan.service.

Monitor

You can use Amdfan to monitor your AMD video cards using the --monitor flag.

screenshot

Manual

Alternatively if you don't want to set a fan curve, you can just apply a fan setting manually. Also allows you to revert the fan control to the systems default behavior by using the "auto" parameter. screenshot

Configuration

This will dump out the default configuration that would get generated for /etc/amdfan.yml when you first run it as a service. This allows you to configure the settings prior to running it as a daemon if you wish.

Service

This is just a convenience method for dumping out the amdfan.service that would get installed if you used a package manager to install amdfan. Useful if you installed the module via pip, pipenv or poetry vs using the package manager version.

Note

You will need to sudo to apply any changes to the fan speeds, but you can monitor them with regular user permissions.

Config File example

# [<Temp in C>,<Fanspeed in %>]
speed_matrix:
- [4, 4]
- [30, 33]
- [45, 50]
- [60, 66]
- [65, 69]
- [70, 75]
- [75, 89]
- [80, 100]

# Current Min supported value is 4 due to driver bug
#
# Optional configuration options
#
# Allows for some leeway +/- temp, as to not constantly change fan speed
# threshold: 2
#
# Frequency will chance how often we probe for the temp
# frequency: 5
#
# cards:
# can be any card returned from `ls /sys/class/drm | grep "^card[[:digit:]]$"`
# - card0

Running the systemd service

To run the service, if you installed amdfan using the AUR package, you can run the following commands to start/enable the service.

sudo systemctl start amdfan
sudo systemctl enable amdfan

After you've started it, you may want to edit the settings found in /etc/amdfan.yml. Once your happy with those, you can restart amdfan with the following command.

sudo systemctl restart amdfan

Checking the status

You can check the systemd service status with the following command:

systemctl status amdfan

Building Python package

Requires Poetry to be installed

poetry build

Building Arch package

Building the Arch package assumes you already have a chroot env setup to build packages.

poetry build
makechrootpkg -c -r $HOME/$CHROOT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

amdfan-0.1.6.tar.gz (14.7 kB view hashes)

Uploaded Source

Built Distribution

amdfan-0.1.6-py3-none-any.whl (21.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page