电玩城打鱼捕鱼-专业24小时上下分

电玩城打鱼捕鱼源码编译,研究实践笔记

六月 6th, 2019  |  电玩城捕鱼系统简介

一、Caffe、TensorFlow、MXnet三个开源库对比
http://www.linuxidc.com/Linux/2016-07/133222.htm
选择首先学习TensorFlow

Ubuntu 环境 TensorFlow 源码编译安装

基于(Ubuntu 14.04LTS/Ubuntu 16.04LTS/)

二、深度学习研究

一、编译环境

TensorFlow在图像识别中的应用
http://www.linuxidc.com/Linux/2016-07/133227.htm

1) 安装 pip

sudo apt-get install python-pip python-dev

深度卷积神经网络的模型在困难的视觉识别任务中取得了理想的效果 ——
达到人类水平,在某些领域甚至超过。

2)安装JDK 8

sudo apt-get install openjdk-8-jdk

Ubuntu 14.04 LTS 还需要:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update && sudo apt-get install oracle-java8-installer

电玩城打鱼捕鱼 1

3)安装Bazel

三、TensorFlow安装:

A: 添加 Bazel URI 到 package source

echo “deb [arch=amd64]
stable jdk1.8” | sudo tee /etc/apt/sources.list.d/bazel.list
curl | sudo apt-key add –

安装环境:Ubuntu15.10_64

B:更新&安装

sudo apt-get update
sudo apt-get install bazel

如果已经安装过,更新则:

sudo apt-get upgrade bazel

1、下载源码
sudo apt-get install git

C:设置环境变量

一次执行

export PATH=”$PATH:$HOME/bin”

git clone – -recurse-submodules

直接添加到.bashrc ,打开bashrc 最后一行加入(PATH=”$PATH:$HOME/bin”)

vim ~/.bashrc
PATH=”$PATH:$HOME/bin”

–recurse-submodules 参数必须要加, 用于获取 TesorFlow 依赖的 protobuf

4)安装其他依赖包

sudo apt-get install libcupti-dev
sudo pip install –upgrade protobuf
sudo apt-get install git python-dev python3-dev python-numpy
python3-numpy python-six python3-six build-essential python-pip
python3-pip python-virtualenv swig python-wheel python3-wheel
libcurl3-dev libcupti-dev
apt-get install libglib2.0-dev zlib1g-dev
sudo apt-get install librdmacm-dev

电玩城打鱼捕鱼 2

5) 如果要GPU支持需要

