当前位置: 56net亚洲必嬴 > 操作系统 > 正文

56net亚洲必嬴:Ubuntu16.04+GTX1080+CUDA8.0+OpenCV3.1.0+c

时间:2019-11-01 13:25来源:操作系统
目录 1.本科目对应的条件 system:ubuntu-16.04-desktop-amd64.iso cuda:cuda_8.0.44_linux-16.04.run cudnn:cudnn-8.0-linux-x64-v5.1.tgz caffe: 设置显卡驱动 系统设置→软件和立异→附加驱动 选择 使用NVIDIA

目录

56net亚洲必嬴 1

1.本科目对应的条件

system:ubuntu-16.04-desktop-amd64.iso
cuda:cuda_8.0.44_linux-16.04.run
cudnn:cudnn-8.0-linux-x64-v5.1.tgz
caffe:

设置显卡驱动

系统设置→软件和立异→附加驱动
选择使用NVIDIA binary driver - version 375.66 来自 nvidia-375 应用改过
设置到位后重启
在顶峰中输入nvidia-smi

  • 1. 装置显卡驱动
  • 2. 安装CUDACUDNN
  • 3. 安装TensorFlow-gpu
  • 测试

  紧接着上意气风发篇的篇章《深度学习(TensorFlow)遭逢搭建:(二)Ubuntu16.04+1080Ti显卡驱动》,那篇小说,首要教授怎样设置CUDA+CUDNN,可是前提是我们是现已把NVIDIA显卡驱动装置好了

2.安装Ubuntu-16.04

略。安装基本更新。

sudo apt-get update
sudo apt-get upgrade

CUDA

官方网址下载
PyTorch 0.3 支持 cuda9.0

56net亚洲必嬴 2

CUDA下载

运行
cuda8.0
sudo sh cuda_8.0.61_375.26_linux.run
cuda9.0
sudo sh cuda_9.0.176_384.81_linux.run

显卡驱动装置选拔n
其余选拔y

增加景况变量

sudo gedit /etc/profile

最后增加
cuda8.0

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

cuda9.0

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

运行

source /etc/profile

测试

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

56net亚洲必嬴 3

设置成功

1. 设置显卡驱动

  • 检查实验显卡驱动及型号
$ sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
  • 添加ELPepo源
$ sudo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
  • 安装NVIDIA驱动物检疫查评定
$ sudo yum install nvidia-detect
$ nvidia-detect -v

$ yum -y install kmod-nvidia

3.安装cuda-8.0

cuDNN

官方网站注册后下载
选择cuDNN5.1或者cuDNN6(TensorFlow 1.3需要cuDNN6.0),下载cuDNN后解压,

Download cuDNN v5.1 (Jan 20, 2017), for CUDA 8.0→cuDNN v5.1 Library for Linux
Download cuDNN v6.0 (April 27, 2017), for CUDA 8.0→cuDNN v6.0 Library for Linux
[Download cuDNN v7.0.5 (Dec 5, 2017), for CUDA 9.0]→cuDNN v7.0.5 Library for Linux

cuda8.0

sudo cp cuda/include/cudnn.h /usr/local/cuda-8.0/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda-8.0/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda-8.0/lib64/libcudnn*

cuda9.0

sudo cp cuda/include/cudnn.h /usr/local/cuda-9.0/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda-9.0/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda-9.0/lib64/libcudnn*

2. 安装CUDACUDNN

一、安装CUDA

  CUDA(Compute Unified Device Architecture),是英伟达公司生产的少年老成种基于新的互相编制程序模型和下令集框架结构的通用总括架构,它能动用IntelGPU的并行总结引擎,比CPU更敏捷的消除多数犬牙交错总括职分,想利用GPU就必定要使用CUDA。

3.1 安装显卡驱动

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-367

56net亚洲必嬴 4

重启系统,使新驱动生效。使用英特尔-smi测量试验是还是不是安装成功。
56net亚洲必嬴 5

参考资料

Ubuntu 16.04 CUDA 8 cuDNN 5.1安装

2.1 cuda

  • 官方网站下载cuda,最棒下载9.0版本:
  • 选择适合自个儿机器的装置,接受runfile(local)下载到centos中:
    56net亚洲必嬴 6
  • 亟需下载全数补丁,下载后装置cuda:
$ sudo sh cuda_9.0.176_384.81_linux.run
  • 测验cuda是或不是安装
$ cd /usr/local/cuda/samples/1_Utilities/deviceQuery
$ sudo make
$ ./deviceQuery

结果:
56net亚洲必嬴 7

1.1、下载CUDA

  首先在官方网站()下载对应的CUDA,如图所示:

56net亚洲必嬴 8

只顾请必需下载runfile文件(后缀为.run),不能够是此外文件。依旧直接通过wget命令下载:

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

 如图所示:

56net亚洲必嬴 9

3.2 安装cuda-Toolkit

