ubuntu系统下nvidia显卡超频设置

必要条件是先安装nvidia的官方驱动

卸载全部nvidia驱动

https://az764295.vo.msecnd.net/stable/379476f0e13988d90fab105c5c19e7abc8b1dea8/VSCode-darwin-universal.zip

报错解决1:

错误信息:

ERROR: The Nouveau kernel driver is currently in use by your system. This driver is incompatible with the NVIDIA driver……

解决方法:

1
2
3
4
5
# 创建文件
sudo vim /etc/modprobe.d/blacklist-nouveau.conf
# 添加内容
blacklist nouveau
options nouveau modeset=0

更新使其生效

1
sudo update-initramfs -u

重启机器

1
sudo reboot

报错解决2:

错误信息:

Unable to find the development tool cc in your path; please make sure that you have the

或:

Unable to find the development tool make in your path; please make sure that you have t

解决方法:

1
2
sudo apt install gcc
sudo apt install make

报错解决3:

错误信息:

1
2
3
4
An NVIDIA kernel module 'nvidia-drm' appears to already be loaded in your kernel.  This may be because it is in use (for example, by an X server, a CUDA program, or the
NVIDIA Persistence Daemon), but this may also happen if your kernel was configured without support for module unloading. Please be sure to exit any programs that may be
using the GPU(s) before attempting to upgrade your driver. If no GPU-based programs are running, you know that your kernel supports module unloading, and you still
receive this message, then an error may have occurred that has corrupted an NVIDIA kernel module's usage count, for which the simplest remedy is to reboot your computer.

解决方法:

卸载驱动

1
sudo /usr/bin/nvidia-uninstall

安装完毕之后检查

1
nvidia-smi

注意事项

在开始之前先打开ssh,并且设置静态ip否则可能无法进入桌面;如果无法进入桌面使用ssh链接然后把/etc/X11/xorg.conf文件删除之后重启即可。

参考:

https://www.youtube.com/watch?v=5XaWVQ1GDVY

https://bitcointalk.org/index.php?topic=2848723.0

https://blog.csdn.net/liufunan/article/details/52090382

https://askubuntu.com/questions/1251920/overclock-nvidia-gpu-to-achieve-undervolting

查看显卡信息:

1
nvidia-smi

设置显卡功率

1
2
# 设置第一个显卡的功率为125w
sudo nvidia-smi -i 0 -pl 125

开启超频

生成xorg.conf文件

查看有没有/etc/X11/xorg.conf文件,如果没有则生成,命令如下

1
2
3
4
# 如果只有一张显卡,可以执行下面这一行。
sudo nvidia-xconfig
# 如果是多个显卡,但是有一个显卡是用来视频输出的,则不要执行下面这一行。
# sudo nvidia-xconfig --enable-all-gpus

设置--cool-bits=28

1
2
sudo nvidia-xconfig --cool-bits=28
# sudo nvidia-xconfig -a --cool-bits=28

具体的cool-bits的意思如下:

1
2
3
4
5
6
7
cool-bits的值的每一位都代表不同的含义,可以根据自己的需要组合,具体含义摘抄如下。
Coolbits的值是所有位的组合成的二进制数对应的10进制数值:
- 1 (bit0) 允许老的(Fermi核心)之前的显卡超频
- 2 (bit1) 当使用不同显存的GPU需要设置成SLI时,可以设置这一位
- 4 (bit2) 允许手动设置显卡风扇的转速
- 8 (bit3) 允许超频,驱动版本要比337.12新,架构要比Fermi新
- 16 (bit4) 允许超电压,驱动版本要比346.16新,架构要比Fermi新

设置完成之后查看/etc/X11/xorg.conf文件,我的DeviceScreen如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "Coolbits" "28"
SubSection "Display"
Depth 24
EndSubSection

需要把Section "Screen"下的Option "Coolbits" "28"这一行移动到Section Device下面,如果不移动我的会导致显示器黑屏。移动之后如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Section "Device"
Identifier "Device0"
Driver "nvidia"
Option "Coolbits" "28"
VendorName "NVIDIA Corporation"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
EndSubSection
EndSection

重启

1
sudo reboot

超频

3070超频设置:
1
2
nvidia-settings -c :0 -a "[gpu:0]/GPUMemoryTransferRateOffset[4]=2500"
nvidia-settings -c :0 -a "[gpu:0]/GPUGraphicsClockOffset[4]=-350"
1660超频
1
2
3
4
5
6
7
8
9
10
11
12
13
14
nvidia-settings -c :0 -a "[gpu:0]/GPUMemoryTransferRateOffset[4]=1200"
nvidia-settings -c :0 -a "[gpu:0]/GPUGraphicsClockOffset[4]=-80"
nvidia-settings -c :0 -a "[gpu:1]/GPUMemoryTransferRateOffset[4]=1400"
nvidia-settings -c :0 -a "[gpu:1]/GPUGraphicsClockOffset[4]=-100"
nvidia-settings -c :0 -a "[gpu:2]/GPUMemoryTransferRateOffset[4]=1200"
nvidia-settings -c :0 -a "[gpu:2]/GPUGraphicsClockOffset[4]=-80"
nvidia-settings -c :0 -a "[gpu:3]/GPUMemoryTransferRateOffset[4]=1200"
nvidia-settings -c :0 -a "[gpu:3]/GPUGraphicsClockOffset[4]=-80"
nvidia-settings -c :0 -a "[gpu:4]/GPUMemoryTransferRateOffset[4]=1200"
nvidia-settings -c :0 -a "[gpu:4]/GPUGraphicsClockOffset[4]=-80"
nvidia-settings -c :0 -a "[gpu:5]/GPUMemoryTransferRateOffset[4]=1200"
nvidia-settings -c :0 -a "[gpu:5]/GPUGraphicsClockOffset[4]=-80"
nvidia-settings -c :0 -a "[gpu:6]/GPUMemoryTransferRateOffset[4]=1200"
nvidia-settings -c :0 -a "[gpu:6]/GPUGraphicsClockOffset[4]=-80"

ubuntu安装.deb软件

1
2
3
4
5
6
# 指定安装包安装
sudo dpkg -i teamviewer_15.16.8_amd64.deb
# 如果上面的命令报错说缺少依赖,则执行:
sudo apt -f -y install
# 安装依赖之后,重新安装
sudo dpkg -i teamviewer_15.16.8_amd64.deb

ubuntu更新已经安装的软件

1
2
3
4
5
6
# 检查更新
sudo apt update
# 列出可更新软件
apt list --upgradable
# 更新
sudo apt upgrade