1 卸载旧的显卡驱动
sudo apt-get remove nvidia*
查看linux系统中的CUDA版本:
cat /usr/local/cuda/version.txt
CUDA Version 10.1.105
2 下载显卡驱动
首先查看显卡型号:
[email protected]:~# lshw -numeric -C display
*-display:0
description: VGA compatible controller
product: GD 5446 [1013:B8]
vendor: Cirrus Logic [1013]
physical id: 2
bus info: [email protected]:00:02.0
version: 00
width: 32 bits
clock: 33MHz
capabilities: vga_controller rom
configuration: driver=cirrus latency=0
resources: irq:0 memory:fa000000-fbffffff memory:fe050000-fe050fff memory:fe040000-fe04ffff
*-display:1 UNCLAIMED
description: 3D controller
product: GP100GL [Tesla P100 PCIe 16GB] [10DE:15F8]
vendor: NVIDIA Corporation [10DE]
physical id: 9
bus info: [email protected]:00:09.0
version: a1
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress cap_list
configuration: latency=0
resources: iomemory:80-7f iomemory:c0-bf memory:fd000000-fdffffff memory:800000000-bffffffff memory:c00000000-c01ffffff
可以看到我的显卡是P100,根据显卡、CUDA版本下载适合的驱动,这里有一张参照表:
下载驱动:NVIDIA-Linux-x86_64-430.50.run
3 安装相关依赖包
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libopenblas-dev liblapack-dev libatlas-base-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
4 有图形界面需禁用x-window服务
sudo service lightdm stop
5 禁用nouveau
禁用nouveau后才能成功安装NVIDIA显卡驱动
sudo vi /etc/modprobe.d/blacklist.conf
#添加以下内容
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
执行命令
echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf build the new kernel by:
更新并重启
sudo update-initramfs -u
reboot
6 安装
sudo chmod a+x NVIDIA-Linux-x86_64-430.50.run*
sudo sh NVIDIA-Linux-x86_64-430.50.run* --no-opengl-files --no-x-check --no-nouveau-check
- no-opengl-files 只安装驱动文件,不安装OpenGL文件。这个参数最重要
- no-x-check 安装驱动时不检查X服务
- no-nouveau-check 安装驱动时不检查nouveau
7 查看是否安装成功
nvidia-smi
Wed Sep 25 16:38:54 2019
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 430.50 Driver Version: 430.50 CUDA Version: 10.1 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Tesla P100-PCIE... Off | 00000000:00:09.0 Off | 0 |
| N/A 27C P0 26W / 250W | 0MiB / 16280MiB | 4% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Fri_Feb__8_19:08:17_PST_2019
Cuda compilation tools, release 10.1, V10.1.105
查看NVIDIA驱动版本信息:
cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module 430.50 Thu Sep 5 22:36:31 CDT 2019
GCC version: gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11)
原文地址:https://www.cnblogs.com/eugene0/p/11587987.html
时间: 2024-10-31 01:14:15