HasLuxHasLux Member Posts: 48
Greetings to all of you,

I just uploaded the initial alpha version of my set fan speeds utility for AMDGPUPRO linux drivers. It's in bash script right now as i'm using bash script for prototyping. My next project will be much more complex and be in C++ but this is something some of you need to not burn up your GPU's.

Right now it defaults to putting all your GPU fans to 75% speed. Over the coming week or two I will add flags for adjusting the fans. You do need to run this as root or with the sudo command. If you open it up in a text editor(My favorite is vi) you can modify the default fan speed variable if you don't like 75% speeds for now. By the time it gets to beta it will run in the background and adjust your fans dynamically based on a temperature target. But i'm atleast a week away from having that release ready. I'll be adding features regularly until the completion of my prototype. I.E. Proof of concept. Once that's done i'll modify the syntax to c++ instead of bash for a full fledged daemon.

Enjoy :)


  • StreetlightStreetlight Member Posts: 23
    [email protected]:~/amdgpu-pro-fans$ sudo ./ --speed=40./ 183: ./ [[: not found
    ./ 154: cd: can't cd to /sys/class/drm/card1/device/hwmon/hwmon*

    * Request Returned Errors *

    ERROR: Could not locate device Card1

    ./ 125: ./ pause: not found
    [email protected]:~/amdgpu-pro-fans$

    In a 2 card system....
  • HasLuxHasLux Member Posts: 48
    Do you have the amdgpu pro driver installed? or are you using fglrx drivers? If you have the amdgpu-pro driver please provide me with the output of the following command (I know about the pause thing)

    ls /sys/class/drm/
    and provide me with the output of this command
    ls /sys/class/drm/card1/device/hwmon

    I'll figure out another way of doing it besides using the "*" in the bash script. It must be a compatibility issue between different kernels where by some do not accept the *. It should be easy to fix. I'll just have to code a function to parse the directory instead of relying on the hope that everyones linux box is configured to support the * symbol when using the CD command. Thank you for showing this to me. It helps me improve upon the code. That's why i'm doing it in bash script first before commiting the code to c++ because when creating a good application you have to consider as many possibilities as you can and program to handle those so the results will be as desired. If you dont and a program does something unexpected as in this case it's not nessicerily a bug but the failure of the programmer to take into account that particular situation. I will apply a patch soon for my next update but help help me the output of those commands will be wonderful.

    Thank You :)
  • StreetlightStreetlight Member Posts: 23
    edited October 2016
    Hi there. am a liunx newbie btw.

    these are the outputs.

    [email protected]:~/amdgpu-pro-fans$ ls /sys/class/drm/
    card0 card1-DP-4 card1-VGA-1 controlD64 ttm
    card0-DP-1 card1-DP-5 card2 controlD65 version
    card0-DP-2 card1-DP-6 card2-DP-7 controlD66
    card0-DP-3 card1-HDMI-A-2 card2-DVI-D-1 renderD128
    card0-HDMI-A-1 card1-HDMI-A-3 card2-DVI-D-2 renderD129
    card1 card1-HDMI-A-4 card2-HDMI-A-5 renderD130


    ls: cannot access '/sys/class/drm/card1/device/hwmon': No such file or directory

    I have about 5 Linux boxes with Amdgpu pro. obv this was the first box i wanted to try out with it.
  • HasLuxHasLux Member Posts: 48
    What linux kernel are you running and distro? I wrote it on ubuntu 14.04 platform but tested in ubuntu 16. All headless server environments with AMD gpu pro installed.
    cd into /sys/class/drm/card1
    ls that directory. If you have a directory called "device" cd into it and ls that.
    In the ls out put of the device dir do you see a directory that says hwmon? I only ask because I have had 20 people message me and tell me it's working great. So I think it might be a kernel or distribution issue that's different. Either way id like to know what you find if you have a hwmon directory or something similar to that. That way if there is some difference from one kernel version to another I can easily account for that.

  • StreetlightStreetlight Member Posts: 23
    edited November 2016
    [email protected]:~/amdgpu-pro-fans# ./ --speed=75-90 echo: write error: Invalid argument
    echo: write error: Invalid argument

    * Request Returned Errors *

    ERROR: could not set fan speed for Card0\n ERROR: could not set fan speed for Card3\n
    ./ line 125: pause: command not found
    [email protected]:~/amdgpu-pro-fans#

    getting this on one of my mining rigs. running 16.04

  • HasLuxHasLux Member Posts: 48
    It works fine for me on UBUNTU 16.04... However, I just pushed a major update to the master branch that should make it more portable across multiple systems. I noticed you ran it as root. That's not needed. sudo will work as well unless you just use a root login normally. Also --speed=75-90 is not correct. The correct way to call this is
    sudo ./ -s 50

    it's not a range but a specific speed. I am working on a dynamic version where by you specify a target temperature and it will do the rest for you in real time without the need for chron or anything like that. But I have yet to write the algorythm for it. The most recent version 0.1.3 is still alpha and the update has not even been tested yet. I was going to copy the new version over to one of my rigs in a little while to test it.

    What AMD Card style is it? I have an inventory of about any card you can imagine so it could be specific to one model. I.E. R9 380, 390... I've only tested this script with the RX Series but was planning on upgrading one of my R9 Rigs to 16.04 with AMD GPU Pro drivers later tonight. I've been getting a lot of random crashes on that rig latley but it's using the depricated fglrx drivers so I have a feeling a recent apt-get upgrade caused some sort of incompatibility issue with the old drivers. In fact, i'm going to go do the upgrade right now. In the meantime git clone the updated version of the repository and try out that bash script. If your pretty unix savy (As bash originates from unix) feel free to have a look at the script and see what "files" it's writing to. It could also be that your cards manufacturer has BIOS Locked adjusting the fan speeds. Since when it's writing to the file it's really writing the information to the cards temporary memory, there could be an issue with that. There is one possible workaround if that is the case which is to add yourself to the video group with the following command

    sudo gpasswd -a $(whoami) video

    As far as card 0 and card 3 i'm wondering if these are integrated graphics that the kernel is picking up and placing in that folder. I may have to utilize the lspci | grep VGA and get eligible card data from their. If their not integrated graphics are they different than the other cards on your system. If you provide me with the output of these 2 commands it will help me understand your system configuration better in troubleshooting this.

    lspci | grep VGA

    The output of those commands will provide me all the information I should need to figure out what the problem may be.
  • HasLuxHasLux Member Posts: 48
    UPDATE: The most recent update will not resolve your problem. I installed 16.04 and amd-gpu-pro on an older rig of mine with R9 series cards and encounted the same error you were. I was able to track down the issue which is a difference in how the driver sets certain permissions on a kernel level for different card types. I was able to take about 5 minutes and manually set my fan speeds without the script. In doing this I now have a work around to include in my next revision. I sent you a PM about this as well. Thanks for making me aware of this. It will be corrected soon. I already have to steps down and the code is in my head just waiting for me to put it into the digital world.
  • StreetlightStreetlight Member Posts: 23
    edited November 2016
    The Problem was with the R9 cards, as in that rig i had 4 r9 380 and two r9 390, it would set the fans on the 380's but not the 390s.

    had no problems with my 470's and 480's Rig with this program.

    Thanks for your help by the way.

    [email protected]:~/amdgpu-pro-fans# git pull
    remote: Counting objects: 18, done.
    remote: Compressing objects: 100% (12/12), done.
    remote: Total 18 (delta 9), reused 15 (delta 6), pack-reused 0
    Unpacking objects: 100% (18/18), done.
    89f802a..5c8db80 master -> origin/master
    * [new branch] Development -> origin/Development
    Updating 89f802a..5c8db80
    error: Your local changes to the following files would be overwritten by merge:
    Please, commit your changes or stash them before you can merge.
    [email protected]:~/amdgpu-pro-fans#

    Should I just rename the folder and re download it?
  • HasLuxHasLux Member Posts: 48
    Check out my development branch. It has the fix in place already. I havent tested the script but it uses a simple technique to work around this issue with the r9 series cards and the driver whereby the kernel wouldnt even allow the root user to change the fan speeds. Reading what youve wrote you can either create a new folder and clone the development branch. That branch has the modifications but there are a lot of code changes in it so I need to do some testing on it myself before I merge it to the master branch. If your having trouble with git clone you can alternativly go directly to my github page and just browse to the development branch and download the .sh file directly. If the machine is headless a simple copy over via sftp is an easy solution. I havent used git hub very long so developing in that environment is a little new to me. I'm certain the developer branch will work with both the rx and the r9 cards. Oh and the call is a little different now. -s fan%
    I simplified it. I.E. -s 50
    that would set you fan speed to 50% of it's maximum capacity because it now reads from a config file on the divice what the maximum fan speed is. I've been adding and modifying features almost daily which is why I forked it into a development branch for testing code before merging to the master.
  • HasLuxHasLux Member Posts: 48
    The master branch has now been fully tested on ubuntu 16.04 and is compatible with all AMD Cards that support the AMDGPU-PRO graphics driver. Also the -s flag has been fully implemented so it's easy to adjust your fan speeds through the command line now.
  • OverconOvercon Member Posts: 37
    HasLux said:

    Greetings to all of you,

    I just uploaded the initial alpha version of my set fan speeds utility for AMDGPUPRO linux drivers. It's in bash script right now as i'm using bash script for prototyping. My next project will be much more complex and be in C++ but this is something some of you need to not burn up your GPU's.

    Do you have one for the Core Clock Speeds and Memory Clock Speeds as well? That would be just what I need!

    Also you might want to add a handler for accounting for on board video cards like the AMD CPU's have. My CPU has a Radeon R7 built into it that errors on the script, no fan.

    head: cannot open '/sys/class/drm/card0/device/hwmon/hwmon0/pwm1_max' for reading: No such file or directory ./ line 58: [: -gt: unary operator expected Error: Unable To Determine Maximum Fan Speed For Card0!

    All these goodies added to the script please :) hehe:/sys/class/drm/card1/device

    -rw-r--r-- 1 root root 4096 Jan 16 13:43 power_dpm_force_performance_level
    -rw-r--r-- 1 root root 4096 Jan 16 13:43 power_dpm_state
    -r--r--r-- 1 root root 4096 Jan 16 13:43 pp_cur_state
    -rw-r--r-- 1 root root 4096 Jan 16 13:43 pp_dpm_mclk
    -rw-r--r-- 1 root root 4096 Jan 16 13:43 pp_dpm_pcie
    -rw-r--r-- 1 root root 4096 Jan 16 13:43 pp_dpm_sclk
    -rw-r--r-- 1 root root 4096 Jan 16 13:43 pp_force_state
    -rw-r--r-- 1 root root 4096 Jan 16 13:43 pp_mclk_od
    -r--r--r-- 1 root root 4096 Jan 16 13:43 pp_num_states
    -rw-r--r-- 1 root root 4096 Jan 16 13:43 pp_sclk_od
    -rw-r--r-- 1 root root 4096 Jan 16 13:43 pp_table
  • midoprincemidoprince Member Posts: 198 ✭✭
    what is ur speed plz ?
Sign In or Register to comment.