Cloning into 'tensorflow'...
remote: Counting objects: 40348, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 40348 (delta 0), reused 0 (delta 0), pack-reused 40341
Receiving objects: 100% (40348/40348), 35.45 MiB | 404.00 KiB/s, done.
Resolving deltas: 100% (29338/29338), done.
Checking connectivity... done.
Submodule 'google/protobuf' (https://github.com/google/protobuf.git) registered for path 'google/protobuf'
Cloning into 'google/protobuf'...
remote: Counting objects: 32801, done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 32801 (delta 12), reused 0 (delta 0), pack-reused 32767
Receiving objects: 100% (32801/32801), 31.27 MiB | 1.27 MiB/s, done.
Resolving deltas: 100% (22019/22019), done.
Checking connectivity... done.
Submodule path 'google/protobuf': checked out 'fb714b3606bd663b823f6960a73d052f97283b74'

A:安装/更新GPU驱动

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update

2、安装Bazel

B:Nvidia Toolkit 8.0 & CudNN

sudo sh cuda_8.0.61_375.26_linux.run –override –silent
–toolkit
会将cuda安装到: /usr/local/cuda

OpenJDK做为GPL许可(GPL-licensed)的Java平台的开源化实现,Sun正式发布它已经六年有余。从发布那一时刻起,Java社区的大众们就又开始努力学习,以适应这个新的开源代码基础(code-base)。
[1]
OpenJDK在2013年发展迅速,被著名IT杂志SD Times评选为2013 SD Times
100,位于“极大影响力”分类第9位。

Google日前开源了他们内部使用的构建工具Bazel。
Bazel是一个类似于Make的工具,是Google为其内部软件开发的特点量身定制的工具,如今Google使用它来构建内部大多数的软件。它的功能有诸多亮点:
多语言支持:目前Bazel默认支持Java、Objective-C和C++,但可以被扩展到其他任何变成语言。

高级构建描述语言:项目是使用一种叫BUILD的语言来描述的,它是一种简洁的文本语言,它把一个项目视为一个集合,这个集合由一些互相关联的库、二进制文件和测试用例组成。相反,像Make这样的工具,需要去描述每个文件如何调用编译器。

多平台支持:同一套工具和相同的BUILD文件可以用来为不同的体系结构构建软件,甚至是不同的平台。在Google,Bazel被同时用在数据中心系统中的服务器应用和手机端的移动应用上。

可重复性:在BUILD文件中,每个库、测试用例和二进制文件都需要明确指定它们的依赖关系。当一个源码文件被修改时,Bazel凭这些依赖来判断哪些部分需要重新构建,以及哪些任务可以并行进行。这意味着所有构建都是增量的,并且相同构建总是产生一样的结果。

可伸缩性:Bazel可以处理大型项目;在Google,一个服务器软件有十万行代码是很常见的,在什么都不改的前提下重新构建这样一个项目,大概只需要200毫秒。

C:安装CudNN

在 下载对应的版本
解压到 /usr/local/cuda

tar -xzvf cudnn-8.0-linux-x64-v6.0.tgz
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
/usr/local/cuda/lib64/libcudnn*

安装Bazel依赖库
sudo apt-get install openjdk-8-jdk openjdk-8-source

D: 配置环境变量

~/.bashrc 添加

export
LD_LIBRARY_PATH=”$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64″
export CUDA_HOME=/usr/local/cuda

电玩城打鱼捕鱼 3

然后使环境变量生效

source ~/.bashrc

oot.pem
Adding debian:E-Tugra_Certification_Authority.pem
Adding debian:Staat_der_Nederlanden_EV_Root_CA.pem
Adding debian:GlobalSign_ECC_Root_CA_-_R4.pem
Adding debian:Certinomis_-_Autorité_Racine.pem
Adding debian:ssl-cert-snakeoil.pem
Adding debian:COMODO_Certification_Authority.pem
done.
Processing triggers for libc-bin (2.21-0ubuntu4) ...
Processing triggers for ca-certificates (20150426ubuntu1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

done.
done.
learning@learning-virtual-machine:~$ 

二、 TensorFlow 源码下载、编译、安装

sudo apt-get install pkg-config zip g++ zlib1g-dev unzip

1)下载tensorflow 源码

git clone

Processing triggers for mime-support (3.54ubuntu1.1) ...
Setting up libstdc++-4.8-dev:amd64 (4.8.4-2ubuntu1~14.04.1) ...
Setting up g++-4.8 (4.8.4-2ubuntu1~14.04.1) ...
Setting up g++ (4:4.8.2-1ubuntu6) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
Setting up unzip (6.0-9ubuntu1.5) ...
Setting up zlib1g-dev:amd64 (1:1.2.8.dfsg-1ubuntu1) ...
@ubuntu:~$ 

2)配置TensorFlow

到TensorFlow的根目录执行

./configure

下载链接:
@ubuntu:~$ chmod +x bazel-0.2.2b-installer-linux-x86_64.sh
@ubuntu:~$ ./bazel-0.2.2b-installer-linux-x86_64.sh –user

注:出于国情原因下面的一定选N

Do you wish to build TensorFlow with Google Cloud Platform support?
[y/N]
Do you wish to build TensorFlow with Amazon S3 File System support?
[Y/n]
Do you wish to build TensorFlow with Hadoop File System support?
[y/N]

Bazel is now installed!

Make sure you have "/home/learning/bin" in your path. You can also activate bash
completion by adding the following line to your ~/.bashrc:
  source /home/learning/.bazel/bin/bazel-complete.bash

See http://bazel.io/docs/getting-started.html to start a new project!
learning@learning-virtual-machine:~$ source /home/learning/.bazel/bin/bazel-complete.bash
learning@learning-virtual-machine:~$ 

 export PATH="$PATH:$HOME/bin"

3)编译安装

bazel编译pip 的安装包,然后通过 pip 安装

sudo apt-get install python-numpy swig python-dev

1) bazel编译

