Skip to content

Instantly share code, notes, and snippets.

@jackson5sec
Last active June 4, 2021 15:06
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jackson5sec/19cfe163fff8d7d5d185d32473945e16 to your computer and use it in GitHub Desktop.
Save jackson5sec/19cfe163fff8d7d5d185d32473945e16 to your computer and use it in GitHub Desktop.
#!/bin/bash
#set persistence mode for all GPU
sudo nvidia-smi -pm 1
#Set gpu max power at 160w
sudo nvidia-smi -pl 160
#Set Power level of specific GPU (1080) in watts
# sudo nvidia-smi -i 2 -pl 200
# https://devtalk.nvidia.com/default/topic/1024489/linux/nvidia-settings-on-headless-server/
# Harcode Fan Settings
# This will create empty X server config
nvidia-xconfig --allow-empty-initial-configuration
X -config ./XF86Config
export DISPLAY=:0
nvidia-settings -a [gpu:0]/GPUFanControlState=1
nvidia-settings -a [fan:0]/GPUTargetFanSpeed=75
#Overclock and Fan Settings, just an example, you need to do this for all GPUs and fans ([gpu:0], [gpu:1], [fan:0], [fan:1], etc. for each card.)
# nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=1'
# nvidia-settings -a '[gpu:0]/GPUGraphicsClockOffset[3]=100'
# nvidia-settings -a '[gpu:0]/GPUMemoryTransferRateOffset[3]=900'
# nvidia-settings -a '[gpu:0]/GPUFanControlState=1'
# nvidia-settings -a '[fan:0]/GPUTargetFanSpeed=85'
@nanom1t
Copy link

nanom1t commented Dec 26, 2019

Hi. Does this script work without running X server on Linux (Ubuntu)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment