Author

Topic: Automatic temperature/clock speed control (Read 4170 times)

full member
Activity: 140
Merit: 100
August 17, 2011, 08:41:16 PM
#14
I like this security improvement! Smiley

Am I right that if the current clock is below 500 it will not speed up again?

Code:
            elif [ "$curclk" -lt "500" ]; then
                echo "Adapter $i is idle"

What is the purpose of that?

When my miners went idle the clock would drop to 250MHz. Since the script is (intentionally) stateless, it would attempt to speed the GPUs up and write 251MHz. This was accepted as 500MHz (the minimum clock speed for the 6970). When the miner was started, it would slowly increase speed from 500MHz to 940MHz, taking approximately 1 hour to reach full speed.
member
Activity: 65
Merit: 10
August 17, 2011, 03:04:33 PM
#13
I like this security improvement! Smiley

Am I right that if the current clock is below 500 it will not speed up again?

Code:
            elif [ "$curclk" -lt "500" ]; then
                echo "Adapter $i is idle"

What is the purpose of that?
newbie
Activity: 41
Merit: 0
August 15, 2011, 04:25:16 PM
#12
ok, i will try that script, will be reporting, thank you anyway
full member
Activity: 140
Merit: 100
August 15, 2011, 08:01:22 AM
#11
how do I specify clocks and max temperatures for each adapter ?

is it like this ?

Code:
TARGETTEMP=(88 90 92 89)
MAXCLOCK=(940 930 900 920)


Yes, that is exactly right. If you have more adapters than numbers, the last number will be used for all remaining adapters.
newbie
Activity: 41
Merit: 0
August 15, 2011, 04:26:50 AM
#10
how do I specify clocks and max temperatures for each adapter ?

is it like this ?

Code:
TARGETTEMP=(88 90 92 89)
MAXCLOCK=(940 930 900 920)
full member
Activity: 140
Merit: 100
August 10, 2011, 10:41:32 PM
#9
bcforum, can you modify your script to control only specified adapter ?

this could be useful in cases when user have different clocks for cards

Take a look at the OP. I haven't tested it much.
newbie
Activity: 41
Merit: 0
August 10, 2011, 06:29:18 AM
#8
bcforum, can you modify your script to control only specified adapter ?

this could be useful in cases when user have different clocks for cards
sr. member
Activity: 406
Merit: 250
August 04, 2011, 11:27:15 AM
#7
For anyone who wants a silent box I modified this to adjust fan speed as a second priority to speed. As well as a few display tweaks

FYI, I saw issues with executing pplib commands while mining. Occasionally, the hash rate would drop ~20% on one of the adapters, then recover. There seems to be some interaction between phoenix and aticonfig that I haven't had time to dig into.


I've seen that as well, when pushing the mhz wall (usually get a few bad shares at that speed too). However, I'm running this script with cgminer and 4x6870s, there are tiny, quick dips in hashrates but usually only when overheating. I'd rather turn up the fans and have a 1sec dip then downclock as a priority.

I use it and have no issues, so I shared Wink YMMV
full member
Activity: 140
Merit: 100
August 04, 2011, 06:26:15 AM
#6
For anyone who wants a silent box I modified this to adjust fan speed as a second priority to speed. As well as a few display tweaks

FYI, I saw issues with executing pplib commands while mining. Occasionally, the hash rate would drop ~20% on one of the adapters, then recover. There seems to be some interaction between phoenix and aticonfig that I haven't had time to dig into.
sr. member
Activity: 406
Merit: 250
August 04, 2011, 12:25:16 AM
#5
For anyone who wants a silent box I modified this to adjust fan speed as a second priority to speed. As well as a few display tweaks

Code:
#!/bin/bash
#version 0.011

TARGETTEMP=81
TARGETFAN=60
MAXFAN=80
MAXCLOCK=960

# Get number of adapters
export DISPLAY=:0
num=`aticonfig --adapter=all --odgt | grep Temperature | wc | awk -- '{ print $1 }'`

# Set all adapters to maximum clock speed
for (( i=0; i<$num; i++ )) do
    export DISPLAY=:0.$i
    aticonfig --od-enable
    aticonfig --odsc=$MAXCLOCK,0 --adapter=$i
    aticonfig --adapter=$i --pplib-cmd "set fanspeed 0 $TARGETFAN"
