ubuntu19安装cuda、cudnn

原创文章点击这里

1 环境

操作系统:ubuntu19.10
显卡:GeForce MX150

2 准备文件

cuda_10.0.130_410.48_linux.run
cudnn-10.0-linux-x64-v7.6.4.38.tgz

3 显卡驱动

ubuntu19.10里已经安装了nvidia显卡驱动,如果没有,自行安装,可以参考这里,这款 GeForce MX150 显卡对应的显卡驱动为NVIDIA-Linux-x86_64-430.50.run
查看显卡型号:

nvidia-smi -L

4 安装cuda

进入文件所在目录,执行:

./cuda_10.0.130_410.48_linux.run

这是安装过程中的几个选项(是否安装显卡驱动取决于你是否已经安装了显卡,我们上一步已经安装了,所以这里就不安装):

Do you accept the previously read EULA?
accept/decline/quit: accept

You are attempting to install on an unsupported configuration. Do you wish to continue?
(y)es/(n)o [ default is no ]: y

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 410.48?
(y)es/(n)o/(q)uit: n

Install the CUDA 10.0 Toolkit?
(y)es/(n)o/(q)uit: y

Enter Toolkit Location
 [ default is /usr/local/cuda-10.0 ]: 

Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: y

Install the CUDA 10.0 Samples?
(y)es/(n)o/(q)uit: y

Enter CUDA Samples Location
 [ default is /home/tanrui ]: 

如果安装过程中出现:
unsupported compiler x.x.x Use --override to override this check 错误类型
需要在安装命令中添加参数--override

./cuda_10.0.130_410.48_linux.run --override

如果安装成功,就显示如下:

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-10.0
Samples:  Installed in /home/tanrui, but missing recommended libraries

Please make sure that
 -   PATH includes /usr/local/cuda-10.0/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-10.0/lib64, or, add /usr/local/cuda-10.0/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-10.0/bin

Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-10.0/doc/pdf for detailed information on setting up CUDA.

***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 384.00 is required for CUDA 10.0 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
    sudo <CudaInstaller>.run -silent -driver

5 安装cudnn

解压文件:

tar -xvf cudnn-10.0-linux-x64-v7.6.4.38.tgz
chmod 777 cuda -R

复制到cuda文件夹中:

cp cuda/include/cudnn.h /usr/local/cuda/include/
cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/

把下面内容添加至.bashrc:

export CUDA_HOME=/usr/local/cuda
export PATH=$PATH:$CUDA_HOME/bin
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

更新 .bashrc:

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值