Post
Topic
Board Mining software (miners)
Re: Any linux script for maintain GPU temp? (changing fan speed)
by
brunoshady
on 12/07/2011, 17:12:29 UTC
OK I think this is more what you want.

Code:
#!/bin/bash

MAXSPD=80
MINSPD=20

if [ $# -lt 2 ];
then
        echo "Usage: setfantemp.sh "
        exit 1
fi

DEVICE=$1
SETTEMP=$2

export DISPLAY=:0.${DEVICE}

while true;
do
        CURTEMP=`aticonfig --adapter=${DEVICE} --odgt | grep Temp | sed  's/.* \([0-9]*[0-9][0-9]\)\..*/\1/'`
        CURSPD=`aticonfig --pplib-cmd "get fanspeed 0" | grep Result | sed  's/.* \([0-9]*[0-9][0-9]\)\%.*/\1/'`

        echo -n "Set temp: ${SETTEMP}C Current temp: ${CURTEMP}C Current speed: ${CURSPD}% - "

        if [ "${CURTEMP}" -ne "${SETTEMP}" ]; then
                if [ "${CURTEMP}" -lt "${SETTEMP}" ]; then
                        NEWSPD=$((${CURSPD} - 1))
                        if [ "${NEWSPD}" -lt "${MINSPD}" ]; then
                                echo "MIN speed limit"
                        else
                                echo "Decreasing speed to ${NEWSPD}"
                                aticonfig --pplib-cmd "set fanspeed 0 ${NEWSPD}"
                        fi
                else
                        NEWSPD=$((${CURSPD} + 1))
                        if [ "${NEWSPD}" -gt "${MAXSPD}" ]; then
                                echo "MAX speed limit"
                        else
                                echo "Increasing speed to ${NEWSPD}"
                                aticonfig --pplib-cmd "set fanspeed 0 ${NEWSPD}"
                        fi
                fi
        else
                echo "Stable"
        fi
        sleep 10
done


Save to setfantemp.sh. To run:

Code:
# ./setfantemp.sh 0 55 &

That will set your target temperature for card 0 to 55C. The script will adjust the fan speed to hit that target.

Max fan speed and min fan speed are hard coded in the script to be 80% and 20% respectively. You can raise the max speed if your card isn't getting cooled to your target temp.



I didn't test yet, but seems good for my porpose... I will test later today, but I have one question.


this line is correct?


Code:
        CURSPD=`aticonfig --pplib-cmd "get fanspeed 0" | grep Result | sed  's/.* \([0-9]*[0-9][0-9]\)\%.*/\1/'`

the get fanspeed 0 part... is 0 for device?
if yes, I will just change it to 1 over device 2, correct?