done

#
while true; do
    sleep 10
    clear
    date

    for (( i=0; i<$num; i++ )) do
    echo ">>>>>> Adapter $i <<<<<<"
        export DISPLAY=:0.$i

        # Collect current clock speed/temperature
        curtemp=`aticonfig --adapter=$i --odgt | grep "Sensor 0:" | tr -s ' ' | cut -f 6 -d ' ' | cut -f 1 -d '.'`
        curclk=`aticonfig --adapter=$i --odgc | grep "Current Clocks"|tr -s ' '|cut -f 5 -d ' '`
        curfan=`aticonfig --pplib-cmd "get fanspeed 0" | grep "Fan Speed:" | tr -s ' '|cut -f 4 -d ' '|cut -f 1 -d '%'`

        # Status
        echo "clock:${curclk}, Temp:${curtemp}C, Fan:${curfan}%"
        # Lower clock if too hot, raise clock if to slow
        if [ "$curtemp" -gt "$TARGETTEMP" ]; then
                if [ "$curfan" -lt "$MAXFAN" ]; then
                        echo "Over target temperature, speeding up fan"
                        let "curfan += 5"
                        aticonfig --adapter=$i --pplib-cmd "set fanspeed 0 $curfan" > /dev/null
                else
                    echo "Over target temperatre, lowering clock speed"
                    let "curclk -= 1"
                    aticonfig --adapter=$i --odsc=$curclk,0 > /dev/null
                fi
        elif [ "$curtemp" -eq "$TARGETTEMP" ]; then
                echo "Adapter is at target temp"
        elif [ "$curclk" -lt "$MAXCLOCK" ]; then
            echo "Adapter can run faster, speeding it up"
            let "curclk += 1"
            aticonfig --adapter=$i --odsc=$curclk,0 > /dev/null
        else    
            if [ "$curfan" -gt "$TARGETFAN" ]; then
                echo "Lowering fan speed"
                let "curfan -= 1"
                aticonfig --adapter=$i --pplib-cmd "set fanspeed 0 $curfan" > /dev/null
            else
                echo "Adapter is at optimal targets"
            fi

        fi
        echo " "
    done
done

sr. member
Activity: 1204
Merit: 288
August 02, 2011, 06:49:18 PM
#4
We could make something similar in windows... Would be GUI application for easier settings, or a simple console with .ini file for settings... I might look at it doing something like this soon.
full member
Activity: 140
Merit: 100
August 02, 2011, 07:31:40 AM
#3
Nice.. Any way to port this to a windows app?

Unfortunately, I don't know if ATI offers a command line version in Windows. Something similar could be written (the logic is very simple) but I don't have a platform to develop it on.
full member
Activity: 174
Merit: 100
August 02, 2011, 01:32:44 AM
#2
Nice.. Any way to port this to a windows app?
full member
Activity: 140
Merit: 100
August 01, 2011, 05:26:09 PM
#1
Since my miners run unattended in unconditioned space I need to insure they don't get too hot and shutdown (or burn out), so I wrote this script (derived in small part from gputempmon.sh by myrond) to automatically lower the clock if the chip gets too hot, or raise the clock if it is below the maximum frequency.

Code:
#!/bin/bash
#version 0.01

TARGETTEMP=88
MAXCLOCK=940
MINCLOCK=500

# Get number of adapters
export DISPLAY=:0
num=`aticonfig --adapter=all --odgt | grep Temperature | wc | awk -- '{ print $1 }'`

# Set all adapters to maximum fan speed
for (( i=0; i<$num; i++ )) do
    export DISPLAY=:0.$i
    aticonfig --od-enable
    aticonfig --adapter=$i --pplib-cmd "set fanspeed 0 99"
done

#
while true; do
    sleep 10
    clear
    date

    for (( i=0; i<$num; i++ )) do
        export DISPLAY=:0.$i

        # Collect current clock speed/temperature
        curtemp=`aticonfig --adapter=$i --odgt | grep "Sensor 0:" | tr -s ' ' | cut -f 6 -d ' ' | cut -f 1 -d '.'`
        curclk=`aticonfig --adapter=$i --odgc | grep "Current Clocks"|tr -s ' '|cut -f 5 -d ' '`

