ubuntu 18.04安装cuda 8.0 和cudnn 6.0

我的cuda 8.0的下载链接为:

https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run

cudnn 6.0的下载链接为:

https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v6/prod/8.0_20170427/cudnn-8.0-linux-x64-v6.0-tgz

如果我给的两个链接下载不了的话,那就只能去官网下载了。

https://developer.nvidia.com/cuda-80-ga2-download-archive

cuda安装

下载完以后,进行安装:

sh cuda_8.0.61_375.26_linux.run --noexec --target cuda

进入cuda目录下

 sudo cp InstalUtil.pm /etc/perl

配置环境变量:

export $PERL5LIB

安装cuda

 sudo ./cuda_8.0.61_375.26_linux-run --override

我的安装信息为:

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 375.26?
(y)es/(n)o/(q)uit: n

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

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

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

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

Installing the CUDA Toolkit in /usr/local/cuda-8.0 ...

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-8.0
Samples:  Not Selected

Please make sure that
 -   PATH includes /usr/local/cuda-8.0/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-8.0/lib64, or, add /usr/local/cuda-8.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-8.0/bin

Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-8.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 361.00 is required for CUDA 8.0 functionality to work.
To install the driver using this installer, run the following command, replacing  with the name of this run file:
    sudo .run -silent -driver

然后增加环境变量到~/.bashrc文件里:

export PATH=/usr/local/cuda-8.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH

运行下面的命令就可以显示cuda 8.0的信息了:

source ~/.bashrc 
nvcc -V 

我的显示信息为:

(base) ➜  data nvcc -V   
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:03_CST_2017
Cuda compilation tools, release 8.0, V8.0.61

cudnn安装

cp cudnn-8.0-linux-x64-v6.0.solitairetheme8 cudnn-8.0-linux-x64-v6.0.tgz
tar -xvf cudnn-8.0-linux-x64-v6.0.tgz 
cd cuda/
sudo cp include/cudnn.h /usr/local/cuda-8.0/include 
sudo cp lib64/libcudnn* /usr/local/cuda-8.0/lib64

参考文献

[1]. 在ubuntu上安装多个版本的CUDA,并且可以随时切换. https://blog.csdn.net/ksws0292756/article/details/80120561

[2].ubuntu 安装CUDA时,找不到 InstalUtils.pm解决方案. https://blog.csdn.net/u013406197/article/details/90172039

[3]. cudnn6.0的安装简单教程. https://blog.csdn.net/w5688414/article/details/78195505

你可能感兴趣的:(linux学习,tensorflow)