Bitcoin Forum
May 05, 2024, 04:56:00 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Script to lower clock when overheating  (Read 2249 times)
rethaw (OP)
Sr. Member
****
Offline Offline

Activity: 378
Merit: 255



View Profile
July 02, 2011, 04:39:53 AM
Last edit: July 03, 2011, 07:14:10 AM by rethaw
 #1

This script when left running will check the temperature on your first GPU, and if it is higher than a temperature you choose will clock it down in steps of 20. You will need the latest drivers to clock outside the stock range. If it doesn't cool before reaching the lowerbound it will kill your miners (python or poclbm). Automated changing of your clocks is not always advisable, but this has been tested to work independently by myself and one other miner. Thanks to Cyis on #bitcoin-mining.

Code:
lowerbound=300 ; hightemp=80; while : ; do if [ "`aticonfig --odgt --adapter=0 | grep -o '[0-9][0-9].[0-9][0-9]' | sed 's/\.[0-9][0-9]//g'`" -gt "$hightemp" ] ; then echo "TOO HOT" ; aticonfig --odsc $(expr `aticonfig --odgc --adapter=0 | grep Clocks | awk '{print $4}'` - 20),$(aticonfig --odgc --adapter=0 | grep Clocks | awk '{print $5}') --adapter=0 ; fi ; if [ "`aticonfig --odgc --adapter=0 | grep Clocks | awk '{print $4}'`" -lt "$lowerbound" ] ; then echo "Just too hot, stopping mining" ; killall poclbm.py ; killall phoenix.py ; exit ; fi ; sleep 30s; done

Here is a one-liner that will kill your miners if the temp goes above your chosen temperature. Works for phoenix or poclbm, leave it running in a terminal when you think there may be a risk of overheating. Just change the temp to what you want. I set it to 80 (-gt "80").

Code:
running=true ; while $running ; do if [ "`aticonfig --odgt --adapter=0 | grep -o '[0-9][0-9].[0-9][0-9]' | sed 's/\.[0-9][0-9]//g'`" -gt "80" ] ; then echo "TOO HOT" ; killall poclbm.py ; killall phoenix.py ; running=false ; fi ; sleep 30s; done

If there is interest I can post a version that will turn it back on when it reaches the desired temperature.

Good luck!

The Bitcoin network protocol was designed to be extremely flexible. It can be used to create timed transactions, escrow transactions, multi-signature transactions, etc. The current features of the client only hint at what will be possible in the future.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
shotgun
Member
**
Offline Offline

Activity: 98
Merit: 11



View Profile
July 02, 2011, 04:50:42 AM
 #2

looks good, post the one that turns it back on with an adjusted clock speed - otherwise it would just keep getting hot and killing it and cycling through that same process over and over.

<luke-jr> Catholics do not believe in freedom of religion.
rethaw (OP)
Sr. Member
****
Offline Offline

Activity: 378
Merit: 255



View Profile
July 02, 2011, 05:46:10 AM
 #3

Code:
lowerbound=300 ; while : ; do if [ "`aticonfig --odgt --adapter=0 | grep -o '[0-9][0-9].[0-9][0-9]' | sed 's/\.[0-9][0-9]//g'`" -gt "80" ] ; then echo "TOO HOT" ; aticonfig --odsc $(expr `aticonfig --odgc --adapter=0 | grep Clocks | awk '{print $4}'` - 20),$(aticonfig --odgc --adapter=0 | grep Clocks | awk '{print $5}') --adapter=0 ; fi ; if [ "`aticonfig --odgc --adapter=0 | grep Clocks | awk '{print $4}'`" -lt "$lowerbound" ] ; then echo "Just too hot, stopping mining" ; killall poclbm.py ; killall phoenix.py ; exit ; fi ; sleep 15s; done

This will keep adjusting your clock down by 20 Hz until it gets under the temperature you set. If it doesn't reach the desired temperature before it gets to the lower bound clock it will turn off your miner. Use at your own risk, generally I would suggest being present whenever you are messing with the clock. However, this was tested by myself and one other person and does what it is intended to do.

teukon
Legendary
*
Offline Offline

Activity: 1246
Merit: 1002



View Profile
July 02, 2011, 06:47:20 PM
 #4

A nice idea.

I took what you did and extended it for my own purposes.  I'm not at all proficient with shell scripting and have just hacked this together - any criticism is welcome.

Caution: The constants at the beginning are appropriate for my miner and may not be appropriate for yours.  This script should not be run without being read and understood.