2.2 cudnn

  • 下载cudnn文件,须求注册账号。
  • 设置下载好的cuDNN安装包,假让你安装cuda的目录为默许目录,就足以一贯利用如下指令安装:
tar -xvf cudnn-9.0-linux-x64-v7.1.tgz -C /usr/local/

1.2、安装CUDA(必必要按梯次实施)

  下载实现后先施行安装相关信赖的吩咐,假诺不先实行安装依赖包,前面安装CUDA会以下错误报错:

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

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: y

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

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

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/cmfchina ...
Copying samples to /home/cmfchina/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/cmfchina, 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 <CudaInstaller> with the name of this run file:
    sudo <CudaInstaller>.run -silent -driver

  全部大家自然要设置顺序实行设置,先安装重视的库文件。

(1)安装缺失的依附库文件

一声令下如下:

sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-devlibgl1-mesa-glx libglu1  #安装依赖库

 

56net亚洲必嬴 10

(2)安装实践文书

sudo sh cuda_8.0.61_375.26_linux.run  #执行安装文件

  注意:安装进度中会提醒您实行部分分明操作,首先是担当服务条约,输入accept确认,然后会提醒是或不是安装cuda tookit、cuda-example等,均输入Y进行规定。但请介怀,当领会是否安装附带的驱动时,必必要选N!

56net亚洲必嬴 11

  因为前边大家曾经设置好新型的驱动NVIDIA381,附带的驱动是旧版本的同不经常候会有标题,所以不要接收设置驱动。其他的都一直私下认可或许采纳是就可以。

(3)设置遭受变量

  •   输入指令,编辑境况变量配置文件

    sudo vim ~/.bashrc

  •   在文件末端追加以下两行代码(按钮“i”举办编写制定操作)

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

  •   保存退出(按“!wq”),实施下边发号出令,使意况变量马上见到效果

    #意况变量即刻生效 sudo source ~/.bashrc
    sudo ldconfig

 如图所示:

56net亚洲必嬴 12

(4)检查cuda是不是配备不错

  到这一步,基本的CUDA已经安装完结了,大家得以经过以下命令查看CUDA是还是不是安插不错:

nvcc --version

  如图所示:

56net亚洲必嬴 13

(5)测试CUDA的sammples

  为啥要求设置cuda samples?一方面为了后边学习cuda使用,其他方面,能够核实cuda是或不是真正安装成功。假若cuda samples全体编写翻译通过,未有二个Error新闻(Warning忽略),那么就认证成功地安装了cuda。若是最终生机勃勃行尽管显示PASS,不过编写翻译过程中有E奥迪Q5ROLacrosse,请自行英特网搜索相关错误音讯解决未来。

# 切换到cuda-samples所在目录
cd /usr/local/cuda-8.0/samples 或者 cd /home/NVIDIA_CUDA-8.0_Samples 

# 没有make,先安装命令 sudo apt-get install cmake,-j是最大限度的使用cpu编译,加快编译的速度
make –j

# 编译完毕,切换release目录(/usr/local/cuda-8.0/samples/bin/x86_64/linux/release完整目录)
cd ./bin/x86_64/linux/release

# 检验是否成功,运行实例
./deviceQuery 

# 可以认真看看自行结果,它显示了你的NVIDIA显卡的相关信息,最后能看到Result = PASS就算成功。

如图所示:

56net亚洲必嬴 14

56net亚洲必嬴 15

 输出结果来看显卡相关新闻,何况最终Result = PASS ,那注脚CUDA才真的完全安装成功了


3.2.1 实施安装文件

./cuda_8.0.44_linux-16.04.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 367.48? ((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/kinghorn ]: /usr/local/cuda-8.0
Installing the CUDA Toolkit in /usr/local/cuda-8.0 ...
Finished copying samples.
===========
= Summary =
===========
Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-8.0
Samples:  Installed in /usr/local/cuda-8.0

56net亚洲必嬴 16

2.3 遭逢变量设置

  • 境况变量
$ vim ~/.bashrc
在其最后添加:
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDA_HOME=/usr/local/cuda
  • cuDNN建构连接
$ cd /usr/local/cuda/lib64
$ sudo rm -rf libcudnn.so libcudnn.so.7         #删除原有版本号,版本号在cudnn/lib64中查询
$ sudo ln -s libcudnn.so.7.0.5 libcudnn.so.7    #生成软连接,注意自己下载的版本号
$ sudo ln -s libcudnn.so.7 libcudnn.so 
$ sudo ldconfig     #立即生效

二、安装cuDNN

②装置意况变量

vi /home/xxx/.bashrc

剧情如下:

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

使意况变量生效

source /home/xxx/.bashrc

③将cuda库增添到系统动态库处理器

sudo vi /etc/ld.so.conf.d/cuda.conf

添加:

/usr/local/cuda/lib64

施行ldconfig使新加的库生效

sudo ldconfig

编辑:操作系统 本文来源:56net亚洲必嬴:Ubuntu16.04+GTX1080+CUDA8.0+OpenCV3.1.0+c

关键词: