aticonfig fan speeds
#1
I realized using the command:
env DISPLAY=:0.1 aticonfig --pplib-cmd "get fanspeed 0"

That the fan speed on my HD 5870 never went over 33%, even under heavy load. I set it to 70% manually and the temp went waaaaay down. Then I tried setting it to "auto" and the fan just stopped. Ouch!

Is there any way to set the fan speed back to auto-scale, or am I stuck setting it manually once I've touched it at all?

Also, this revelation that I can drastically improve cooling just by setting the fan speed on the card means I should be able to install a second card without any extra cooling. If I would have known that I would have bought a bigger PSU!
#2
ok, good info. we should add this to this wiki: http://hashcat.net/wiki/changing_fan_spe...nder_linux

seems the fan controller function in the amd driver is not working as we like it. they will have their reasons, but i think you are right. the cooler, the better.
#3
Sure. Until I get add to the wiki, here's how to set the fan speed:
env DISPLAY=:0.1 aticonfig --pplib-cmd "set fanspeed 0 70"

The important parts:
env <- Runs a shell command with the following variables set, so it doesn't affect the rest of your shell

DISPLAY=:0.1 <- Select GPU #2 (:0.0 would be GPU #1, :0.2 would be GPU #3, etc)

--pplib-cmd <- Undocumented aticonfig command, appears to directly interface with firmware on card

[get|set] fanspeed 0 <- I think the 0 is which register for the object (fanspeed), it appears 0 is the only valid value

70 <- Only necessary for "set", this is the percentage of maximum to set the fan speed to. I guess leaving the fan at very high value for a long time will burn it out. Use with caution.

I'm planning to write a small shell script to control my fan speed so I can increase it before using oclHashcat-* and reduce it once finished. Maybe it could work as a cron job that watches for oclHashcat processes and automatically increases the fan while processes found, and decreases the fan when no processes found. I'll have to think about the best way.

