ubuntu18.04安装RTX2080ti显卡驱动+cuda10.2+cudnn

因为系统环境变量崩溃,进行重做了系统,全部还原,在本机重新安装了显卡驱动、cuda等,具体系统版本如下。
系统环境:ubuntu18.04
显卡:rtx2080ti
cuda版本:10.2

安装RTX2080ti显卡驱动

1、 ubuntu 18.04默认安装了第三方开源的驱动程序nouveau,安装nvidia显卡驱动首先需要禁用nouveau,不然会碰到冲突的问题,导致无法安装nvidia显卡驱动。

# 首先编辑文件blacklist.conf
sudo vim /etc/modprobe.d/blacklist.conf

# 在文件最后部分插入以下两行内容
blacklist nouveau
options nouveau modeset=0

#更新系统
sudo update-initramfs -u

#重启系统(一定要重启)
reboot

#验证nouveau是否已禁用,若没有提示任何信息则是已经禁用
lsmod | grep nouveau

2、下载安装显卡驱动,在官网找到相应版本的驱动下载即可,http://www.nvidia.cn/page/home.html,将下载的驱动拷贝到/home目录下

# 下载的2080Ti驱动如下
440.82.run

3、在ubuntu按ctrl+alt+f1进入命令行界面,关闭图形界面,卸载原有的驱动

# 这个是关闭图形界面,不执行会出错
 sudo service lightdm stop      

# 然后卸载掉原有驱动:
sudo apt-get remove nvidia-*  

4、给驱动文件赋予权限并进行安装,在安装过程中执行默认选项即可

# 进行赋予权限
 sudo chmod  a+x NVIDIA-Linux-x86_64-396.18.run
 
# 安装
sudo ./440.82.run 

5、挂在显卡驱动,进行测试,进行重启

# 挂在显卡驱动
modprobe nvidia

# 检查驱动是否安装成功
nvidia-smi

# 重启
sudo reboot

安装Cuda10.2

1、安装cuda10.2,在弹出的界面输入accept,因为我们已经安装了显卡驱动,所以就不需要在安装显卡驱动了

# 安装
sudo ./cuda_10.2.89_440.33.01_linux.run

2、配置环境变量

# 打开bashrc文件
sudo gedit ~/.bashrc

# 添加三条路径
export CUDA_HOME=/usr/local/cuda
export PATH=$PATH:$CUDA_HOME/bin
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

#让配置生效
source ~/.bashrc

3、查看是否安装成功

# 输入
nvcc -V

# 安装成功
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89

安装Cudnn

1、从https://developer.nvidia.com/cudnn下载相应版本的cudnn
2、下载后解压,将cudnn文件拷贝到cuda中的相应目录

#将cuda/include/cudnn.h文件复制到/usr/local/cuda-10.2/include文件夹
#将cuda/lib64/下所有文件复制到/usr/local/cuda-10.2/lib64文件夹中
cp cuda/include/cudnn.h /usr/local/cuda-10.2/include
cp cuda/lib64/* /usr/local/cuda-10.2/lib64

# 给予权限
sudo chmod a+r /usr/local/cuda/include/cudnn.h 
 sudo chmod a+r /usr/local/cuda/lib64/libcudnn*

3、验证是否安装成功

cd /usr/local/cuda-10.2/samples/1_Utilities/deviceQuery
sudo make
sudo ./deviceQuery

输出如下设备信息表示成功

./deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 2 CUDA Capable device(s)

Device 0: "GeForce RTX 2080 SUPER"
  CUDA Driver Version / Runtime Version          10.2 / 10.2
  CUDA Capability Major/Minor version number:    7.5
  Total amount of global memory:                 7979 MBytes (8366784512 bytes)
  (48) Multiprocessors, ( 64) CUDA Cores/MP:     3072 CUDA Cores
  GPU Max Clock rate:                            1845 MHz (1.85 GHz)
  Memory Clock rate:                             7751 Mhz
  Memory Bus Width:                              256-bit
  L2 Cache Size:                                 4194304 bytes
  Maximum Texture Dimension Size (x,y,z)         1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
  Maximum Layered 1D Texture Size, (num) layers  1D=(32768), 2048 layers
  Maximum Layered 2D Texture Size, (num) layers  2D=(32768, 32768), 2048 layers
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       49152 bytes
  Total number of registers available per block: 65536
  Warp size:                                     32
  Maximum number of threads per multiprocessor:  1024
  Maximum number of threads per block:           1024
  Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
  Max dimension size of a grid size    (x,y,z): (2147483647, 65535, 65535)
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             512 bytes
  Concurrent copy and kernel execution:          Yes with 3 copy engine(s)
  Run time limit on kernels:                     Yes
  Integrated GPU sharing Host Memory:            No
  Support host page-locked memory mapping:       Yes
  Alignment requirement for Surfaces:            Yes
  Device has ECC support:                        Disabled
  Device supports Unified Addressing (UVA):      Yes
  Device supports Compute Preemption:            Yes
  Supports Cooperative Kernel Launch:            Yes
  Supports MultiDevice Co-op Kernel Launch:      Yes
  Device PCI Domain ID / Bus ID / location ID:   0 / 1 / 0
  Compute Mode:
     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

Device 1: "GeForce RTX 2080 SUPER"
  CUDA Driver Version / Runtime Version          10.2 / 10.2
  CUDA Capability Major/Minor version number:    7.5
  Total amount of global memory:                 7982 MBytes (8370061312 bytes)
  (48) Multiprocessors, ( 64) CUDA Cores/MP:     3072 CUDA Cores
  GPU Max Clock rate:                            1845 MHz (1.85 GHz)
  Memory Clock rate:                             7751 Mhz
  Memory Bus Width:                              256-bit
  L2 Cache Size:                                 4194304 bytes
  Maximum Texture Dimension Size (x,y,z)         1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
  Maximum Layered 1D Texture Size, (num) layers  1D=(32768), 2048 layers
  Maximum Layered 2D Texture Size, (num) layers  2D=(32768, 32768), 2048 layers
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       49152 bytes
  Total number of registers available per block: 65536
  Warp size:                                     32
  Maximum number of threads per multiprocessor:  1024
  Maximum number of threads per block:           1024
  Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
  Max dimension size of a grid size    (x,y,z): (2147483647, 65535, 65535)
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             512 bytes
  Concurrent copy and kernel execution:          Yes with 3 copy engine(s)
  Run time limit on kernels:                     No
  Integrated GPU sharing Host Memory:            No
  Support host page-locked memory mapping:       Yes
  Alignment requirement for Surfaces:            Yes
  Device has ECC support:                        Disabled
  Device supports Unified Addressing (UVA):      Yes
  Device supports Compute Preemption:            Yes
  Supports Cooperative Kernel Launch:            Yes
  Supports MultiDevice Co-op Kernel Launch:      Yes
  Device PCI Domain ID / Bus ID / location ID:   0 / 2 / 0
  Compute Mode:
     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
> Peer access from GeForce RTX 2080 SUPER (GPU0) -> GeForce RTX 2080 SUPER (GPU1) : No
> Peer access from GeForce RTX 2080 SUPER (GPU1) -> GeForce RTX 2080 SUPER (GPU0) : No

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 10.2, CUDA Runtime Version = 10.2, NumDevs = 2

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值