Package: amdfan
AmdFanIs 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 abandonedlacking required featuressecurity fixes not addressedbasic functionality not workingAmdgpu_fan abandonedAs 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 missingThere are a number of features that I wanted, but were not available.Thresholds allow temperature range before changing fan speedFrequency setting to allow better controlMonitoring to be able to see real-time fan speeds and temperatureSecurity FixesThere 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 functionalitySetting 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.DocumentationUsageUsage:amdfan.py[OPTIONS]Options:--daemonRunasdaemonapplyingthefancurve--monitorRunasamonitorshowingtempandfanspeed--manualManuallysetthefanspeedvalueofacard--configurationPrintsoutthedefaultconfigurationforyoutouse--servicePrintsouttheamdfan.servicefiletousewithsystemd--helpShowthismessageandexit.DaemonAmdfan is also runnable as a systemd service, with the providedamdfan.service.MonitorYou can use Amdfan to monitor your AMD video cards using the--monitorflag.ManualAlternatively 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.ConfigurationThis will dump out the default configuration that would get generated for/etc/amdfan.ymlwhen you first run it as a service. This allows you to configure the settings prior to running it as a daemon if you wish.Runningamdfan --configurationwill output the following block to STDOUT.#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:]]$"`# - card0You can use this to generate your configuration by doingamdfan --configuration > amdfan.yml, you can then modify the settings and place it in/etc/amdfan.ymlfor when you would like to run it as a service.ServiceThis is just a convenience method for dumping out theamdfan.servicethat would get installed if you used a package manager to install amdfan. Useful if you installed the module viapip,pipenvorpoetry.Runningamdfan --servicewill output the following block to STDOUT.[Unit]Description=amdfancontroller[Service]ExecStart=/usr/bin/amdfan--daemonRestart=always[Install]WantedBy=multi-user.targetNoteMonitoring fan speeds and temperatures can run with regular user permissions.rootpermissions are required for changing the settings / running as a daemon.Recommended settingsBelow 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.ymlspeed_matrix:
-[4,4]-[30,33]-[45,50]-[60,66]-[65,69]-[70,75]-[75,89]-[80,100]threshold:4frequency:5Installing the systemd serviceIf you installed via the AUR, the service is already installed, and you just need tostart/enableit. If you installed via pip/pipenv or poetry, you can generate your systemd service file with the following command.amdfan--service>amdfan.service&&sudomvamdfan.service/usr/lib/systemd/system/Starting the systemd serviceTo run the service, you can run the following commands tostart/enablethe service.sudosystemctlstartamdfan
sudosystemctlenableamdfanAfter 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.sudosystemctlrestartamdfanChecking the statusYou can check the systemd service status with the following command:systemctlstatusamdfanBuilding Arch AUR packageBuilding the Arch package assumes you already have a chroot env setup to build packages.gitclonehttps://aur.archlinux.org/amdfan.gitcdamdfan/
makechrootpkg-c-r$HOME/$CHROOTInstalling the Arch packagesudopacman-U--asdepsamdfan-*-any.pkg.tar.zstInstalling from PyPiYou can also install amdfan from pypi using something like poetry.poetryinit
poetryaddamdfan
poetryrunamdfan--helpBuilding Python packageRequirespoetryto be installedgitclonegit@github.com:mcgillij/amdfan.gitcdamdfan/
poetrybuild