Positive children usually take the CPU to run the eight Tensorflow it does not matter, until recently I ran a RNN model after a epoch s + 300 of the CPU so I really can not stand it, so I chose the bitter experience of the GPU to run the algorithm . But it is embarrassing, I use the agricultural enterprises of graphics, will not escape the mainstream CUDA, after two or three days after the configuration, and finally successfully configured the open OpenCL support Tensorflow, ran LSTM still very pleasant.
Install Ubuntu 16.04 LTS
Because the current agricultural enterprises has essentially fglrx does not support it, and for my graphics card Advanced Micro Devices, Inc. [AMD/ATI] Mars [Radeon HD 8670A/8670M/8750M]
is, fglrx driver is always a bunch of questions, so I decisively chose this version 16.04. In this version, the open-source drivers are supported, such as Radeon
well AMD GPU Pro
.
Ready to work
First you need to install cmake
as well as other tools to compile frequently required.
|
|
Next, you need to install the famous boost
andlibssl
|
|
安装 Python
建议使用anaconda来安装Python 3.5。
现在主流的包和库都支持Python 3并且有些库(例如Django)已经明确宣称不支持Python 2,同时,Python 3 对Unicode良好的兼容性对于开发有中文的数据来说,非常省心。
其实这里推荐anaconda的主要原因还是因为Theano
。因为如果你想使用带有OpenCL
支持的Theano
,你就必须使用其后端libgpuarray
。而这个包在issue
里面明确对不使用conda
安装该库的用户提供非常有限的支持。还有一点就是anaconda自带了众多的科学计算库,一步到位确实非常省心。
对不使用anaconda的少年的说明
对于不想安装anaconda的少年(conda速度真的不多说,推荐使用清华tuna的源),自然我提出一些小小的参考。
你需要安装numpy等一众科学计算的库,你可能还需要安装BLAS、MKL等一系列库以求支持TF。建议知道这些东西的人手工配齐库。
如果遇到问题,百度或者google吧。
安装OpenCL
就我来说,AMD网上的驱动几乎不能成功。所以我选择了一种非常优雅的方式,apt安装。
|
|
移除这个PPA
|
|
更多的信息你可以参考这篇博文:https://laanwj.github.io/2016/05/06/opencl-ubuntu1604.html
为Theano安装的准备
如果你不需要安装Theano,那么你可以跳过这一项,下面这项目会自动引用系统自带的Python,与下面所说的安装Python有所出入。
Theano sucks
为theano
的支持安装clblas
库
|
|
接下来安装libgpuarray
|
|
安装 Theano
|
|
安装Tensorflow
安装computeCPP
这个库真的挺奇怪的,但是安装带有OpenCL支持的Tensorflow却不得不需要这个奇怪的库。首先你需要在其官网上注册一个账号来下载ComputeCPP,和牙膏厂一个尿性,然后解压后放到/usr/lib
或者其他你能看得到的位置。
Tensorflow对于OpenCL的支持至今都是很有限的,所以你需要的是使用源码来安装Tensorflow而不是优雅的使用pip3 install tensorflow-gpu
(都怪农企喜欢造挖矿卡)
直接参考Tensorflow的如何编译源码来安装就可以了。需要注意的是在enable Tensorflow support那块需要选择是,而CUDA那一块则要选择否。假设出现了要你选择OpenCL路径地方的时候,他显示的那个路径一般都是没有错的。所以这个时候你需要检查那个路径下是否生成了libOpencl.so
这类型的文档。
这里就是英文的说明了:https://www.tensorflow.org/install/install_sources
安装Keras
一句话 pip3 install keras
如何知道我是用了OpenCL
和使用CPU一般出现的TF让你编译TF到那些奇奇怪怪的(AXS是什么)格式,我的就会出现这种信息:
|
|
postscript
In order to pip install quickly, you can use some image library, such as source USTC, Taobao and Tsinghua tuna and the like. Here I would rather recommend students (such as juvenile side Village Polytechnic) using Qinghua source to avoid sharp McNair kill. The following method is used:
https://mirrors.tuna.tsinghua.edu.cn/help/pypi/
Then Theano how I did not installed this, is libgpuarray limited graphics support on my show, and I can not read anyway error Orz.
Finally, I wish computers do not explode.
Original link large column https://www.dazhuanlan.com/2019/08/18/5d585c96d8131/