# Status
echo "Adapter $i clock:${curclk}, Temp:${curtemp}C"
        # Lower clock if too hot, raise clock if to slow
        if [ "$curtemp" -gt "$TARGETTEMP" ]; then
            echo "Adapter $i is overheating, slowing it down"
            let "curclk -= 1"
            aticonfig --adapter=$i --odsc=$curclk,0 > /dev/null
        elif [ "$curtemp" -eq "$TARGETTEMP" ]; then
   echo "Adapter $i at target temp"
        elif [ "$curclk" -lt "$MINCLOCK" ]; then
            echo "Adapter $i is idle"
        elif [ "$curclk" -lt "$MAXCLOCK" ]; then
            echo "Adapter $i can run faster, speeding it up"
            let "curclk += 1"
            aticonfig --adapter=$i --odsc=$curclk,0 > /dev/null
        else
   echo "Adapter $i at maximum clock"
        fi
    done
done

A new version that allows different speeds/temps/enables for adapters (only lightly tested):

Code:
#!/bin/bash
#version 0.03

# The parentheses make these variables into arrays
# The arrays will be padded with the last value in each line
ENABLE=(1 0)
TARGETTEMP=(88)
MAXCLOCK=(940 940)

# Get number of adapters
export DISPLAY=:0
num=`aticonfig --adapter=all --odgt | grep Temperature | wc | awk -- '{ print $1 }'`

# Find the last element in each array, then pad to the number of adapters
i=0
for tmp in ${ENABLE[@]} ; do
    let "i += 1"
done
for (( j=i; j<$num; j++ )) do
    ENABLE[j]=$tmp
done
i=0
for tmp in ${TARGETTEMP[@]} ; do
    let "i += 1"
done
for (( j=i; j<$num; j++ )) do
    TARGETTEMP[j]=$tmp
done
i=0
for tmp in ${MAXCLOCK[@]} ; do
    let "i += 1"
done
for (( j=i; j<$num; j++ )) do
    MAXCLOCK[j]=$tmp
done

# Set all adapters to maximum clock speed
for (( i=0; i<$num; i++ )) do
    if [ "${ENABLE[i]}" -eq "1" ]; then
        export DISPLAY=:0.$i
        aticonfig --od-enable
        aticonfig --adapter=$i --pplib-cmd "set fanspeed 0 99"
    fi
done

#
while true; do
    sleep 10
    clear
    date

    for (( i=0; i<$num; i++ )) do
        if [ "${ENABLE[i]}" -eq "1" ]; then
            export DISPLAY=:0.$i

            # Collect current clock speed/temperature
            curtemp=`aticonfig --adapter=$i --odgt | grep "Sensor 0:" | tr -s ' ' | cut -f 6 -d ' ' | cut -f 1 -d '.'`
            curclk=`aticonfig --adapter=$i --odgc | grep "Current Clocks"|tr -s ' '|cut -f 5 -d ' '`

    # Status
    echo "Adapter $i clock:${curclk}, Temp:${curtemp}C"
            # Lower clock if too hot, raise clock if to slow
            if [ "$curtemp" -gt "${TARGETTEMP[i]}" ]; then
                echo "Adapter $i is overheating, slowing it down"
                let "curclk -= 1"
                aticonfig --adapter=$i --odsc=$curclk,0 > /dev/null
            elif [ "$curtemp" -eq "${TARGETTEMP[i]}" ]; then
        echo "Adapter $i at target temp"
            elif [ "$curclk" -lt "500" ]; then
                echo "Adapter $i is idle"
            elif [ "$curclk" -lt "${MAXCLOCK[i]}" ]; then
                echo "Adapter $i can run faster, speeding it up"
                let "curclk += 1"
                aticonfig --adapter=$i --odsc=$curclk,0 > /dev/null
            else
        echo "Adapter $i at maximum clock"
            fi
        fi
    done
done
Edit: Added idle detection to stop adjusting clock when slowed down
Jump to: