Skip to content

Instantly share code, notes, and snippets.

@fnx4
Last active September 7, 2018 00:06
Show Gist options
  • Save fnx4/7f2a7f6de2ed0e83e4f09ecfeb53e189 to your computer and use it in GitHub Desktop.
Save fnx4/7f2a7f6de2ed0e83e4f09ecfeb53e189 to your computer and use it in GitHub Desktop.
Nvidia GPU 3D fan stop fix (50° С)
#!/bin/bash
export DISPLAY=:1
DELAY=5
LOW=40
HIGH=70
#nvidia-xconfig --allow-empty-initial-configuration
nvidia-settings -a [gpu:0]/GPUFanControlState=1 > /dev/null
while true
do
GPU_TEMP=`nvidia-smi -i 0 --query-gpu=temperature.gpu --format=csv,noheader`
if [[ $GPU_TEMP < $LOW ]]
then
GPU_FAN=0
elif [[ $GPU_TEMP > $HIGH ]]
then
GPU_FAN=$GPU_TEMP
else
GPU_FAN=$(( ($GPU_TEMP * 100)/(($HIGH - $LOW) * 4) ))
fi
nvidia-settings -a [fan:0]/GPUTargetFanSpeed=$GPU_FAN > /dev/null
echo "$(date +"%T"): GPU0 ${GPU_TEMP}°C -> ${GPU_FAN}%"
sleep $DELAY
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment