amdfan


Nameamdfan JSON
Version 0.1.26 PyPI version JSON
download
home_pagehttps://mcgillij.dev/pages/amdfan.html
SummaryFan monitor and controller for AMD gpus in Linux
upload_time2023-08-05 15:44:26
maintainer
docs_urlNone
authormcgillij
requires_python>=3.9,<4.0
licenseGPL-2.0-only
keywords fan gpu temp monitor amd
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # AmdFan
![Python package](https://github.com/mcgillij/amdfan/workflows/Python%20package/badge.svg)
[![Downloads](https://static.pepy.tech/personalized-badge/amdfan?period=total&units=international_system&left_color=blue&right_color=green&left_text=PyPi%20Downloads)](https://pepy.tech/project/amdfan)

Is a fork of amdgpu-fan, with security updates and added functionality.
This is intended for stand-alone GPU's and not integrated APU's.

## 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 is no longer 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 were not 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

``` bash
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](https://raw.githubusercontent.com/mcgillij/amdfan/main/images/screenshot.png)

## 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](https://raw.githubusercontent.com/mcgillij/amdfan/main/images/manual.png)

## 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.

Running `amdfan --configuration` will output the following block to STDOUT.

``` bash
#Fan Control Matrix.
# [<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: 4
#
# Frequency will change how often we probe for the temp
# frequency: 5
#
# While frequency and threshold are optional, I highly recommend finding
# settings that work for you. I've included the defaults I use above.
#
# cards:
# can be any card returned from `ls /sys/class/drm | grep "^card[[:digit:]]$"`
# - card0
```
You can use this to generate your configuration by doing ``amdfan --configuration > amdfan.yml``, you can then modify the settings and place it in ``/etc/amdfan.yml`` for when you would like to run it as a service.

## 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`.

Running `amdfan --service` will output the following block to STDOUT.

``` bash
[Unit]
Description=amdfan controller

[Service]
ExecStart=/usr/bin/amdfan --daemon
Restart=always

[Install]
WantedBy=multi-user.target
```

# Note

Monitoring fan speeds and temperatures can run with regular user permissions.
`root` permissions are required for changing the settings / running as a daemon.

# Recommended settings

Below is the settings that I use on my machines to control the fan curve without too much fuss, but you should find a frequency and threshold setting that works for your workloads.

`/etc/amdfan.yml`
``` bash
speed_matrix:
- [4, 4]
- [30, 33]
- [45, 50]
- [60, 66]
- [65, 69]
- [70, 75]
- [75, 89]
- [80, 100]

threshold: 4
frequency: 5
```

## Installing the systemd service
If you installed via the AUR, the service is already installed, and you just need to *start/enable* it. If you installed via pip/pipenv or poetry, you can generate your systemd service file with the following command.

``` bash
amdfan --service > amdfan.service && sudo mv amdfan.service /usr/lib/systemd/system/
```

## Starting the systemd service

To run the service, you can run the following commands to **start/enable** the service.

``` bash
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.

``` bash
sudo systemctl restart amdfan
```

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

``` bash
systemctl status amdfan
```


## Building Arch AUR package

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

```bash
git clone https://aur.archlinux.org/amdfan.git
cd amdfan/
makechrootpkg -c -r $HOME/$CHROOT
```

## Installing the Arch package

``` bash
sudo pacman -U --asdeps amdfan-*-any.pkg.tar.zst
```

# Installing from PyPi
You can also install amdfan from pypi using something like poetry.

``` bash
poetry init
poetry add amdfan
poetry run amdfan --help
```

# Building Python package
Requires [poetry](https://python-poetry.org/) to be installed

``` bash
git clone git@github.com:mcgillij/amdfan.git
cd amdfan/
poetry build
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://mcgillij.dev/pages/amdfan.html",
    "name": "amdfan",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "fan,gpu,temp,monitor,amd",
    "author": "mcgillij",
    "author_email": "mcgillivray.jason@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/95/8f/cf25e54257e4c85442db5b1ae7686e38be604bf25993989c4211bb65a948/amdfan-0.1.26.tar.gz",
    "platform": null,
    "description": "# AmdFan\n![Python package](https://github.com/mcgillij/amdfan/workflows/Python%20package/badge.svg)\n[![Downloads](https://static.pepy.tech/personalized-badge/amdfan?period=total&units=international_system&left_color=blue&right_color=green&left_text=PyPi%20Downloads)](https://pepy.tech/project/amdfan)\n\nIs a fork of amdgpu-fan, with security updates and added functionality.\nThis is intended for stand-alone GPU's and not integrated APU's.\n\n## Why fork?\n\n* alternatives abandoned\n* lacking required features\n* security fixes not addressed\n* basic functionality not working\n\n### Amdgpu_fan abandoned\n\nAs of a couple years ago, and is no longer 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.\nFeatures missing\n\nThere are a number of features that I wanted, but were not available.\n\n* Thresholds allow temperature range before changing fan speed\n* Frequency setting to allow better control\n* Monitoring to be able to see real-time fan speeds and temperature\n\n### Security Fixes\n\nThere are some un-addressed pull requests for some recent YAML vulnerabilities that are still present in the old amdgpu_fan project, that I\u2019ve addressed in this fork.\n\n### Basic functionality\n\nSetting 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.\n\nThese are all addressed in Amdfan, and as long as I\u2019ve still got some AMD cards I intend to at least maintain this for myself. And anyone\u2019s able to help out since this is open source. I would have liked to just contribute these fixes to the main project, but it\u2019s now inactive.\n\n# Documentation\n## Usage\n\n``` bash\nUsage: amdfan.py [OPTIONS]\n\nOptions:\n  --daemon         Run as daemon applying the fan curve\n  --monitor        Run as a monitor showing temp and fan speed\n  --manual         Manually set the fan speed value of a card\n  --configuration  Prints out the default configuration for you to use\n  --service        Prints out the amdfan.service file to use with systemd\n  --help           Show this message and exit.\n```\n\n## Daemon\n\nAmdfan is also runnable as a systemd service, with the provided ```amdfan.service```.\n\n## Monitor\n\nYou can use Amdfan to monitor your AMD video cards using the ```--monitor``` flag.\n\n![screenshot](https://raw.githubusercontent.com/mcgillij/amdfan/main/images/screenshot.png)\n\n## Manual\n\nAlternatively if you don't want to set a fan curve, you can just apply a fan setting manually. \nAlso allows you to revert the fan control to the systems default behavior by using the \"auto\" parameter.\n![screenshot](https://raw.githubusercontent.com/mcgillij/amdfan/main/images/manual.png)\n\n## Configuration\n\nThis 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.\n\nRunning `amdfan --configuration` will output the following block to STDOUT.\n\n``` bash\n#Fan Control Matrix.\n# [<Temp in C>,<Fanspeed in %>]\nspeed_matrix:\n- [4, 4]\n- [30, 33]\n- [45, 50]\n- [60, 66]\n- [65, 69]\n- [70, 75]\n- [75, 89]\n- [80, 100]\n\n# Current Min supported value is 4 due to driver bug\n#\n# Optional configuration options\n#\n# Allows for some leeway +/- temp, as to not constantly change fan speed\n# threshold: 4\n#\n# Frequency will change how often we probe for the temp\n# frequency: 5\n#\n# While frequency and threshold are optional, I highly recommend finding\n# settings that work for you. I've included the defaults I use above.\n#\n# cards:\n# can be any card returned from `ls /sys/class/drm | grep \"^card[[:digit:]]$\"`\n# - card0\n```\nYou can use this to generate your configuration by doing ``amdfan --configuration > amdfan.yml``, you can then modify the settings and place it in ``/etc/amdfan.yml`` for when you would like to run it as a service.\n\n## Service\n\nThis 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`.\n\nRunning `amdfan --service` will output the following block to STDOUT.\n\n``` bash\n[Unit]\nDescription=amdfan controller\n\n[Service]\nExecStart=/usr/bin/amdfan --daemon\nRestart=always\n\n[Install]\nWantedBy=multi-user.target\n```\n\n# Note\n\nMonitoring fan speeds and temperatures can run with regular user permissions.\n`root` permissions are required for changing the settings / running as a daemon.\n\n# Recommended settings\n\nBelow is the settings that I use on my machines to control the fan curve without too much fuss, but you should find a frequency and threshold setting that works for your workloads.\n\n`/etc/amdfan.yml`\n``` bash\nspeed_matrix:\n- [4, 4]\n- [30, 33]\n- [45, 50]\n- [60, 66]\n- [65, 69]\n- [70, 75]\n- [75, 89]\n- [80, 100]\n\nthreshold: 4\nfrequency: 5\n```\n\n## Installing the systemd service\nIf you installed via the AUR, the service is already installed, and you just need to *start/enable* it. If you installed via pip/pipenv or poetry, you can generate your systemd service file with the following command.\n\n``` bash\namdfan --service > amdfan.service && sudo mv amdfan.service /usr/lib/systemd/system/\n```\n\n## Starting the systemd service\n\nTo run the service, you can run the following commands to **start/enable** the service.\n\n``` bash\nsudo systemctl start amdfan\nsudo systemctl enable amdfan\n```\n\nAfter 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.\n\n``` bash\nsudo systemctl restart amdfan\n```\n\n## Checking the status\nYou can check the systemd service status with the following command:\n\n``` bash\nsystemctl status amdfan\n```\n\n\n## Building Arch AUR package\n\nBuilding the Arch package assumes you already have a chroot env setup to build packages.\n\n```bash\ngit clone https://aur.archlinux.org/amdfan.git\ncd amdfan/\nmakechrootpkg -c -r $HOME/$CHROOT\n```\n\n## Installing the Arch package\n\n``` bash\nsudo pacman -U --asdeps amdfan-*-any.pkg.tar.zst\n```\n\n# Installing from PyPi\nYou can also install amdfan from pypi using something like poetry.\n\n``` bash\npoetry init\npoetry add amdfan\npoetry run amdfan --help\n```\n\n# Building Python package\nRequires [poetry](https://python-poetry.org/) to be installed\n\n``` bash\ngit clone git@github.com:mcgillij/amdfan.git\ncd amdfan/\npoetry build\n```\n",
    "bugtrack_url": null,
    "license": "GPL-2.0-only",
    "summary": "Fan monitor and controller for AMD gpus in Linux",
    "version": "0.1.26",
    "project_urls": {
        "Documentation": "https://mcgillij.dev/pages/amdfan.html",
        "Homepage": "https://mcgillij.dev/pages/amdfan.html",
        "Repository": "https://github.com/mcgillij/amdfan"
    },
    "split_keywords": [
        "fan",
        "gpu",
        "temp",
        "monitor",
        "amd"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a630ea4ea34ddd250706fa3e9c00a4945bac1105d1e55d0cdf14a391f4d1c1e",
                "md5": "c9b79dbf47da0c932e8091b5ba0cecd0",
                "sha256": "7e579095502ac85157765d1be6b1551870f57bb60e38019830cc8be3c909d0bd"
            },
            "downloads": -1,
            "filename": "amdfan-0.1.26-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c9b79dbf47da0c932e8091b5ba0cecd0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 15793,
            "upload_time": "2023-08-05T15:44:25",
            "upload_time_iso_8601": "2023-08-05T15:44:25.211455Z",
            "url": "https://files.pythonhosted.org/packages/3a/63/0ea4ea34ddd250706fa3e9c00a4945bac1105d1e55d0cdf14a391f4d1c1e/amdfan-0.1.26-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "958fcf25e54257e4c85442db5b1ae7686e38be604bf25993989c4211bb65a948",
                "md5": "2d8c8bba737e6cd0cdbe064365366b42",
                "sha256": "8f620ddeeaf9ffb797c81fc3ac554b6a06eb3aa6d2d5473d018fd622f84be9d0"
            },
            "downloads": -1,
            "filename": "amdfan-0.1.26.tar.gz",
            "has_sig": false,
            "md5_digest": "2d8c8bba737e6cd0cdbe064365366b42",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 14322,
            "upload_time": "2023-08-05T15:44:26",
            "upload_time_iso_8601": "2023-08-05T15:44:26.315277Z",
            "url": "https://files.pythonhosted.org/packages/95/8f/cf25e54257e4c85442db5b1ae7686e38be604bf25993989c4211bb65a948/amdfan-0.1.26.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-05 15:44:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mcgillij",
    "github_project": "amdfan",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "amdfan"
}
        
Elapsed time: 0.10579s