Skip to content

Instantly share code, notes, and snippets.

@joelgriffiths
Created March 20, 2021 00:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joelgriffiths/bf352892a17910d85366cf592e87b1dc to your computer and use it in GitHub Desktop.
Save joelgriffiths/bf352892a17910d85366cf592e87b1dc to your computer and use it in GitHub Desktop.
Nvidia Overclock.sh
#!/usr/bin/env bash
# Use these settings at you own risk.
# You need to be running xinit for this to work.
# In a headless system, you can't to this until you setup a
# fake display in /etc/X11/xorg.conf. Here is an example:
#
# Section "Screen"
# Identifier "Screen0"
# Device "Device0"
# Monitor "Monitor0"
# DefaultDepth 24
# Option "AllowEmptyInitialConfiguration" "True"
# Option "UseDisplayDevice" "DFP-0"
# Option "Coolbits" "28"
# Option "ConnectedMonitor" "DFP-0"
# SubSection "Display"
# Depth 24
# EndSubSection
# EndSection
#
# Make sure you reboot and run 'xinit&' before running this script
echo "MAKE SURE YOU RUN: xinit&"
O=$IFS
IFS=$(echo -en "\n\b")
for card in $(nvidia-smi -L | sed 's/TX /:/;s/ .UUID/:/;s/GPU /:/;s/ /-/g' | awk -F':' '{print $2"," $4}'); do
slot=$(echo $card|awk -F',' '{print $1}')
model=$(echo $card|awk -F',' '{print $2}')
echo SLOT: $slot
echo MODEL: ${model}
case $model in
3070)
echo "Setting 3070"
sudo nvidia-smi -pl 130 -i ${slot}
nvidia-settings -c :0 -a "[gpu:${slot}]/GPUGraphicsClockOffset[4]=-500" -a "[gpu:${slot}]/GPUMemoryTransferRateOffset[4]=1500"
nvidia-settings -c :0 -q "[gpu:${slot}]/GPUGraphicsClockOffset[4]" -q "[gpu:${slot}]/GPUMemoryTransferRateOffset[4]" --ctrl-display=:0 | grep Attribute
;;
3060-Ti)
echo "Setting 3060 Ti"
sudo nvidia-smi -pl 130 -i ${slot}
nvidia-settings -c :0 -a "[gpu:${slot}]/GPUGraphicsClockOffset[4]=-500" -a "[gpu:${slot}]/GPUMemoryTransferRateOffset[4]=1100"
nvidia-settings -c :0 -q "[gpu:${slot}]/GPUGraphicsClockOffset[4]" -q "[gpu:${slot}]/GPUMemoryTransferRateOffset[4]" --ctrl-display=:0 | grep Attribute
;;
2080)
echo "Setting 2080"
sudo nvidia-smi -pl 155 -i ${slot}
nvidia-settings -c :0 -a "[gpu:${slot}]/GPUGraphicsClockOffset[3]=-50" -a "[gpu:${slot}]/GPUMemoryTransferRateOffset[4]=1100"
nvidia-settings -c :0 -q "[gpu:${slot}]/GPUGraphicsClockOffset[3]" -q "[gpu:${slot}]/GPUMemoryTransferRateOffset[4]" --ctrl-display=:0 | grep Attribute
;;
1080)
echo "Setting 1080"
sudo nvidia-smi -pl 135 -i ${slot}
nvidia-settings -c :0 -a "[gpu:${slot}]/GPUGraphicsClockOffset[3]=100" -a "[gpu:${slot}]/GPUMemoryTransferRateOffset[3]=1300"
nvidia-settings -c :0 -q "[gpu:${slot}]/GPUGraphicsClockOffset[3]" -q "[gpu:${slot}]/GPUMemoryTransferRateOffset[3]" --ctrl-display=:0 | grep Attribute
;;
*)
echo "No Match for $model"
esac
echo "----"
done
IFS=$O
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment