Bitcoin Forum
May 05, 2024, 01:38:08 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: gpu-temp-monitor: an optimum clocking tool for AMD GPUs  (Read 1804 times)
mikegogulski (OP)
Sr. Member
****
Offline Offline

Activity: 360
Merit: 250



View Profile WWW
June 07, 2011, 04:50:27 PM
 #1

I got inspired by this other thread (http://forum.bitcoin.org/index.php?topic=10062.msg167868#msg167868) and wrote a bash script to manage GPU core clocks versus temperature. gpu-temp-monitor supports up to 8 AMD GPUs (or more, by editing the initialization of the "holds" array).

The script assumes that you have DISPLAY and whatnot set up correctly in your environment, and that you've opened up a nice range for over/underclocking with AMDoverdrivectrl or similar.

Code:
#!/bin/bash

TEMP_HIGH=95 # degrees C
FREQ_MAX=900 # MHz
FREQ_STEP_UP=5 # MHz
FREQ_STEP_DOWN=30 # MHz
MEM_FREQ=150 # MHz
HOLD_TIME=15 # sec
TOLERANCE=2 # degrees C
IGNORE_TEMP=$((TEMP_HIGH-TOLERANCE))
OUTPUT_INTERVAL=1 # sec

holds=( 0 0 0 0 0 0 0 0 )

setclock() {
id=$1
clock=$2
if [ $clock -gt $FREQ_MAX ]; then
clock=$FREQ_MAX
fi
aticonfig --adapter=$id --odsc=$clock,$MEM_FREQ 2>&1 > /dev/null
holds[$id]=$HOLD_TIME
}

reclock() {
id=$1
temp=$2
clock=$3
flag='-'
hold=${holds[$id]}
if [ $hold -gt 0 ]; then
holds[$i]=$((${holds[$id]}-OUTPUT_INTERVAL))
elif [ $temp -ge $TEMP_HIGH ]; then
setclock $id $((clock-FREQ_STEP_DOWN))
flag='v'
elif [ $clock -lt $FREQ_MAX -a $temp -lt $IGNORE_TEMP ]; then
setclock $id $((clock+FREQ_STEP_UP))
flag='^'
fi
echo -n "$temp ($clock$flag) "
}

aticonfig --od-enable 2>&1 > /dev/null

while true
do
unset T
unset C
temps=`aticonfig --adapter=all --odgt | grep : | sed 's/.* - \([0-9]*\)\..*/\1/'`
clocks=`aticonfig --adapter=all --odgc | grep "Current Peak" | sed 's/.*: *\([0-9]*\) .*/\1/'`
i=0
for val in $temps; do
T[$i]=$val
i=$((i+1))
done

i=0
for val in $clocks; do
C[$i]=$val
i=$((i+1))
done

i=0
while [ $i -lt ${#T[*]} ]; do
reclock $i ${T[$i]} ${C[$i]}
i=$((i+1))
done

echo
sleep $OUTPUT_INTERVAL
done

And the mandatory megascreenshot:


FREE ROSS ULBRICHT, allegedly one of the Dread Pirates Roberts of the Silk Road
1714873088
Hero Member
*
Offline Offline

Posts: 1714873088

View Profile Personal Message (Offline)

Ignore
1714873088
Reply with quote  #2

1714873088
Report to moderator
1714873088
Hero Member
*
Offline Offline

Posts: 1714873088

View Profile Personal Message (Offline)

Ignore
1714873088
Reply with quote  #2

1714873088
Report to moderator
"If you don't want people to know you're a scumbag then don't be a scumbag." -- margaritahuyan
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
HudsonStan
Newbie
*
Offline Offline

Activity: 34
Merit: 0


View Profile
June 08, 2011, 10:36:17 AM
 #2

Nice bash script. Thanks for share.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!