PS setting the fan to 70% (up from 33% it had selected on it's own) brought tempt down from 80c to 64c. That's a huge difference! I set it to 40% to keep it from burning out the fan while I figure out how to automate it.

Before I manually set the speed, I was watching it with 'get fanspeed 0' and it started at 20%, when oclHashcat-* was running it gradually went up to 33% and just stayed at 33%, even though the temp sensor showed 80c on the GPU.
#4
Isn't it's easier to use some script.sh with your fan commands, when you launch script with hashcat job, on top write 70% at the end 30% and all will be done ... I would never trust other software to monitor activity of some process to manage fan speed of these not cheap cards. If you had 2xHD6990 on one box your default settings would be 90% to be on 80c temp. Also brushless fans on such cards have resource for much higher voltage/wattage so even 100% can be less healthy just for ball bearings. If you still want something automatic - use software called AMDOverdrive. It will do all for you without any scripting.

p.s. besides, anyone noticed that new catalyst driver on linux allow to drop memory clock to 300mhz? Smile I mean without using any additional software, just aticonfig and you have less heat Smile
#5
(11-30-2011, 08:22 PM)KT819GM Wrote: Isn't it's easier to use some script.sh with your fan commands, when you launch script with hashcat job, on top write 70% at the end 30% and all will be done ...

Yes, but I'd have to create a script for each oclHashcat-* rather than just one. You have a good point though.

(11-30-2011, 08:22 PM)KT819GM Wrote: p.s. besides, anyone noticed that new catalyst driver on linux allow to drop memory clock to 300mhz? Smile I mean without using any additional software, just aticonfig and you have less heat Smile

Nice catch! The output of --odgc doesn't indicate that 300 is a valid value, but using --odsc it works!
#6
(11-30-2011, 08:22 PM)KT819GM Wrote: p.s. besides, anyone noticed that new catalyst driver on linux allow to drop memory clock to 300mhz? Smile I mean without using any additional software, just aticonfig and you have less heat Smile

cool, did not notice. i was forced to flash a modded bios, now i can switch back. thanks for info.


#7
BTW here's the shell script I use. Keep in mind I have two GPUs and this script only adjusts the second one (the first one has no fan). Do I need a separate account for the wiki?

Code:
#!/bin/bash

##
# atifan.sh v1.0
# by chort
##

# Which GPU device you're modifying. If you have only one GPU, it's 0
DEVICE=0

# If you have more than one GPU, change DISPLAY value to match the specific card
# :0.0 = device 1, :0.1 = device 2, :0.2 = device 3, etc.
# Cards with 2 GPUs (5970, 6990) might have two fans, which are treated as separate device
export DISPLAY=":0.${DEVICE}"

function usage {
        echo "Usage: $0 [get|set <%>]"
}

if [ -z "$1" ]
then  
        usage
fi

if [ X"$1" == "Xget" ]
then  
        aticonfig --pplib-cmd "get fanspeed 0"
        aticonfig --adapter=$DEVICE --odgt
fi

if [ X"$1" == "Xset" ]
then  
        if [ $2 -gt 9 2>/dev/null ] && [ $2 -lt 99 ]
        then  
                echo "Setting fanspeed to ${2}%"
                aticonfig --pplib-cmd "set fanspeed 0 $2"
                aticonfig --pplib-cmd "get fanspeed 0"
        else
                # Only values from 10% to 100% are valid
                usage
        fi
fi
#8
I've got 4 graphic cards so I felt the need to add some stuff in the code.

You can now set and get on all devices present at the same time plus some cosmetic changes and controls.

Feel free to comment on it.

Code:
#!/bin/bash

##
# atifan.sh v1.2
# by chort / splash_
##

# NB: Changing fan speed does not persist through reboots!

# Which GPU device you are modifying. If you have only one GPU, it's 0,
#  unless you have a multi-GPU card (5970, 6990) in which case you have
#  to set each separately (once for DEVICE=0, once for DEVICE=1).
# XXX Todo:     Make the script parameter-based (--device 2 --speed 70 etc)
# XXX Todo: Match the function getall output with the actual device number (the actual device ID sometimes doesn't follow the query order), e.g (default adapter - Device 0 - is actually the second GPU)
#
#            $ sudo aticonfig --lsa
#            * 0. 02:00.0 AMD Radeon HD 7900 Series
#              1. 01:00.0 AMD Radeon HD 7900 Series
#              2. 03:00.0 AMD Radeon HD 7900 Series
#              3. 04:00.0 AMD Radeon HD 7900 Series
#
#            * - Default adapter
# XXX Todo: exit if user tries to use device number higher than the number of devices present ()    

DEFAULT_DEVICE=0    # this is the fallback for the default device. Change it if yours is not 0
OPERATOR="$1"         
DEVICE="$2"        
VALUE="$3"           
TOTALDEV=$((`sudo aticonfig --lsa | wc -l` - 2)) # total number of devices. Currently working on Catalyst 12.6

function usage {
        echo "Usage:  [get <dev#> | set <dev#> <speed%> | setall <speed%> | getall]"
    echo ""
    echo "get        Retrieve fanspeed and temperature from specific GPU. If no device is specified, default if device #0"         
    echo "set        Set fanspeed of a specific GPU. If no device is specified, default if device #0"
    echo "setall        Set the same value of fanspeed across all devices"
    echo "getall        Get temperature and fanspeed of all devices"
    echo ""
    echo "dev#        Device Number. For first GPU dev=0, Second GPU dev=1, etc.."
    echo "speed        Fanspeed in percentage (value from 10 to 99).    "
    echo ""

}

function setValue () {
# set value for one device.  = device and  = value

        if [  -gt 9 2>/dev/null ] && [  -lt 100 ]
        then
                export DISPLAY=":0.${1}"
                aticonfig --pplib-cmd "set fanspeed 0 " 1>/dev/null # remove output to /dev/null if you want the output of pplib
                QUERY_RESULT=`aticonfig --pplib-cmd "get fanspeed 0" | grep "Result"`
                echo "| DEVICE #${1}: ${QUERY_RESULT}"
        else
                # Only values from 10% to 100% are valid
                usage
                exit 1
        fi
}

function getValue () {
#prints info for one specific device. Accepts one parameter (device number)

    if [ -z "" ]
    then
            exit 1
    fi

        export DISPLAY=:0.
        QUERY_RESULT1=`aticonfig --pplib-cmd "get fanspeed 0" | grep Result | sed 's/Result\: //'`
        QUERY_RESULT2=`aticonfig --adapter= --odgt | grep Sensor | sed 's/^[ \t]*//' | sed 's/Sensor 0\: //'`   # sed command just cosmetic to remove the whitespaces from beginning of line
        echo "| DEVICE #${1}: ${QUERY_RESULT1} / ${QUERY_RESULT2}"
}



# if operation not defined (get, set or setall)
if [ -z "$OPERATOR" ]
then      
    usage
    exit 1
fi

if [ X"$OPERATOR" == "Xget" ]
then
        if [ -z "$DEVICE"  ]
       then
                DEVICE=$DEFAULT_DEVICE
                echo "Using default device #${DEFAULT_DEVICE}"
        fi


    echo ""
        echo "| Getting fanspeed and temperature of device #${DEVICE} ..."
    getValue $DEVICE
    echo ""
fi

if [ X"$OPERATOR" == "Xset" ]
then
    if [ -z "$VALUE"  ]    # if device# is not specified, then VALUE is empty ()
    then        
        DEVICE=$DEFAULT_DEVICE
        VALUE=$2
        echo "Using default device #${DEFAULT_DEVICE}"
    fi

    echo ""
    echo "| Setting fanspeed of device #${DEVICE} to ${VALUE}% ..."
    setValue $DEVICE $VALUE
    echo ""
fi

if [ X"$OPERATOR" == "Xsetall" ]
then
VALUE="$2"

        if [ -z "$VALUE"  ]
        then    
        usage
        exit 1
            
        fi

    echo ""
        echo "| Setting fanspeed of all devices to ${VALUE}% ..."

        for (( i = 0; i < $TOTALDEV  ; i++ ))
        do
        setValue $i $VALUE
        done
    echo ""

fi

if [ X"$OPERATOR" == "Xgetall" ]
then
        echo ""
        echo "| Getting fanspeed and temperature of all devices ..."

    for (( i = 0; i < $TOTALDEV  ; i++ ))
        do
        getValue $i    
        done
    echo ""
fi

I don't have access to the wiki so after further evaluation from the community, please, update it there.