概述
下载CUDA
官网下载 按照自己的实际情况进行选择,下载合适的版本。
官方安装指南
注意这里下载的是cuda8.0的runfile(local)文件。
安装CUDA
下载完成后,解压到当前目录,切换到该目录输入:
sh cuda_8.0.44_linux.run –override //_8.0.44是本文采用的版本,安装时根据实际调整。
初始化安装
初始安装是,出现很多选择的选项,直接Ctrl+C,之后的选项参考如下:
Do you accept the previously read EULA?
accept/decline/quit: accept
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64
361.62?
(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: y
Install the CUDA 8.0 Samples?
(y)es/(n)o/(q)uit: y
Enter CUDA Samples Location
[ default is /home ]:
输入accept接受条款
输入n不安装nvidia图像驱动,之前已经安装过了
输入y安装cuda 8.0工具
回车确认cuda默认安装路径:/usr/local/cuda-8.0
输入y用sudo权限运行安装,输入密码
输入y或者n安装或者不安装指向/usr/local/cuda的符号链接
输入y安装CUDA 8.0 Samples,以便后面测试
回车确认CUDA 8.0 Samples默认安装路径。
安装过程
Installing the CUDA Toolkit in /usr/local/cuda-8.0 ...
Missing recommended library: libGLU.so
Missing recommended library: libX11.so
Missing recommended library: libXi.so
Missing recommended library: libXmu.so
Installing the CUDA Samples in /home/zhou ...
Copying samples to /home/zhou/NVIDIA_CUDA-8.0_Samples now...
Finished copying samples.
===========
= Summary =
===========
Driver: Not Selected
Toolkit: Installed in /usr/local/cuda-8.0
Samples: Installed in /home/zhou, but missing recommended
libraries
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
Logfile is /tmp/cuda_install_2961.log
添加环境路径
安装完毕后,再声明一下环境变量,并将其写入到 ~/.bashrc 的尾部:
sudo gedit ~/.bashrc
尾部添加:
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
然后设置环境变量和动态链接库,在命令行输入:
sudo gedit /etc/profile
在打开的文件末尾加入:
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64$LD_LIBRARY_PATH
保存之后,创建链接文件:
sudo gedit /etc/ld.so.conf.d/cuda.conf
在打开的文件中添加如下语句:
/usr/local/cuda/lib64
然后执行:
sudo ldconfig
使链接立即生效。
安装必要的库
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
测试
cd /usr/local/cuda-8.0/samples/1_Utilities/deviceQuery
make -j4
sudo ./deviceQuery
若会输出相应的显卡性能信息,表明cuda安装成功。
cuDNN安装
下载cuDNN,需要注册会员,下载后解压:
tar -zxvf cudnn-8.0-linux-x64-v7.tgz
得到一个cuda文件夹,进入之后会有include文件夹和lib64文件夹
执行下列命令:
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/ sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/ sudo chmod a+r /usr/local/cuda/include/cudnn.h sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
出现的问题:
/usr/local/cuda/lib64/libcudnn.so.7 is not a symbolic link
解决办法:
在cudnn目录中查询链接 发现为空:
cd /usr/local/cuda/lib64
ls -l libcudnn.so.7
重新覆盖 添加软链接:
sudo ln -sf libcudnn.so.7.1.4 libcudnn.so.7
sudo ln -sf libcudnn.so.7 libcudnn.so
此时:
转载于:https://www.cnblogs.com/xiaojianliu/p/9292686.html
最后
以上就是欢呼斑马为你收集整理的ubuntu16.04 NVIDIA CUDA8.0 以及cuDNN安装下载CUDA安装CUDA测试cuDNN安装的全部内容,希望文章能够帮你解决ubuntu16.04 NVIDIA CUDA8.0 以及cuDNN安装下载CUDA安装CUDA测试cuDNN安装所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复