Skip to content

Commit

Permalink
fix the building and installing doc of inference lib (PaddlePaddle#1092)
Browse files Browse the repository at this point in the history
The building and installing documentation should be updated because that the code of inference lib has changed. The current bug is that most of files under the inference library path are missed.
  • Loading branch information
zhwesky2010 authored Aug 14, 2019
1 parent 18a8bf2 commit f6d0705
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 27 deletions.
58 changes: 31 additions & 27 deletions doc/fluid/advanced_usage/deploy/inference/windows_cpp_inference.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.. _install_or_build_windows_inference_lib:

安装与编译Windows预测库
===========================
Expand All @@ -22,40 +21,46 @@
用户也可以从 PaddlePaddle 核心代码编译C++预测库,只需在编译时配制下面这些编译选项:

|选项 ||
|:---------|:-------------------|
|CMAKE_BUILD_TYPE | Release |
|FLUID_INFERENCE_INSTALL_DIR | 安装路径 |
|WITH_PYTHON | OFF(推荐)|
|ON_INFER | ON(推荐) |
|WITH_GPU | ON/OFF |
|WITH_MKL | ON/OFF |
|:-------------|:-------------------|
|CMAKE_BUILD_TYPE | Release |
|FLUID_INFERENCE_INSTALL_DIR | 安装路径(可选) |
|ON_INFER | ON(推荐) |
|WITH_GPU | ON/OFF |
|WITH_MKL | ON/OFF |


请按照推荐值设置,以避免链接不必要的库。其它可选编译选项按需进行设定。

Windows下安装与编译预测库步骤:(在Windows命令提示符下执行以下指令)

1. 设置预测库的安装路径,将path_to_paddle替换为PaddlePaddle预测库的安装路径:

`PADDLE_ROOT=path_to_paddle`(不设置则使用默认路径)

2. 将PaddlePaddle的源码clone在当下目录的Paddle文件夹中,并进入Paddle目录:

- `git clone https://github.com/PaddlePaddle/Paddle.git`
- `cd Paddle`

3. 创建名为build的目录并进入:

建议按照推荐值设置,以避免链接不必要的库。其它可选编译选项按需进行设定。
- `mkdir build`
- `cd build`

下面的代码片段从github拉取最新代码,配制编译选项(需要将PADDLE_ROOT替换为PaddlePaddle预测库的安装路径)
4. 执行cmake

.. code-block::
- `cmake .. -G "Visual Studio 14 2015 Win 64" -DFLUID_INFERENCE_INSTALL_DIR=${PADDLE_ROOT} -DCMAKE_BUILD_TYPE=Release -DWITH_MKL=OFF -DWITH_GPU=OFF -DON_INFER=ON`
- `-DFLUID_INFERENCE_INSTALL_DIR=$PADDLE_ROOT`为可选配置选项,如未设置,则使用默认路径。
- `-DWITH_GPU`为是否使用GPU的配置选项,`-DWITH_MKL`为是否使用Intel MKL(数学核心库)的配置选项,请按需配置。

PADDLE_ROOT=\path_to_paddle
git clone https://github.com/PaddlePaddle/Paddle.git
cd Paddle
mkdir build
cd build
cmake -DFLUID_INFERENCE_INSTALL_DIR=$PADDLE_ROOT \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_PYTHON=OFF \
-DWITH_MKL=OFF \
-DWITH_GPU=OFF \
-DON_INFER=ON \
..
5.`https://github.com/wopeizl/Paddle_deps`下载预编译好的第三方依赖包(openblas, snappystream),将整个`third_party`文件夹复制到`build`目录下。

使用 vs2015 打开 paddle.sln 文件,选择 Release 编译即可。
6. 使用Blend for Visual Studio 2015 打开 `paddle.sln` 文件,选择平台为`x64`,配置为`Release`,先编译third_party模块,再编译inference_lib_dist模块。
操作方法:在Visual Studio中选择相应模块,右键选择"生成"(或者"build")

成功编译后,使用C++预测库所需的依赖(包括:(1)编译出的PaddlePaddle预测库和头文件;(2)第三方链接库和头文件;(3)版本信息与编译选项信息)
编译成功后,使用C++预测库所需的依赖(包括:(1)编译出的PaddlePaddle预测库和头文件;(2)第三方链接库和头文件;(3)版本信息与编译选项信息)
均会存放于PADDLE_ROOT目录中。目录结构如下:

.. code-block:: text

PaddleRoot/
├── CMakeCache.txt
Expand Down Expand Up @@ -90,7 +95,6 @@

version.txt 中记录了该预测库的版本信息,包括Git Commit ID、使用OpenBlas或MKL数学库、CUDA/CUDNN版本号,如:

.. code-block:: text

GIT COMMIT ID: cc9028b90ef50a825a722c55e5fda4b7cd26b0d6
WITH_MKL: ON
Expand Down
2 changes: 2 additions & 0 deletions doc/fluid/beginners_guide/install/install_Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* *CUDA 工具包8.0/9.0配合cuDNN v7.3+*
* *GPU运算能力超过1.0的硬件设备*

注: 目前官方发布的windows安装包仅包含 CUDA 8.0/9.0 的单卡模式,不包含 CUDA 9.1/9.2/10.0/10.1,如需使用,请通过源码自行编译。

您可参考NVIDIA官方文档了解CUDA和CUDNN的安装流程和配置方法,请见[CUDA](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/)[cuDNN](https://docs.nvidia.com/deeplearning/sdk/cudnn-install/)

## 安装方式
Expand Down
2 changes: 2 additions & 0 deletions doc/fluid/beginners_guide/install/install_Windows_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* *CUDA Toolkit 8.0/9.0 with cuDNN v7.3+*
* *GPU's computing capability exceeds 1.0*

Note: currently, the official Windows installation package only support CUDA 8.0/9.0 with single GPU, and don't support CUDA 9.1/9.2/10.0/10.1. if you need to use, please compile by yourself through the source code.

Please refer to the NVIDIA official documents for the installation process and the configuration methods of [CUDA](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/) and [cuDNN](https://docs.nvidia.com/deeplearning/sdk/cudnn-install/).

## Installation Method
Expand Down

0 comments on commit f6d0705

Please sign in to comment.