提交 c7694dbd 编写于 作者: T Travis CI

Deploy to GitHub Pages: f0548679

上级 e828be43
......@@ -191,7 +191,7 @@ You can add :code:`-D` argument to pass such options, like:
"WITH_TESTING", "Build unit tests", "OFF"
"WITH_DOC", "Build documentations", "OFF"
"WITH_SWIG_PY", "Build Python SWIG interface for V2 API", "Auto"
"WITH_GOLANG", "Build fault-tolerant parameter server written in go", "ON"
"WITH_GOLANG", "Build fault-tolerant parameter server written in go", "OFF"
"WITH_MKL", "Use MKL as BLAS library, else use OpenBLAS", "ON"
......
......@@ -25,6 +25,12 @@ Users can directly use the published Docker image.
$ docker pull paddlepaddle/paddle:latest-dev-android
```
For users in China, we provide a faster mirror.
```bash
$ docker pull docker.paddlepaddlehub.com/paddle:latest-dev-android
```
### Build the Inference Library
We can run the Docker image we just created to build the inference library of PaddlePaddle for Android using the command below:
......@@ -86,19 +92,19 @@ Android NDK includes everything we need to build the [*standalone toolchain*](ht
- To build the standalone toolchain for `armeabi-v7a` and Android API level 21:
```bash
your/path/to/android-ndk-r14b-linux-x86_64/build/tools/make-standalone-toolchain.sh \
--arch=arm --platform=android-21 --install-dir=your/path/to/arm_standalone_toolchain
```
```bash
your/path/to/android-ndk-r14b-linux-x86_64/build/tools/make-standalone-toolchain.sh \
--arch=arm --platform=android-21 --install-dir=your/path/to/arm_standalone_toolchain
```
The generated standalone toolchain will be in `your/path/to/arm_standalone_toolchain`.
- To build the standalone toolchain for `arm64-v8a` and Android API level 21:
```bash
your/path/to/android-ndk-r14b-linux-x86_64/build/tools/make-standalone-toolchain.sh \
--arch=arm64 --platform=android-21 --install-dir=your/path/to/arm64_standalone_toolchain
```
```bash
your/path/to/android-ndk-r14b-linux-x86_64/build/tools/make-standalone-toolchain.sh \
--arch=arm64 --platform=android-21 --install-dir=your/path/to/arm64_standalone_toolchain
```
The generated standalone toolchain will be in `your/path/to/arm64_standalone_toolchain`.
......
......@@ -406,7 +406,7 @@ For detailed cmake tutorial please refer to <a class="reference external" href="
</tr>
<tr class="row-even"><td>WITH_GOLANG</td>
<td>Build fault-tolerant parameter server written in go</td>
<td>ON</td>
<td>OFF</td>
</tr>
<tr class="row-odd"><td>WITH_MKL</td>
<td>Use MKL as BLAS library, else use OpenBLAS</td>
......
......@@ -199,6 +199,10 @@ $ docker build -t paddle:dev-android . -f Dockerfile.android
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ docker pull paddlepaddle/paddle:latest-dev-android
</pre></div>
</div>
<p>For users in China, we provide a faster mirror.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ docker pull docker.paddlepaddlehub.com/paddle:latest-dev-android
</pre></div>
</div>
</div>
<div class="section" id="build-the-inference-library">
<span id="build-the-inference-library"></span><h3>Build the Inference Library<a class="headerlink" href="#build-the-inference-library" title="Permalink to this headline"></a></h3>
......@@ -248,22 +252,22 @@ unzip -q android-ndk-r14b-linux-x86_64.zip
</pre></div>
</div>
<p>Android NDK includes everything we need to build the <a class="reference external" href="https://developer.android.com/ndk/guides/standalone_toolchain.html"><em>standalone toolchain</em></a>, which in then used to build PaddlePaddle for Android. (We plan to remove the intermediate stage of building the standalone toolchain in the near future.)</p>
<ul>
<li><p class="first">To build the standalone toolchain for <code class="docutils literal"><span class="pre">armeabi-v7a</span></code> and Android API level 21:</p>
<ul class="simple">
<li>To build the standalone toolchain for <code class="docutils literal"><span class="pre">armeabi-v7a</span></code> and Android API level 21:</li>
</ul>
<div class="highlight-bash"><div class="highlight"><pre><span></span>your/path/to/android-ndk-r14b-linux-x86_64/build/tools/make-standalone-toolchain.sh <span class="se">\</span>
--arch<span class="o">=</span>arm --platform<span class="o">=</span>android-21 --install-dir<span class="o">=</span>your/path/to/arm_standalone_toolchain
</pre></div>
</div>
<p>The generated standalone toolchain will be in <code class="docutils literal"><span class="pre">your/path/to/arm_standalone_toolchain</span></code>.</p>
</li>
<li><p class="first">To build the standalone toolchain for <code class="docutils literal"><span class="pre">arm64-v8a</span></code> and Android API level 21:</p>
<ul class="simple">
<li>To build the standalone toolchain for <code class="docutils literal"><span class="pre">arm64-v8a</span></code> and Android API level 21:</li>
</ul>
<div class="highlight-bash"><div class="highlight"><pre><span></span>your/path/to/android-ndk-r14b-linux-x86_64/build/tools/make-standalone-toolchain.sh <span class="se">\</span>
--arch<span class="o">=</span>arm64 --platform<span class="o">=</span>android-21 --install-dir<span class="o">=</span>your/path/to/arm64_standalone_toolchain
</pre></div>
</div>
<p>The generated standalone toolchain will be in <code class="docutils literal"><span class="pre">your/path/to/arm64_standalone_toolchain</span></code>.</p>
</li>
</ul>
</div>
<div class="section" id="cross-compiling-arguments">
<span id="cross-compiling-arguments"></span><h3>Cross-Compiling Arguments<a class="headerlink" href="#cross-compiling-arguments" title="Permalink to this headline"></a></h3>
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -189,7 +189,7 @@ PaddlePaddle的编译选项,包括生成CPU/GPU二进制文件、链接何种B
"WITH_TESTING", "是否开启单元测试", "OFF"
"WITH_DOC", "是否编译中英文文档", "OFF"
"WITH_SWIG_PY", "是否编译PYTHON的SWIG接口,该接口可用于预测和定制化训练", "Auto"
"WITH_GOLANG", "是否编译go语言的可容错parameter server", "ON"
"WITH_GOLANG", "是否编译go语言的可容错parameter server", "OFF"
"WITH_MKL", "是否使用MKL数学库,如果为否则是用OpenBLAS", "ON"
BLAS
......
......@@ -23,6 +23,12 @@ $ docker build -t username/paddle-android:dev . -f Dockerfile.android
$ docker pull paddlepaddle/paddle:latest-dev-android
```
对于国内用户,我们提供了加速访问的镜像源:
```bash
$ docker pull docker.paddlepaddlehub.com/paddle:latest-dev-android
```
### 编译PaddlePaddle C-API库
构建好开发镜像后,即可使用开发镜像来编译Android版PaddlePaddle C-API库。
Android的Docker开发镜像向用户提供两个可配置的参数:
......@@ -56,15 +62,15 @@ Android的Docker开发镜像向用户提供两个可配置的参数:
- 编译`armeabi-v7a`,`Android API 21`的PaddlePaddle库
```bash
$ docker run -it --rm -v $PWD:/paddle -e "ANDROID_ABI=armeabi-v7a" -e "ANDROID_API=21" username/paddle-android:dev
```
```bash
$ docker run -it --rm -v $PWD:/paddle -e "ANDROID_ABI=armeabi-v7a" -e "ANDROID_API=21" username/paddle-android:dev
```
- 编译`arm64-v8a`,`Android API 21`的PaddlePaddle库
```bash
$ docker run -it --rm -v $PWD:/paddle -e "ANDROID_ABI=arm64-v8a" -e "ANDROID_API=21" username/paddle-android:dev
```
```bash
$ docker run -it --rm -v $PWD:/paddle -e "ANDROID_ABI=arm64-v8a" -e "ANDROID_API=21" username/paddle-android:dev
```
执行上述`docker run`命令时,容器默认执行[paddle/scripts/docker/build_android.sh](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/scripts/docker/build_android.sh)脚本。该脚本中记录了交叉编译Android版PaddlePaddle库常用的CMake配置,并且会根据`ANDROID_ABI`和`ANDROID_API`自动构建独立工具链、进行编译和安装。由于arm64架构要求Android API不小于21。因此当`ANDROID_ABI=arm64-v8a`,`ANDROID_API<21`时,Docker容器中将默认使用`Android API 21`的编译工具链。用户可以参考下文[配置交叉编译参数](#配置交叉编译参数)章节,根据个人的需求修改定制Docker容器所执行的脚本。编译安装结束之后,PaddlePaddle的C-API库将被安装到`$PWD/install_android`目录,所依赖的第三方库同时也被安装到`$PWD/install_android/third_party`目录。
......@@ -155,7 +161,11 @@ cmake -DCMAKE_SYSTEM_NAME=Android \
..
```
用户还可根据自己的需求设置其他编译参数。比如希望最小化生成的库的大小,可以设置`CMAKE_BUILD_TYPE`为`MinSizeRel`;若希望最快的执行速度,则可设置`CMAKE_BUILD_TYPE`为`Release`。亦可以通过手动设置`CMAKE_C/CXX_FLAGS`来影响PaddlePaddle的编译过程。
用户还可根据自己的需求设置其他编译参数。
- 设置`CMAKE_BUILD_TYPE`为`MinSizeRel`,最小化生成的库的大小。
- 设置`CMAKE_BUILD_TYPE`为`Release`,获得最快的执行速度,
- 用户亦可以通过手动设置`CMAKE_C/CXX_FLAGS`来影响PaddlePaddle的编译过程。
**性能TIPS**,为了达到最快的计算速度,在CMake参数配置上,有以下建议:
......
......@@ -419,7 +419,7 @@ ctest -R test_sum_op -V
</tr>
<tr class="row-even"><td>WITH_GOLANG</td>
<td>是否编译go语言的可容错parameter server</td>
<td>ON</td>
<td>OFF</td>
</tr>
<tr class="row-odd"><td>WITH_MKL</td>
<td>是否使用MKL数学库,如果为否则是用OpenBLAS</td>
......
......@@ -218,6 +218,10 @@ $ docker build -t username/paddle-android:dev . -f Dockerfile.android
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ docker pull paddlepaddle/paddle:latest-dev-android
</pre></div>
</div>
<p>对于国内用户,我们提供了加速访问的镜像源:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ docker pull docker.paddlepaddlehub.com/paddle:latest-dev-android
</pre></div>
</div>
</div>
<div class="section" id="paddlepaddle-c-api">
<span id="paddlepaddle-c-api"></span><h3>编译PaddlePaddle C-API库<a class="headerlink" href="#paddlepaddle-c-api" title="永久链接至标题"></a></h3>
......@@ -248,18 +252,18 @@ Android的Docker开发镜像向用户提供两个可配置的参数:</p>
<td>21</td>
</tr>
</tbody>
</table><ul>
<li><p class="first">编译<code class="docutils literal"><span class="pre">armeabi-v7a</span></code><code class="docutils literal"><span class="pre">Android</span> <span class="pre">API</span> <span class="pre">21</span></code>的PaddlePaddle库</p>
</table><ul class="simple">
<li>编译<code class="docutils literal"><span class="pre">armeabi-v7a</span></code><code class="docutils literal"><span class="pre">Android</span> <span class="pre">API</span> <span class="pre">21</span></code>的PaddlePaddle库</li>
</ul>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ docker run -it --rm -v <span class="nv">$PWD</span>:/paddle -e <span class="s2">&quot;ANDROID_ABI=armeabi-v7a&quot;</span> -e <span class="s2">&quot;ANDROID_API=21&quot;</span> username/paddle-android:dev
</pre></div>
</div>
</li>
<li><p class="first">编译<code class="docutils literal"><span class="pre">arm64-v8a</span></code><code class="docutils literal"><span class="pre">Android</span> <span class="pre">API</span> <span class="pre">21</span></code>的PaddlePaddle库</p>
<ul class="simple">
<li>编译<code class="docutils literal"><span class="pre">arm64-v8a</span></code><code class="docutils literal"><span class="pre">Android</span> <span class="pre">API</span> <span class="pre">21</span></code>的PaddlePaddle库</li>
</ul>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ docker run -it --rm -v <span class="nv">$PWD</span>:/paddle -e <span class="s2">&quot;ANDROID_ABI=arm64-v8a&quot;</span> -e <span class="s2">&quot;ANDROID_API=21&quot;</span> username/paddle-android:dev
</pre></div>
</div>
</li>
</ul>
<p>执行上述<code class="docutils literal"><span class="pre">docker</span> <span class="pre">run</span></code>命令时,容器默认执行<a class="reference external" href="https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/scripts/docker/build_android.sh">paddle/scripts/docker/build_android.sh</a>脚本。该脚本中记录了交叉编译Android版PaddlePaddle库常用的CMake配置,并且会根据<code class="docutils literal"><span class="pre">ANDROID_ABI</span></code><code class="docutils literal"><span class="pre">ANDROID_API</span></code>自动构建独立工具链、进行编译和安装。由于arm64架构要求Android API不小于21。因此当<code class="docutils literal"><span class="pre">ANDROID_ABI=arm64-v8a</span></code><code class="docutils literal"><span class="pre">ANDROID_API&lt;21</span></code>时,Docker容器中将默认使用<code class="docutils literal"><span class="pre">Android</span> <span class="pre">API</span> <span class="pre">21</span></code>的编译工具链。用户可以参考下文<a class="reference external" href="#配置交叉编译参数">配置交叉编译参数</a>章节,根据个人的需求修改定制Docker容器所执行的脚本。编译安装结束之后,PaddlePaddle的C-API库将被安装到<code class="docutils literal"><span class="pre">$PWD/install_android</span></code>目录,所依赖的第三方库同时也被安装到<code class="docutils literal"><span class="pre">$PWD/install_android/third_party</span></code>目录。</p>
</div>
</div>
......@@ -349,7 +353,12 @@ unzip -q android-ndk-r14b-linux-x86_64.zip
<span class="o">..</span>
</pre></div>
</div>
<p>用户还可根据自己的需求设置其他编译参数。比如希望最小化生成的库的大小,可以设置<code class="docutils literal"><span class="pre">CMAKE_BUILD_TYPE</span></code><code class="docutils literal"><span class="pre">MinSizeRel</span></code>;若希望最快的执行速度,则可设置<code class="docutils literal"><span class="pre">CMAKE_BUILD_TYPE</span></code><code class="docutils literal"><span class="pre">Release</span></code>。亦可以通过手动设置<code class="docutils literal"><span class="pre">CMAKE_C/CXX_FLAGS</span></code>来影响PaddlePaddle的编译过程。</p>
<p>用户还可根据自己的需求设置其他编译参数。</p>
<ul class="simple">
<li>设置<code class="docutils literal"><span class="pre">CMAKE_BUILD_TYPE</span></code><code class="docutils literal"><span class="pre">MinSizeRel</span></code>,最小化生成的库的大小。</li>
<li>设置<code class="docutils literal"><span class="pre">CMAKE_BUILD_TYPE</span></code><code class="docutils literal"><span class="pre">Release</span></code>,获得最快的执行速度,</li>
<li>用户亦可以通过手动设置<code class="docutils literal"><span class="pre">CMAKE_C/CXX_FLAGS</span></code>来影响PaddlePaddle的编译过程。</li>
</ul>
<p><strong>性能TIPS</strong>,为了达到最快的计算速度,在CMake参数配置上,有以下建议:</p>
<ul class="simple">
<li>设置<code class="docutils literal"><span class="pre">CMAKE_BUILD_TYPE</span></code><code class="docutils literal"><span class="pre">Release</span></code></li>
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册