狠狠撸

狠狠撸Share a Scribd company logo
深度学习环境搭建
系统 : Linux centos 7.6 ,自带 python2.75
GPU: TITAN X * 2
CPU: Intel(R) Xeon(R) CPU E5-2609 v4 @ 1.70GHz * 2
搭建流程:NVIDIA驱动—》CUDA-》CUDNN-》Anaconda-》Tensor?ow-》Keras-》Pytorch
注:本文所有操作均在root权限下执行,对于非root用户,若命令执行不成功,可以在前面加上sudo。本文的深度
学习框架都通过conda安装,原因是conda安装较为方便,可以自动安装所需依赖。
安装NVIDIA显卡驱动
从NVIDIA官网选择合适的驱动下载,驱动下载地址
注意:安装NVIDIA的驱动程序前需要关闭X sever(关闭方法),如果是Centos,则还需要关闭系统自带的
Nouveau驱动(关闭方法),关闭后注意以文本模式重启系统,Linux设置文本启动的方法。
驱动下载好之后,进入驱动文件存放的目录,运行文件
验证是否安装成功
如果安装成功,输入命令后会显示GPU信息
./NVIDIA-Linux-x86_64-375.39.run ?1
nvidia-smi1
安装CUDA
选择合适版本下载安装, 下载地址
下载完成后 ,进入安装文件存放目录
然后进入安装选项,首先同意协议,其次注意第一项驱动安装选择 no ,因为前面已经安装过,后面都选 yes 即
可,安装完成后,需添加环境变量。
在 /etc/profile 最后添加
加载环境变量
测试是否安装成功
如果正常,则会显示设备查询信息
安装CUDNN
在官网下载与CUDA版本对应的CUDNN,可能需要科学上网,下载地址
下载该文件需要先注册成为NVIDIA的开发者,用邮箱注册即可
下载完成后 解压并拷贝到cuda的安装目录下
安装Anaconda
sh cuda_10.0.130_410.48_linux1
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda/bin:$PATH
1
2
source /etc/profile1
cd /usr/local/cuda/samples/1_Utilities/deviceQuery
make
./deviceQuery
1
2
3
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
...
1
2
3
tar -zxvf cudnn-*.tgz
cp cuda/include/cudnn.h /usr/local/cuda/include
cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
chmod a+r /usr/local/cuda/include/cudnn.h
chmod a+r /usr/local/cuda/lib64/libcudnn*
1
2
3
4
5
Anaconda有python2与python3两种版本,选择合适的下载,如果是IBM power8,power9处理器则选择对应的
Installer。
安装选项都选 yes 即可。
安装Tensor?ow
进入python 环境,验证是否安装成功
正常输出为:
安装Keras
安装Pytorch
在官网选择合适版本的pytorch,选择好之后,命令会自动给出。
conda create -n tensorflow python=3.7 #创建名为Tensorflow的虚拟环境
source activate tensorflow #激活环境
pip install tensorflow-gpu #安装Tensorflow的GPU版
#如果速度慢,可以将上一句更改为如下命令,从豆瓣镜像下载
pip install tensorflow-gpu -i https://pypi.doubanio.com/simple/
1
2
3
4
5
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
1
2
3
4
Hello, TensorFlow!1
conda install keras-gpu #注意选择gpu版本
python
import keras #验证是否安装成功
1
2
3
参考文档
Centos7下的深度学习环境配置
linux-Centos7安装python3并与python2共存
Linux查看GPU信息
Anaconda介绍、安装及使用教程
python
import pytorch
1
2

More Related Content

What's hot (20)