{
#!/bin/bash
# Scale the gpu clocks to keep temperature within preset bounds.

clock_step=10
sleep_time=60
card_0_min_temp=76
card_0_max_temp=79
card_0_min_clock=820
card_0_max_clock=970
card_1_min_temp=61
card_1_max_temp=64
card_1_min_clock=900
card_1_max_clock=1050

while :
do
   echo "------"
   echo
   card_0_clock=`aticonfig --adapter=0 --od-getclocks | grep Clocks | awk '{print $4}'`
   card_0_temp=`aticonfig --adapter=0 --od-gettemperature | grep -o [0-9][0-9].[0-9][0-9] | sed 's/\..*$//'`
   card_0_load=`aticonfig --adapter=0 --od-getclocks | grep -o [0-9]*% | sed 's/%//'`
   card_1_clock=`aticonfig --adapter=1 --od-getclocks | grep Clocks | awk '{print $4}'`
   card_1_temp=`aticonfig --adapter=1 --od-gettemperature | grep -o [0-9][0-9].[0-9][0-9] | sed 's/\..*$//'`
   card_1_load=`aticonfig --adapter=1 --od-getclocks | grep -o [0-9]*% | sed 's/%//'`
   echo "card_0_clock =" $card_0_clock
   echo "card_0_temp =" $card_0_temp
   echo "card_0_load =" $card_0_load
   echo "card_1_clock =" $card_1_clock
   echo "card_1_temp = " $card_1_temp
   echo "card_1_load =" $card_1_load
   echo

   if [ $card_0_temp -gt $card_0_max_temp ] && [ $(expr $card_0_clock - $clock_step) -ge $card_0_min_clock ]
      then echo "Card 0 is too hot; attempting to lower the clock speed."
      aticonfig --adapter=0 --od-setclocks=$(expr $card_0_clock - $clock_step),0
      echo
   fi
   if [ $card_0_load -gt 50 ] && [ $card_0_temp -lt $card_0_min_temp ] && [ $(expr $card_0_clock + $clock_step) -le $card_0_max_clock ]
      then echo "Card 0 is too cold; attempting to increase the clock speed by" $clock_step"MHz."
      new_clock=$(expr $card_0_clock + $clock_step)
      if [ $new_clock -lt $card_0_min_clock ]
         then new_clock=$card_0_min_clock
      fi
      aticonfig --adapter=0 --od-setclocks=$new_clock,0
      echo
   fi
   if [ $card_1_temp -gt $card_1_max_temp ] && [ $(expr $card_1_clock - $clock_step) -ge $card_1_min_clock ]
      then echo "Card 1 is too hot; attempting to lower the clock speed by" $clock_step"MHz."
      aticonfig --adapter=1 --od-setclocks=$(expr $card_1_clock - $clock_step),0
      echo
   fi
   if [ $card_1_load -gt 50 ] && [ $card_1_temp -lt $card_1_min_temp ] && [ $(expr $card_1_clock + $clock_step) -le $card_1_max_clock ]
      then echo "Card 1 is too cold; attempting to increase the clock speed by" $clock_step"MHz."
      new_clock=$(expr $card_1_clock + $clock_step)
      if [ $new_clock -lt $card_1_min_clock ]
         then new_clock=$card_1_min_clock
      fi
      aticonfig --adapter=1 --od-setclocks=$new_clock,0
      echo
   fi

   sleep $sleep_time
done
}
rethaw (OP)
Sr. Member
****
Offline Offline

Activity: 378
Merit: 255



View Profile
July 02, 2011, 07:21:45 PM
 #5

Looks neat. Apparently there is Autominer that does stuff like this (and more) based on a collection of scripts.

teukon
Legendary
*
Offline Offline

Activity: 1246
Merit: 1002



View Profile
July 02, 2011, 08:36:40 PM
 #6

Looks neat. Apparently there is Autominer that does stuff like this (and more) based on a collection of scripts.

Thanks for the tip, but after coming this far I think I'm pretty comfortable with writing my own scripts.  I might look at the code for ideas.
rethaw (OP)
Sr. Member
****
Offline Offline

Activity: 378
Merit: 255



View Profile
July 02, 2011, 08:38:21 PM
 #7

Go for it. Also, you will find there is always a better, shorter, or cleaner way of doing things. I think my grep | sed could be made more efficient into one call. Fortunately speed isn't really an issue here.

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!