Bitcoin Forum
December 10, 2016, 01:30:05 AM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: gpu-temp-monitor: an optimum clocking tool for AMD GPUs  (Read 1607 times)
mikegogulski
Sr. Member
****
Offline Offline

Activity: 360



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
1481333405
Hero Member
*
Offline Offline

Posts: 1481333405

View Profile Personal Message (Offline)

Ignore
1481333405
Reply with quote  #2

1481333405
Report to moderator
1481333405
Hero Member
*
Offline Offline

Posts: 1481333405

View Profile Personal Message (Offline)

Ignore
1481333405
Reply with quote  #2

1481333405
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481333405
Hero Member
*
Offline Offline

Posts: 1481333405

View Profile Personal Message (Offline)

Ignore
1481333405
Reply with quote  #2

1481333405
Report to moderator
1481333405
Hero Member
*
Offline Offline

Posts: 1481333405

View Profile Personal Message (Offline)

Ignore
1481333405
Reply with quote  #2

1481333405
Report to moderator
1481333405
Hero Member
*
Offline Offline

Posts: 1481333405

View Profile Personal Message (Offline)

Ignore
1481333405
Reply with quote  #2

1481333405
Report to moderator
HudsonStan
Jr. Member
*
Offline Offline

Activity: 34


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

Nice bash script. Thanks for share.

1Bgii2mFTks2xbtF7RBk6ZzSTP5rvyQEKB
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!