Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- #----------------------------------------------------------------------
- # Description: adaptive fan speed management for NVIDIA GPUs on Linux
- # Author: Artem S. Tashkinov
- # Created at: Fri Jul 10 07:47:43 GMT 2015
- # Computer: localhost.localdomain
- # System: Linux 4.1.0-ic on i686
- #
- # Copyright (c) 2015 Artem S. Tashkinov All rights reserved.
- #
- # WARNING: I'm not liable for any damage to your GPU if you decide to
- # use this script
- #
- #----------------------------------------------------------------------
- polltime=2 # in seconds
- range[0]="0 39"
- dtemp[0]=35
- range[1]="40 59"
- dtemp[1]=45
- range[2]="60 79"
- dtemp[2]=55
- range[3]="80 200"
- dtemp[3]=80
- trap ctrl_c INT
- ctrl_c() {
- echo
- echo -n "Resetting GPU fan management: "
- nvidia-settings -a [gpu:0]/GPUFanControlState=0 &>/dev/null && echo "OK" || echo "Failed!"
- exit 0
- }
- result=`nvidia-settings -a [gpu:0]/GPUFanControlState=1 | grep "value 1"`
- test -z "$result" && echo "Fan speed management is not supported on this GPU. Exiting" && exit 1
- while :; do
- temp=`nvidia-settings -q GPUCoreTemp -t | head -1`
- i=0
- while [ "x${range[i]}" != "x" ]; do
- read lo hi <<<$(echo ${range[$i]})
- if [ $temp -ge $lo -a $temp -le $hi ]; then
- echo "GPU Temperature: ${temp}. Setting GPU fan speed to ${dtemp[$i]}%"
- nvidia-settings -a "[gpu:0]/GPUFanControlState=1" -a "[fan:0]/GPUTargetFanSpeed=${dtemp[$i]}" &> /dev/null
- fi
- i=$((i+1))
- done
- sleep $polltime
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement