NVIDIA驱动安装、CUDA安装、cudnn安装

1、禁用 nouveau 驱动

sudo vim /etc/modprobe.d/nvidia-installer-disable-nouveau.conf

文件内容为:

# generated by nvidia-installer
blacklist nouveau
options nouveau modeset=0

再执行:

sudo update-initramfs -u
sudo shutdown -r now

介绍一下 update-initramfs :

NAME
update-initramfs - generate an initramfs image
 

SYNOPSIS
update-initramfs -c|-d|-u [-k version] [-t] [-v] [-b directory] [-h]  
DESCRIPTION
The update-initramfs script manages your initramfs images on your local box. It keeps track of the existing initramfs archives in /boot. There are three modes of operation create, update or delete. You must at least specify one of those modes.
The initramfs is a gzipped cpio archive. At boot time, the kernel unpacks that archive into RAM disk, mounts and uses it as initial root file system. All finding of the root device happens in this early userspace.

 

OPTIONS
-k version
Set the specific kernel version for whom the initramfs will be generated. For example the output of uname -r for your currently running kernel. This argument is optional for update. The default is the latest kernel version.
The use of "all" for the version string specifies update-initramfs to execute the chosen action for all kernel versions, that are already known to update-initramfs.

-c
This mode creates a new initramfs.
-u
This mode updates an existing initramfs.
-d
This mode removes an existing initramfs.
-t
Allows one to take over an custom initramfs with a newer one.
-v
This option increases the amount of information you are given during the chosen action.
-b directory
Set an different bootdir for the image creation.
-h
Print a short help page describing the available options in update-initramfs.

2、关闭图形化界面

sudo /etc/init.d/lightdm stop

或者

sudo service lightdm stop

3、单独安装驱动

(1) 用cuda安装驱动

sudo <CudaInstaller>.run -silent -driver

(2) 下载驱动安装

下载路径:https://www.nvidia.com/Download/index.aspx?lang=cn

4、安装cuda、cudnn

cuda下载路径:https://developer.nvidia.com/cuda-toolkit-archive

sudo <CudaInstaller>.run

cudnn下载路径:https://developer.nvidia.com/rdp/cudnn-download

tar zxvf cudnn-10.0-linux-x64-v7.3.1.20.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda-10.0/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda-10.0/lib64/
sudo chmod a+r /usr/local/cuda-10.0/include/cudnn.h
sudo chmod a+r /usr/local/cuda-10.0/lib64/libcudnn*
sudo vim /etc/profile
export PATH="/usr/local/cuda-10.0/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:/usr/local/cuda-10.0/extras/CUPTI/lib64:$LD_LIBRARY_PATH"

猜你喜欢

转载自www.cnblogs.com/jacen789/p/11414026.html