【服务器管理】Ubuntu18.04的驱动nvidia驱动升级为450版本后,ssh速度很慢的解决方案
笔者最近发现,Ubuntu18.04的nvidia驱动自动升级为450版本之后,ssh连接速度和显卡跑代码的速度都很慢。
偶然测试发现,把nvidia驱动回退到440版本后,就恢复正常了,现记录如下:
首先卸载旧驱动
sudo apt-get --purge remove nvidia*
sudo apt autoremove
重启,使得所有nvidia残余进程被杀掉,否则无法安装
sudo shutdown -r now
下载驱动(实验证明440.100版本驱动对18.04十分适合)
wget https://cn.download.nvidia.com/XFree86/Linux-x86_64/440.100/NVIDIA-Linux-x86_64-440.100.run
给run文件加权限
sudo chmod a+x NVIDIA-Linux-x86_64-440.100.run
安装驱动
sudo ./NVIDIA-Linux-x86_64-440.100.run -no-x-check -no-nouveau-check -no-opengl-files
安装过程:
The distribution-provided pre-install script failed! Are you sure you want to continue? 选择 yes 继续。
Would you like to register the kernel module souces with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later? 选择 No 继续。
Would you like to run the nvidia-xconfigutility to automatically update your x configuration so that the NVIDIA x driver will be used when you restart x? Any pre-existing x confile will be backed up. 选择No
重启
sudo shutdown -r now
提升nvidia-smi运行速度
sudo /usr/bin/nvidia-persistenced --verbose
直接把该命令放到开机自动运行
echo "/usr/bin/nvidia-persistenced --verbose" | sudo tee -a /etc/init.d/rc.local
另外一种加速方法
sudo nvidia-smi -pm 1
设置持久模式:0/DISABLED,1/ENABLED
测试安装结果
nvidia-smi
最终,ssh连接速度由很慢的30秒恢复到几秒,nvidia-smi也瞬间弹出结果,运行代码也恢复正常!