操作
看显卡
lspci | grep N
01:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 960M] (rev a2)
07:00.0 Network controller: Intel Corporation Dual Band Wireless-AC 3165 Plus Bluetooth (rev 99)
ubuntu-drivers devices
lshw -numeric -C display
驱动下载
https://www.nvidia.com/Download/index.aspx?lang=en-us
http://www.nvidia.cn/Download/driverResults.aspx/156091/cn
删除原有驱动
sudo apt-get remove --purge nvidia*
#sudo apt-get purge bumblebee* bbswitch-dkms
禁用nouveau驱动
sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf
sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
看是否成功禁用了开源驱动
cat /etc/modprobe.d/blacklist-nvidia-nouveau.conf
blacklist nouveau
options nouveau modeset=0
禁用nouveau生效
sudo update-initramfs -u
重启
reboot
lsmod | grep nouveau
#看是否成功
获取相应的kernel
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#system-requirements
$ apt-get install linux-source gcc
$ apt-get install linux-headers-4.15.0-38-generic
$cat /proc/version
进入命令行操作
重启成功后打开终端,输入如下命令:sudo telinit 3。然后按快捷键:CTRL+ALT+F1 进入字符界面,输入用户名和密码,然后登录系统,进入我们保存下载 NVIDIA 驱动的目录,默认是:Downloads/ 目录,cd Downloads/,然后执行:bash NVIDIA-Linux-x86_64-418.43.bin。注意:NVIDIA-Linux-x86_64-418.43.bin 要根据你下载的驱动文件的名字相应改动。
#安装
$ sudo chmod +x NVIDIA-Linux-x86_64-410.66.run
$ sudo ./NVIDIA-Linux-x86_64-410.66.run
报错没有32bite-libriaries ,选择继续安装,然后出现下图
选择中间的选项
检查
$ nvidia-smi
nvidia-docker
先安装docker
https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/
# 更新源
$ sudo apt update
# 启用HTTPS
$ sudo apt install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
# 添加GPG key
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# 添加稳定版的源
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
# 更新源
$ sudo apt update
# 安装Docker CE
$ sudo apt install -y docker-ce
配置nvidia-docker
# 添加源
$ curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
$ curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | \
sudo tee /etc/apt/sources.list.d/nvidia-docker.list
# 更新源
$ sudo apt update
安装nvidia-docker2
# 安装nvidia-docker2
$ sudo apt install -y nvidia-docker2
# 重启Docker daemon
$ sudo pkill -SIGHUP dockerd
验证nvidia-docker2
$ sudo nvidia-docker run --rm nvidia/cuda nvidia-smi
普通用户可访问
$ sudo groupadd docker
$ sudo usermod -aG docker $USER
nvidia-docker 插件
https://github.com/NVIDIA/nvidia-docker
nvidia-docker 安装
https://github.com/NVIDIA/nvidia-docker/wiki/Installation-(version-2.0)
cuda-cudnn
https://www.cnblogs.com/journeyonmyway/p/10316292.html#4329767