OpenSTACK Installation on Ubuntu
OpenSTACK Installation on UbuntuOpenSTACK Installation on Ubuntu
OpenSTACK Installation on Ubuntu
康志強 大人
?
基于笔齿贰实现部署尝颈苍耻虫服务器
基于笔齿贰实现部署尝颈苍耻虫服务器基于笔齿贰实现部署尝颈苍耻虫服务器
基于笔齿贰实现部署尝颈苍耻虫服务器
ekoing
?
利用Cent Os快速构建自己的发行版
利用Cent Os快速构建自己的发行版利用Cent Os快速构建自己的发行版
利用Cent Os快速构建自己的发行版
xingsu1021
?
下一代虚拟存储解决方案:痴补补颈
下一代虚拟存储解决方案:痴补补颈下一代虚拟存储解决方案:痴补补颈
下一代虚拟存储解决方案:痴补补颈
ITband
?
单机硬件(最新)
单机硬件(最新)单机硬件(最新)
单机硬件(最新)
paulqi
?
摆精彩回顾闭尝颈苍耻虫新手教程
摆精彩回顾闭尝颈苍耻虫新手教程摆精彩回顾闭尝颈苍耻虫新手教程
摆精彩回顾闭尝颈苍耻虫新手教程
NJU OPEN
?
Installation and configuration 11g r2 asm using job role separation(grid & or...
Installation and configuration 11g r2 asm using job role separation(grid & or...Installation and configuration 11g r2 asm using job role separation(grid & or...
Installation and configuration 11g r2 asm using job role separation(grid & or...
Zhaoyang Wang
?
Unixtoolbox zh cn
Unixtoolbox zh cnUnixtoolbox zh cn
Unixtoolbox zh cn
xdboy2006
?
20121111 linux intro
20121111 linux intro20121111 linux intro
20121111 linux intro
Chang Mt
?
贬补诲辞辞辫平台搭建
贬补诲辞辞辫平台搭建贬补诲辞辞辫平台搭建
贬补诲辞辞辫平台搭建
Liyang Tang
?
2, installation
2, installation2, installation
2, installation
ted-xu
?
Installation and configuration 11g r2
Installation and configuration 11g r2Installation and configuration 11g r2
Installation and configuration 11g r2
Zhaoyang Wang
?
20030623 linuxbasic and-security
20030623 linuxbasic and-security20030623 linuxbasic and-security
20030623 linuxbasic and-security
建融 黃
?
如何硬盘安装耻产耻苍迟耻8.10
如何硬盘安装耻产耻苍迟耻8.10如何硬盘安装耻产耻苍迟耻8.10
如何硬盘安装耻产耻苍迟耻8.10
wensheng wei
?
VMware Rhel5 Oracle10g Rac
VMware Rhel5 Oracle10g RacVMware Rhel5 Oracle10g Rac
VMware Rhel5 Oracle10g Rac
guest77e407
?
Runtime upgrade linux
Runtime upgrade linuxRuntime upgrade linux
Runtime upgrade linux
cri fan
?
尝颈苍耻虫安全配置终极指南
尝颈苍耻虫安全配置终极指南尝颈苍耻虫安全配置终极指南
尝颈苍耻虫安全配置终极指南
wensheng wei
?
OpenSTACK Installation on Ubuntu
OpenSTACK Installation on UbuntuOpenSTACK Installation on Ubuntu
OpenSTACK Installation on Ubuntu
康志強 大人
?
基于笔齿贰实现部署尝颈苍耻虫服务器
基于笔齿贰实现部署尝颈苍耻虫服务器基于笔齿贰实现部署尝颈苍耻虫服务器
基于笔齿贰实现部署尝颈苍耻虫服务器
ekoing
?
利用Cent Os快速构建自己的发行版
利用Cent Os快速构建自己的发行版利用Cent Os快速构建自己的发行版
利用Cent Os快速构建自己的发行版
xingsu1021
?
下一代虚拟存储解决方案:痴补补颈
下一代虚拟存储解决方案:痴补补颈下一代虚拟存储解决方案:痴补补颈
下一代虚拟存储解决方案:痴补补颈
ITband
?
单机硬件(最新)
单机硬件(最新)单机硬件(最新)
单机硬件(最新)
paulqi
?
摆精彩回顾闭尝颈苍耻虫新手教程
摆精彩回顾闭尝颈苍耻虫新手教程摆精彩回顾闭尝颈苍耻虫新手教程
摆精彩回顾闭尝颈苍耻虫新手教程
NJU OPEN
?
Installation and configuration 11g r2 asm using job role separation(grid & or...
Installation and configuration 11g r2 asm using job role separation(grid & or...Installation and configuration 11g r2 asm using job role separation(grid & or...
Installation and configuration 11g r2 asm using job role separation(grid & or...
Zhaoyang Wang
?
Unixtoolbox zh cn
Unixtoolbox zh cnUnixtoolbox zh cn
Unixtoolbox zh cn
xdboy2006
?
20121111 linux intro
20121111 linux intro20121111 linux intro
20121111 linux intro
Chang Mt
?
贬补诲辞辞辫平台搭建
贬补诲辞辞辫平台搭建贬补诲辞辞辫平台搭建
贬补诲辞辞辫平台搭建
Liyang Tang
?
2, installation
2, installation2, installation
2, installation
ted-xu
?
Installation and configuration 11g r2
Installation and configuration 11g r2Installation and configuration 11g r2
Installation and configuration 11g r2
Zhaoyang Wang
?
20030623 linuxbasic and-security
20030623 linuxbasic and-security20030623 linuxbasic and-security
20030623 linuxbasic and-security
建融 黃
?
如何硬盘安装耻产耻苍迟耻8.10
如何硬盘安装耻产耻苍迟耻8.10如何硬盘安装耻产耻苍迟耻8.10
如何硬盘安装耻产耻苍迟耻8.10
wensheng wei
?
VMware Rhel5 Oracle10g Rac
VMware Rhel5 Oracle10g RacVMware Rhel5 Oracle10g Rac
VMware Rhel5 Oracle10g Rac
guest77e407
?
Runtime upgrade linux
Runtime upgrade linuxRuntime upgrade linux
Runtime upgrade linux
cri fan
?
尝颈苍耻虫安全配置终极指南
尝颈苍耻虫安全配置终极指南尝颈苍耻虫安全配置终极指南
尝颈苍耻虫安全配置终极指南
wensheng wei
?

Similar to Dl (20)

Kick start无人值守批量安装linux
Kick start无人值守批量安装linuxKick start无人值守批量安装linux
Kick start无人值守批量安装linux
Yiwei Ma
?
狈补驳颈辞蝉的安装部署和与肠补肠迟颈的整合(濒颈苍耻虫迟辞苍别)
狈补驳颈辞蝉的安装部署和与肠补肠迟颈的整合(濒颈苍耻虫迟辞苍别)狈补驳颈辞蝉的安装部署和与肠补肠迟颈的整合(濒颈苍耻虫迟辞苍别)
狈补驳颈辞蝉的安装部署和与肠补肠迟颈的整合(濒颈苍耻虫迟辞苍别)
Yiwei Ma
?
Proxmox: 建立自己的虛擬主機
Proxmox: 建立自己的虛擬主機Proxmox: 建立自己的虛擬主機
Proxmox: 建立自己的虛擬主機
維泰 蔡
?
Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境
Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境
Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境
dbabc
?
0118 Windows Server 2008 的伺服器核心 (Server Core)
0118 Windows Server 2008 的伺服器核心 (Server Core)0118 Windows Server 2008 的伺服器核心 (Server Core)
0118 Windows Server 2008 的伺服器核心 (Server Core)
Timothy Chen
?
unix toolbox 中文版
unix toolbox 中文版unix toolbox 中文版
unix toolbox 中文版
Jie Bao
?
Linuxguide4f2e
Linuxguide4f2eLinuxguide4f2e
Linuxguide4f2e
tb-vertical-guide
?
附錄--Anaconda installation
附錄--Anaconda installation附錄--Anaconda installation
附錄--Anaconda installation
艾鍗科技
?
Configuration tutorial for pytorch environment under windows.pdf
Configuration tutorial for pytorch environment under windows.pdfConfiguration tutorial for pytorch environment under windows.pdf
Configuration tutorial for pytorch environment under windows.pdf
shuaihaohan135
?
The New Process No. 1 of Linux -- SystemD
The New Process No. 1 of Linux -- SystemDThe New Process No. 1 of Linux -- SystemD
The New Process No. 1 of Linux -- SystemD
freedman6022e20
?
如何让碍别谤补蝉能在搁语言中运作冲安装教学
如何让碍别谤补蝉能在搁语言中运作冲安装教学如何让碍别谤补蝉能在搁语言中运作冲安装教学
如何让碍别谤补蝉能在搁语言中运作冲安装教学
Yen-Ting Su
?
Linux network monitoring hands-on pratice
Linux network monitoring hands-on praticeLinux network monitoring hands-on pratice
Linux network monitoring hands-on pratice
Kenny (netman)
?
5, system admin
5, system admin5, system admin
5, system admin
ted-xu
?
X64服务器 lamp服务器部署标准 new
X64服务器 lamp服务器部署标准 newX64服务器 lamp服务器部署标准 new
X64服务器 lamp服务器部署标准 new
Yiwei Ma
?
础颈虫操作系统培训文档
础颈虫操作系统培训文档础颈虫操作系统培训文档
础颈虫操作系统培训文档
lwj2012
?
南投替代役整理组数位典藏报告
南投替代役整理组数位典藏报告南投替代役整理组数位典藏报告
南投替代役整理组数位典藏报告
Bo-Yi Wu
?
Ruby on Rails 開發環境建置 for Ubuntu
Ruby on Rails 開發環境建置 for UbuntuRuby on Rails 開發環境建置 for Ubuntu
Ruby on Rails 開發環境建置 for Ubuntu
MarsZ Chen
?
Gentoo linux
Gentoo linuxGentoo linux
Gentoo linux
Jiang Yan-Ting
?
Kick start无人值守批量安装linux
Kick start无人值守批量安装linuxKick start无人值守批量安装linux
Kick start无人值守批量安装linux
Yiwei Ma
?
狈补驳颈辞蝉的安装部署和与肠补肠迟颈的整合(濒颈苍耻虫迟辞苍别)
狈补驳颈辞蝉的安装部署和与肠补肠迟颈的整合(濒颈苍耻虫迟辞苍别)狈补驳颈辞蝉的安装部署和与肠补肠迟颈的整合(濒颈苍耻虫迟辞苍别)
狈补驳颈辞蝉的安装部署和与肠补肠迟颈的整合(濒颈苍耻虫迟辞苍别)
Yiwei Ma
?
Proxmox: 建立自己的虛擬主機
Proxmox: 建立自己的虛擬主機Proxmox: 建立自己的虛擬主機
Proxmox: 建立自己的虛擬主機
維泰 蔡
?
Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境
Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境
Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境
dbabc
?
0118 Windows Server 2008 的伺服器核心 (Server Core)
0118 Windows Server 2008 的伺服器核心 (Server Core)0118 Windows Server 2008 的伺服器核心 (Server Core)
0118 Windows Server 2008 的伺服器核心 (Server Core)
Timothy Chen
?
unix toolbox 中文版
unix toolbox 中文版unix toolbox 中文版
unix toolbox 中文版
Jie Bao
?
附錄--Anaconda installation
附錄--Anaconda installation附錄--Anaconda installation
附錄--Anaconda installation
艾鍗科技
?
Configuration tutorial for pytorch environment under windows.pdf
Configuration tutorial for pytorch environment under windows.pdfConfiguration tutorial for pytorch environment under windows.pdf
Configuration tutorial for pytorch environment under windows.pdf
shuaihaohan135
?
The New Process No. 1 of Linux -- SystemD
The New Process No. 1 of Linux -- SystemDThe New Process No. 1 of Linux -- SystemD
The New Process No. 1 of Linux -- SystemD
freedman6022e20
?
如何让碍别谤补蝉能在搁语言中运作冲安装教学
如何让碍别谤补蝉能在搁语言中运作冲安装教学如何让碍别谤补蝉能在搁语言中运作冲安装教学
如何让碍别谤补蝉能在搁语言中运作冲安装教学
Yen-Ting Su
?
Linux network monitoring hands-on pratice
Linux network monitoring hands-on praticeLinux network monitoring hands-on pratice
Linux network monitoring hands-on pratice
Kenny (netman)
?
5, system admin
5, system admin5, system admin
5, system admin
ted-xu
?
X64服务器 lamp服务器部署标准 new
X64服务器 lamp服务器部署标准 newX64服务器 lamp服务器部署标准 new
X64服务器 lamp服务器部署标准 new
Yiwei Ma
?
础颈虫操作系统培训文档
础颈虫操作系统培训文档础颈虫操作系统培训文档
础颈虫操作系统培训文档
lwj2012
?
南投替代役整理组数位典藏报告
南投替代役整理组数位典藏报告南投替代役整理组数位典藏报告
南投替代役整理组数位典藏报告
Bo-Yi Wu
?
Ruby on Rails 開發環境建置 for Ubuntu
Ruby on Rails 開發環境建置 for UbuntuRuby on Rails 開發環境建置 for Ubuntu
Ruby on Rails 開發環境建置 for Ubuntu
MarsZ Chen
?

Dl

  • 1. 深度学习环境搭建 系统 : Linux centos 7.6 ,自带 python2.75 GPU: TITAN X * 2 CPU: Intel(R) Xeon(R) CPU E5-2609 v4 @ 1.70GHz * 2 搭建流程:NVIDIA驱动—》CUDA-》CUDNN-》Anaconda-》Tensor?ow-》Keras-》Pytorch 注:本文所有操作均在root权限下执行,对于非root用户,若命令执行不成功,可以在前面加上sudo。本文的深度 学习框架都通过conda安装,原因是conda安装较为方便,可以自动安装所需依赖。 安装NVIDIA显卡驱动 从NVIDIA官网选择合适的驱动下载,驱动下载地址 注意:安装NVIDIA的驱动程序前需要关闭X sever(关闭方法),如果是Centos,则还需要关闭系统自带的 Nouveau驱动(关闭方法),关闭后注意以文本模式重启系统,Linux设置文本启动的方法。 驱动下载好之后,进入驱动文件存放的目录,运行文件 验证是否安装成功 如果安装成功,输入命令后会显示GPU信息 ./NVIDIA-Linux-x86_64-375.39.run ?1 nvidia-smi1
  • 2. 安装CUDA 选择合适版本下载安装, 下载地址 下载完成后 ,进入安装文件存放目录 然后进入安装选项,首先同意协议,其次注意第一项驱动安装选择 no ,因为前面已经安装过,后面都选 yes 即 可,安装完成后,需添加环境变量。 在 /etc/profile 最后添加 加载环境变量 测试是否安装成功 如果正常,则会显示设备查询信息 安装CUDNN 在官网下载与CUDA版本对应的CUDNN,可能需要科学上网,下载地址 下载该文件需要先注册成为NVIDIA的开发者,用邮箱注册即可 下载完成后 解压并拷贝到cuda的安装目录下 安装Anaconda sh cuda_10.0.130_410.48_linux1 export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH export PATH=/usr/local/cuda/bin:$PATH 1 2 source /etc/profile1 cd /usr/local/cuda/samples/1_Utilities/deviceQuery make ./deviceQuery 1 2 3 ./deviceQuery Starting... CUDA Device Query (Runtime API) version (CUDART static linking) ... 1 2 3 tar -zxvf cudnn-*.tgz cp cuda/include/cudnn.h /usr/local/cuda/include cp cuda/lib64/libcudnn* /usr/local/cuda/lib64 chmod a+r /usr/local/cuda/include/cudnn.h chmod a+r /usr/local/cuda/lib64/libcudnn* 1 2 3 4 5
  • 3. Anaconda有python2与python3两种版本,选择合适的下载,如果是IBM power8,power9处理器则选择对应的 Installer。 安装选项都选 yes 即可。 安装Tensor?ow 进入python 环境,验证是否安装成功 正常输出为: 安装Keras 安装Pytorch 在官网选择合适版本的pytorch,选择好之后,命令会自动给出。 conda create -n tensorflow python=3.7 #创建名为Tensorflow的虚拟环境 source activate tensorflow #激活环境 pip install tensorflow-gpu #安装Tensorflow的GPU版 #如果速度慢,可以将上一句更改为如下命令,从豆瓣镜像下载 pip install tensorflow-gpu -i https://pypi.doubanio.com/simple/ 1 2 3 4 5 import tensorflow as tf hello = tf.constant('Hello, TensorFlow!') sess = tf.Session() print(sess.run(hello)) 1 2 3 4 Hello, TensorFlow!1 conda install keras-gpu #注意选择gpu版本 python import keras #验证是否安装成功 1 2 3