| 
							bcforum (OP)
							
						 | 
								
							
								  | 
								
												
												 August 01, 2011, 10:26:09 PM Last edit: August 11, 2011, 03:40:39 AM by bcforum  | 
										  
								 | 
							  
									  
							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. #!/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): #!/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  
						 | 
					 
					
						
							
							 
							If you found this post useful, feel free to share the wealth: 1E35gTBmJzPNJ3v72DX4wu4YtvHTWqNRbM 
						 | 
					 
				 
			 |  
		 
	 | 
		
		
			
				
					
								| 
							Endeavour79
							
						 | 
								
							
								  | 
								
												
												 August 02, 2011, 06:32:44 AM  | 
										  
								 | 
							  
									  
							Nice.. Any way to port this to a windows app? 
						 | 
					 
					
						
							
							 
							NSW, Australia - Rigs, Mining, Pools - Local help needed? Send me a message! 
						 | 
					 
				 
			 |  
		 
	 | 
		
		
			
				
					
								| 
							bcforum (OP)
							
						 | 
								
							
								  | 
								
												
												 August 02, 2011, 12:31:40 PM  | 
										  
								 | 
							  
									  
							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.  
						 | 
					 
					
						
							
							 
							If you found this post useful, feel free to share the wealth: 1E35gTBmJzPNJ3v72DX4wu4YtvHTWqNRbM 
						 | 
					 
				 
			 |  
		 
	 | 
		
		
			
				
					
								| 
							Departure
							
						 | 
								
							
								  | 
								
												
												 August 02, 2011, 11:49:18 PM  | 
										  
								 | 
							  
									  
							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. 
						 | 
					 
					
						| 
							
						 | 
					 
				 
			 |  
		 
	 | 
		
		
			
				
					
								| 
							simplecoin
							
						 | 
								
							
								  | 
								
												
												 August 04, 2011, 05:25:16 AM Last edit: August 04, 2011, 06:22:49 AM by simplecoin  | 
										  
								 | 
							  
									  
							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 #!/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
 
   
						 | 
					 
					
						
							
							 
							Donations: 1VjGJHPtLodwCFBDWsHJMdEhqRcRKdBQk 
						 | 
					 
				 
			 |  
		 
	 | 
		
		
			
				
					
								| 
							bcforum (OP)
							
						 | 
								
							
								  | 
								
												
												 August 04, 2011, 11:26:15 AM  | 
										  
								 | 
							  
									  
							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.  
						 | 
					 
					
						
							
							 
							If you found this post useful, feel free to share the wealth: 1E35gTBmJzPNJ3v72DX4wu4YtvHTWqNRbM 
						 | 
					 
				 
			 |  
		 
	 | 
		
		
			
				
					
								| 
							simplecoin
							
						 | 
								
							
								  | 
								
												
												 August 04, 2011, 04:27:15 PM  | 
										  
								 | 
							  
									  
							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    YMMV  
						 | 
					 
					
						
							
							 
							Donations: 1VjGJHPtLodwCFBDWsHJMdEhqRcRKdBQk 
						 | 
					 
				 
			 |  
		 
	 | 
		
		
			
				
					
								
							krzynek1
							
								Newbie 
								 
								  Offline
								Activity: 41 
								Merit: 0
								
								
								
								
								  
							 
						 | 
								
							
								  | 
								
												
												 August 10, 2011, 11:29:18 AM  | 
										  
								 | 
							  
									  
							bcforum, can you modify your script to control only specified adapter ?
  this could be useful in cases when user have different clocks for cards  
						 | 
					 
					
						| 
							
						 | 
					 
				 
			 |  
		 
	 | 
		
		
			
				
					
								| 
							bcforum (OP)
							
						 | 
								
							
								  | 
								
												
												 August 11, 2011, 03:41:32 AM  | 
										  
								 | 
							  
									  
							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.  
						 | 
					 
					
						
							
							 
							If you found this post useful, feel free to share the wealth: 1E35gTBmJzPNJ3v72DX4wu4YtvHTWqNRbM 
						 | 
					 
				 
			 |  
		 
	 | 
		
		
			
				
					
								
							krzynek1
							
								Newbie 
								 
								  Offline
								Activity: 41 
								Merit: 0
								
								
								
								
								  
							 
						 | 
								
							
								  | 
								
												
												 August 15, 2011, 09:26:50 AM  | 
										  
								 | 
							  
									  
							how do I specify clocks and max temperatures for each adapter ? is it like this ? TARGETTEMP=(88 90 92 89) MAXCLOCK=(940 930 900 920)
   
						 | 
					 
					
						| 
							
						 | 
					 
				 
			 |  
		 
	 | 
		
		
			
				
					
								| 
							bcforum (OP)
							
						 | 
								
							
								  | 
								
												
												 August 15, 2011, 01:01:22 PM  | 
										  
								 | 
							  
									  
							how do I specify clocks and max temperatures for each adapter ? is it like this ? 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.  
						 | 
					 
					
						
							
							 
							If you found this post useful, feel free to share the wealth: 1E35gTBmJzPNJ3v72DX4wu4YtvHTWqNRbM 
						 | 
					 
				 
			 |  
		 
	 | 
		
		
			
				
					
								
							krzynek1
							
								Newbie 
								 
								  Offline
								Activity: 41 
								Merit: 0
								
								
								
								
								  
							 
						 | 
								
							
								  | 
								
												
												 August 15, 2011, 09:25:16 PM  | 
										  
								 | 
							  
									  
							ok, i will try that script, will be reporting, thank you anyway 
						 | 
					 
					
						| 
							
						 | 
					 
				 
			 |  
		 
	 | 
		
		
			
				
					
								| 
							deti
							
						 | 
								
							
								  | 
								
												
												 August 17, 2011, 08:04:33 PM  | 
										  
								 | 
							  
									  
							I like this security improvement!   Am I right that if the current clock is below 500 it will not speed up again?             elif [ "$curclk" -lt "500" ]; then                 echo "Adapter $i is idle"
  What is the purpose of that?  
						 | 
					 
					
						
							
							 
							
						 | 
					 
				 
			 |  
		 
	 | 
		
		
			
				
					
								| 
							bcforum (OP)
							
						 | 
								
							
								  | 
								
												
												 August 18, 2011, 01:41:16 AM  | 
										  
								 | 
							  
									  
							I like this security improvement!   Am I right that if the current clock is below 500 it will not speed up again?             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.  
						 | 
					 
					
						
							
							 
							If you found this post useful, feel free to share the wealth: 1E35gTBmJzPNJ3v72DX4wu4YtvHTWqNRbM 
						 | 
					 
				 
			 |  
		 
	 | 
	 |