bazel build -c opt //tensorflow/tools/pip_package:build_pip_package

blapack.so.3 (liblapack.so.3) in auto mode
Setting up libpython-dev:amd64 (2.7.5-5ubuntu3) ...
Setting up python2.7-dev (2.7.6-8ubuntu0.2) ...
Setting up python-dev (2.7.5-5ubuntu3) ...
Setting up python-numpy (1:1.8.2-0ubuntu0.1) ...
Setting up swig2.0 (2.0.11-1ubuntu2) ...
Setting up swig (2.0.11-1ubuntu2) ...
Processing triggers for libc-bin (2.19-0ubuntu6.5) ...

2) 生成安装包

bazel-bin/tensorflow/tools/pip_package/build_pip_package
/tmp/tensorflow_pkg

3、

2017年 12月 12日 星期二 13:32:22 CST : === Output wheel file is in: /tmp/tensorflow_pkg

mkdir /tmp/tensorflow_pkg
bazel-bin/tensorflow/tools/pip_package/build_pip_package
/tmp/tensorflow_pkg

pip install /tmp/tensorflow_pkg/tensorflow-0.5.0-py2-none-any.whl

3) 安装

sudo pip install
/tmp/tensorflow_pkg/tensorflow-1.4.0-cp27-cp27mu-linux_x86_64.whl

learning@learning-virtual-machine:~$ pip install /tmp/tensorflow_pkg/tensorflow-0.5.0-py2-none-any.whl
Requirement '/tmp/tensorflow_pkg/tensorflow-0.5.0-py2-none-any.whl' looks like a filename, but the file does not exist
Unpacking /tmp/tensorflow_pkg/tensorflow-0.5.0-py2-none-any.whl
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 304, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1198, in prepare_files
    do_download,
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1365, in unpack_url
    unpack_file_url(link, location, download_dir)
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 640, in unpack_file_url
    unpack_file(from_path, location, content_type, link)
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 640, in unpack_file
    unzip_file(filename, location, flatten=not filename.endswith(('.pybundle', '.whl')))
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 508, in unzip_file
    zipfp = open(filename, 'rb')
IOError: [Errno 2] No such file or directory: '/tmp/tensorflow_pkg/tensorflow-0.5.0-py2-none-any.whl'

Storing debug log for failure in /home/learning/.pip/pip.log
learning@learning-virtual-machine:~$ 
注意: 2)生成安装包的目录,tensorflow-1.4.0-cp27-cp27mu-linux_x86_64.whl在=== Output 提示的 /tmp/tensorflow_pkg下

安装过程会下载一些依赖的包和库,最后成功提示:

Successfully installed absl-py-0.1.6 backports.weakref-1.0.post1
bleach-1.5.0 enum34-1.1.6 funcsigs-1.0.2 html5lib-0.9999999
markdown-2.6.10 mock-2.0.0 numpy-1.13.3 pbr-3.1.1 tensorf

使用pip编译并安装
bazel build -c opt tensorflow/tools/pip_package:build_pip_package

三、遇到问题

learning@learning-virtual-machine:~/tensorflow$ bazel build -c opt tensorflow/tools/pip_package:build_pip_package
Sending SIGTERM to previous Bazel server (pid=17411)... done.
.......................................
INFO: Waiting for response from Bazel server (pid 18433)...
INFO: Downloading from https://bitbucket.org/eigen/eigen/get/50812b426b7c.tar.\
gz: 0B

编译时出现如下错误:

ERROR:
/home/duanyufei/source/TensorFlow/tensorflow/tensorflow/contrib/gdr/BUILD:52:1:
C++ compilation of rule ‘//tensorflow/contrib/gdr:gdr_memory_manager’
failed (Exit 1)
tensorflow/contrib/gdr/gdr_memory_manager.cc:28:27: fatal error:
rdma/rdma_cma.h: No such file or directory
compilation terminated.
Target //tensorflow/tools/pip_package:build_pip_package failed to
build
Use –verbose_failures to see the command lines of failed build
steps.
INFO: Elapsed time: 323.279s, Critical Path: 33.69s
FAILED: Build did NOT complete successfully

出现问题:

解决办法

sudo apt-get install librdmacm-dev

标签:, ,

Your Comments

近期评论

    功能


    网站地图xml地图