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

1、禁用 nouveau 驱动

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

或者

sudo vim /etc/modprobe.d/blacklist.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

sudo ./NVIDIA-Linux-x86_64-430.40.run --no-opengl-files
  • --no-opengl-files:表示只安装驱动文件,不安装OpenGL文件。这个参数不可省略,否则会导致登陆界面死循环,英语一般称为“login loop”或者“stuck in login”。
    •   必选参数解释:因为NVIDIA的驱动默认会安装OpenGL,而Ubuntu的内核本身也有OpenGL、且与GUI显示息息相关,一旦NVIDIA的驱动覆写了OpenGL,在GUI需要动态链接OpenGL库的时候就引起问题。
  • --no-x-check:表示安装驱动时不检查X服务,非必需,我们已经禁用图形界面。
  • --no-nouveau-check:表示安装驱动时不检查nouveau,非必需,我们已经禁用驱动。
  • -Z, --disable-nouveau:禁用nouveau。此参数非必需,因为之前已经手动禁用了nouveau。
  • -A:查看更多高级选项。

 

4、安装cuda、cudnn

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

sudo <CudaInstaller>.run

NVIDIA官网cuda安装文档:https://docs.nvidia.com/cuda/index.html

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"

 

转载于:https://www.cnblogs.com/jacen789/p/11414026.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值