Skip to content

Commit 2be25c7

Browse files
authored
Merge pull request #3 from PaddlePaddle/develop
merge to local
2 parents 3524ea6 + 997c89c commit 2be25c7

File tree

86 files changed

+14089
-13369
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+14089
-13369
lines changed

README.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,52 @@
11
# Introduction
2-
Fluiddoc consolidates all the documentations related to Paddle. It supplies the contents to PaddlePaddle.org via CI.
2+
FluidDoc consolidates all the documentations related to Paddle. It supplies the contents to PaddlePaddle.org via CI.
3+
4+
FluidDoc包含了所有PaddlePaddle相关的文档,它通过CI系统为PaddlePaddle.org提供文档内容
35

46
# Architecture
57
FluidDoc submodules Paddle, Book, Models, Mobile and Anakin under `external` folder. All submodules should be put under `external` as standard practice.
68

7-
Fluiddoc then uses them as references to load up the documents. The FluidDoc constructs the whole doc-tree under the `FluidDoc/doc/fluid` folder. The entry point is `FluidDoc/doc/fluid/index_cn.rst` and `FluidDoc/doc/fluid/index_en.rst`
9+
FluidDoc将Paddle, Book, Models, Mobile and Anakin作为子模块,并放置在 `external` 目录下。按照标准做法,所有的子模块应当置于`external` 目录下
10+
11+
FluidDoc then uses them as references to load up the documents. The FluidDoc constructs the whole doc-tree under the `FluidDoc/doc/fluid` folder. The entry point is `FluidDoc/doc/fluid/index_cn.rst` and `FluidDoc/doc/fluid/index_en.rst`
12+
13+
FluidDoc通过引用这些子模块来加载这些Repo中的文档。FluidDoc在 `FluidDoc/doc/fluid` 目录下构建了文档的整体树形结构。可以分别在 `FluidDoc/doc/fluid/index_cn.rst``FluidDoc/doc/fluid/index_en.rst` 查看。
814

915
When a release branch is pushed to Github, Travis-CI will start automatically to compile documents and deploy documents to the server.
1016

17+
当一个新发布的分支被push到了Github上,Travis-CI 将会自动启动编译文档并把文档部署到服务器
18+
1119
## Note:
1220
FluidDoc needs Paddle python module to compile API documents. Unfortunately, compiling Paddle python module takes longer time Travis CI permits. Usually Travis CI will fail due because of timeout. That's why there three jobs on Travis, two of them are to build libraries. Once the libraries are cached on the Travis, next build will be a lot faster.
1321

22+
## 注意:
23+
FluidDoc 需要Paddle Repo的python模块去编译生成API文档。但由于Paddle的python模块过于庞大,超过了Travis CI允许的最大时长,通常Travis CI将会因为超时问题失败。这是Travis上有三项作业的原因,其中两项用于构建库。当Travis缓存了这些库以后,下一次的构建将会变得非常的快。
24+
1425
## Preview with PPO
1526
To preview documents constructured by FluidDoc. Please follow the [regular preview step](https://github.com/PaddlePaddle/PaddlePaddle.org/blob/develop/README.md), but replace the path to paddle with the path to FluidDoc
1627
`./runserver --paddle <path_to_FluidDoc_dir>`
1728

29+
## 通过PaddlePaddle.org预览文档
30+
31+
为了预览FluidDoc的文档,请按照[常规预览步骤](https://github.com/PaddlePaddle/PaddlePaddle.org/blob/develop/README.md),但请在这一步将 paddle 的路径替换为 Fluid 的路径
32+
`./runserver --paddle <path_to_FluidDoc_dir>`
33+
34+
1835
# Publish New release
1936
1. Checkout a new release branch. The branch name should follow `release/<version>`
2037
1. Update the documentations on the submodules or within FluidDoc
2138
1. Make sure all the submodules are ready for release. Paddle, book, model, mobile and Anakin should all have stable commits. Note: Paddle repo should update the API RST files accordinly if Paddle changes the included module/classes.
2239
1. Update the submodules under `external` folder and commit the changes.
2340
1. Git push the branch to Github, Travis CI will start several builds to publish the documents to the PaddlePaddle.org server
24-
1. Please notify the PaddlePaddle.org team that the release content is ready. PaddlePaddl.org team should enable the version and update the default version to the latest one. PaddlePaddle.org should also update the search index accordingly (Until the search server is up)
41+
1. Please notify the PaddlePaddle.org team that the release content is ready. PaddlePaddle.org team should enable the version and update the default version to the latest one. PaddlePaddle.org should also update the search index accordingly (Until the search server is up)
42+
43+
## 发布新的分支
44+
1. 创建一个新的分支,此分支的名字应遵循`release/<version>`
45+
1. 在FluidDoc和子模块中更新文档
46+
1. 确认所有的子模块中处于发布就绪的状态。Paddle, book, model, mobile and Anakin 应全部有稳定的commit
47+
请注意:如果Paddle Repo更改了module/classes,涉及API文档的RST文件应当也被更新
48+
1.`external` 中更新文件然后commit文档变更
49+
1. 将这个分支push到Github,Travis CI将会启动几项构建工作以把文档发布到PaddlePaddle.org的服务器
50+
1. 请告知PaddlePaddle.org团队,发布的内容已经就绪。PaddlePaddle.org团队将使版本生效并更新默认的版本到最新版。PaddlePaddle.org也应当更新相应的搜索引擎文件
51+
2552

doc/fluid/advanced_usage/deploy/inference/build_and_install_lib_cn.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ WITH_MKL ON/OFF
7171
│   │   ├── paddle_analysis_config.h
7272
│   │   ├── paddle_api.h
7373
│   │   ├── paddle_inference_api.h
74-
│   │   ├── paddle_inference_pass.h
7574
│   │   └── paddle_pass_builder.h
7675
│   └── lib
7776
│   ├── libpaddle_fluid.a

doc/fluid/advanced_usage/deploy/inference/paddle_tensorrt_infer.md

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,38 @@ NVIDIA TensorRT 是一个高性能的深度学习预测库,可为深度学习
2626
cd /Paddle
2727
mkdir build
2828
cd build
29+
# TENSORRT_ROOT为TRT的路径,默认为 /usr,根据自己需求进行改动
30+
# MKL 可以根据自己的需求自行打开
2931
cmake .. \
3032
-DWITH_FLUID_ONLY=ON \
31-
-DWITH_CONTRIB=OFF \
3233
-DWITH_MKL=OFF \
3334
-DWITH_MKLDNN=OFF \
34-
-DWITH_TESTING=ON \
3535
-DCMAKE_BUILD_TYPE=Release \
36-
-DWITH_PYTHON=OFF
36+
-DWITH_PYTHON=OFF \
37+
-DTENSORRT_ROOT=/usr \
38+
-DON_INFER=ON
3739

3840
# 编译
3941
make -j
4042
# 生成预测库
4143
make inference_lib_dist -j
4244
```
45+
46+
编译后的库的目录如下:
47+
48+
```
49+
fluid_inference_install_dir
50+
├── paddle
51+
52+
├── CMakeCache.txt
53+
├── version.txt
54+
├── third_party
55+
├── boost
56+
├── install
57+
└── engine3
58+
```
59+
60+
`fluid_inference_install_dir`下, paddle目录包含了预测库的头文件和预测库的lib, version.txt 中包含了lib的版本和配置信息,third_party 中包含了预测库依赖的第三方库
4361

4462
## Paddle TensorRT使用
4563

@@ -97,11 +115,52 @@ void RunTensorRT(int batch_size, std::string model_dirname) {
97115

98116
int main() {
99117
// 模型下载地址 http://paddle-inference-dist.cdn.bcebos.com/tensorrt_test/mobilenet.tar.gz
100-
paddle::RunTensorRT(1, ./mobilenet");
118+
paddle::RunTensorRT(1, "./mobilenet");
101119
return 0;
102120
}
103121
```
104-
编译过程可以参照[这里](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/fluid/inference/api/demo_ci)。
122+
123+
## 样例编译
124+
1. 下载样例
125+
```
126+
wget http://paddle-inference-dist.cdn.bcebos.com/tensorrt_test/paddle_trt_samples.tar.gz
127+
```
128+
129+
解压后的目录如下:
130+
131+
```
132+
sample
133+
├── CMakeLists.txt
134+
├── mobilenet_test.cc
135+
├── thread_mobilenet_test.cc
136+
├── mobilenetv1
137+
│ ├── model
138+
│ └── params
139+
└── run_impl.sh
140+
```
141+
142+
- `mobilenet_test.cc` 为单线程的程序文件
143+
- `thread_mobilenet_test.cc` 为多线程的程序文件
144+
- `mobilenetv1` 为模型文件
145+
146+
在这里假设预测库的路径为 ``BASE_DIR/fluid_inference_install_dir/`` ,样例所在的目录为 ``SAMPLE_BASE_DIR/sample``
147+
148+
2. 编译样例
149+
150+
```shell
151+
cd SAMPLE_BASE_DIR/sample
152+
# sh run_impl.sh {预测库的地址} {测试脚本的名字} {模型目录}
153+
sh run_impl.sh BASE_DIR/fluid_inference_install_dir/ mobilenet_test SAMPLE_BASE_DIR/sample/mobilenetv1
154+
```
155+
156+
3. 编译多线程的样例
157+
158+
```shell
159+
cd SAMPLE_BASE_DIR/sample
160+
# sh run_impl.sh {预测库的地址} {测试脚本的名字} {模型目录}
161+
sh run_impl.sh BASE_DIR/fluid_inference_install_dir/ thread_mobilenet_test SAMPLE_BASE_DIR/sample/mobilenetv1
162+
```
163+
105164
106165
## 子图运行原理
107166
PaddlePaddle采用子图的形式对TensorRT进行集成,当模型加载后,神经网络可以表示为由变量和运算节点组成的计算图。Paddle TensorRT实现的功能是能够对整个图进行扫描,发现图中可以使用TensorRT优化的子图,并使用TensorRT节点替换它们。在模型的推断期间,如果遇到TensorRT节点,Paddle会调用TensoRT库对该节点进行优化,其他的节点调用Paddle的原生实现。TensorRT在推断期间能够进行Op的横向和纵向融合,过滤掉冗余的Op,并对特定平台下的特定的Op选择合适的kenel等进行优化,能够加快模型的预测速度。
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# Guide of local development
2+
3+
You will learn how to develop programs in local environment under the guidelines of this document.
4+
5+
## Requirements of coding
6+
- Please refer to the coding comment format of [Doxygen](http://www.stack.nl/~dimitri/doxygen/)
7+
- Make sure that option of builder `WITH_STYLE_CHECK` is on and the build could pass through the code style check.
8+
- Unit test is needed for all codes.
9+
- Pass through all unit tests.
10+
- Please follow [regulations of submitting codes](#regulations of submitting codes).
11+
12+
The following guidiance tells you how to submit code.
13+
## [Fork](https://help.github.com/articles/fork-a-repo/)
14+
15+
Transfer to the home page of Github [PaddlePaddle](https://github.com/PaddlePaddle/Paddle) ,and then click button `Fork` to generate the git under your own file directory,such as <https://github.com/USERNAME/Paddle>
16+
17+
## Clone
18+
19+
Clone remote git to local:
20+
21+
```bash
22+
➜ git clone https://github.com/USERNAME/Paddle
23+
cd Paddle
24+
```
25+
26+
27+
## Create local branch
28+
29+
At present [Git stream branch model](http://nvie.com/posts/a-successful-git-branching-model/) is applied to Paddle to undergo task of development,test,release and maintenance.Please refer to [branch regulation of Paddle](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/design/releasing_process.md#paddle-分支规范) about details。
30+
31+
All development tasks of feature and bug fix should be finished in a new branch which is extended from `develop` branch.
32+
33+
Create and switch to a new branch with command `git checkout -b`.
34+
35+
36+
```bash
37+
➜ git checkout -b my-cool-stuff
38+
```
39+
40+
It is worth noting that before the checkout, you need to keep the current branch directory clean, otherwise the untracked file will be brought to the new branch, which can be viewed by `git status` .
41+
42+
43+
## Use `pre-commit` hook
44+
45+
Paddle developers use the [pre-commit](http://pre-commit.com/) tool to manage Git pre-commit hooks. It helps us format the source code (C++, Python) and automatically check some basic things before committing (such as having only one EOL per file, not adding large files in Git, etc.).
46+
47+
The `pre-commit` test is part of the unit test in Travis-CI. A PR that does not satisfy the hook cannot be submitted to Paddle. Install `pre-commit` first and then run it in current directory:
48+
49+
50+
```bash
51+
➜ pip install pre-commit
52+
➜ pre-commit install
53+
```
54+
55+
Paddle modify the format of C/C++ source code with `clang-format` .Make sure the version of `clang-format` is above 3.8.
56+
57+
Note:There are differences between the installation of `yapf` with `pip install pre-commit` and that with `conda install -c conda-forge pre-commit` . Paddle developers use `pip install pre-commit`
58+
59+
## Start development
60+
61+
I delete a line of README.md and create a new file in the case.
62+
63+
View the current state via `git status` , which will prompt some changes to the current directory, and you can also view the file's specific changes via `git diff` .
64+
65+
66+
```bash
67+
➜ git status
68+
On branch test
69+
Changes not staged for commit:
70+
(use "git add <file>..." to update what will be committed)
71+
(use "git checkout -- <file>..." to discard changes in working directory)
72+
modified: README.md
73+
Untracked files:
74+
(use "git add <file>..." to include in what will be committed)
75+
test
76+
no changes added to commit (use "git add" and/or "git commit -a")
77+
```
78+
79+
## Build and test
80+
81+
It needs a variety of development tools to build PaddlePaddle source code and generate documentation. For convenience, our standard development procedure is to put these tools together into a Docker image,called *development mirror* , usually named as `paddle:latest-dev` or `paddle:[version tag]-dev`,such as `paddle:0.11.0-dev` . Then all that need `cmake && make` ,such as IDE configuration,are replaced by `docker run paddle:latest-dev` .
82+
83+
You need to bulid this development mirror under the root directory of source code directory tree
84+
85+
```bash
86+
➜ docker build -t paddle:latest-dev .
87+
```
88+
89+
Then you can start building PaddlePaddle source code with this development mirror.For example,to build a Paddleddle which are not dependent on GPU but in support of AVX commands and including unit test,you can:
90+
91+
```bash
92+
➜ docker run -v $(pwd):/paddle -e "WITH_GPU=OFF" -e "WITH_AVX=ON" -e "WITH_TESTING=ON" paddle:latest-dev
93+
```
94+
95+
If you want to build PaddlePaddle based on Python3,you can:
96+
97+
```bash
98+
➜ docker run -v $(pwd):/paddle -e "PY_VERSION=3.5" -e "WITH_FLUID_ONLY=ON" -e "WITH_GPU=OFF" -e "WITH_AVX=ON" -e "WITH_TESTING=ON" paddle:latest-dev
99+
```
100+
101+
Except for the build of PaddlePaddle as `./build/libpaddle.so` and the output of `./build/paddle.deb` file, there is an output of `build/Dockerfile`. What we need to do is to package the PaddlePaddle as a *produce mirror*`paddle:prod` )with following commands.
102+
103+
```bash
104+
➜ docker build -t paddle:prod -f build/Dockerfile .
105+
```
106+
107+
Run all unit tests with following commands:
108+
109+
```bash
110+
➜ docker run -it -v $(pwd):/paddle paddle:latest-dev bash -c "cd /paddle/build && ctest"
111+
```
112+
113+
Please refer to [Installation and run with Docker](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/v2/build_and_install/docker_install_cn.rst) about more information of construction and test.
114+
115+
## Commit
116+
117+
Next we cancel the modification of README.md,and submit new added test file.
118+
119+
```bash
120+
➜ git checkout -- README.md
121+
➜ git status
122+
On branch test
123+
Untracked files:
124+
(use "git add <file>..." to include in what will be committed)
125+
test
126+
nothing added to commit but untracked files present (use "git add" to track)
127+
➜ git add test
128+
```
129+
130+
It's required that the commit message is also given on every Git commit, through which other developers will be notified of what changes have been made. Type `git commit` to realize it.
131+
132+
```bash
133+
➜ git commit
134+
CRLF end-lines remover...............................(no files to check)Skipped
135+
yapf.................................................(no files to check)Skipped
136+
Check for added large files..............................................Passed
137+
Check for merge conflicts................................................Passed
138+
Check for broken symlinks................................................Passed
139+
Detect Private Key...................................(no files to check)Skipped
140+
Fix End of Files.....................................(no files to check)Skipped
141+
clang-formater.......................................(no files to check)Skipped
142+
[my-cool-stuff c703c041] add test file
143+
1 file changed, 0 insertions(+), 0 deletions(-)
144+
create mode 100644 233
145+
```
146+
147+
<b> <font color="red">Attention needs to be paid:you need to add commit message to trigger CI test.The command is as follows:</font> </b>
148+
149+
```bash
150+
# Touch CI single test of develop branch
151+
➜ git commit -m "test=develop"
152+
# Touch CI single test of release/1.1 branch
153+
➜ git commit -m "test=release/1.1"
154+
```
155+
156+
## Keep the latest local repository
157+
158+
It needs to keep up with the latest code of original repository(<https://github.com/PaddlePaddle/Paddle>)before Pull Request.
159+
160+
Check the name of current remote repository with `git remote`.
161+
162+
```bash
163+
➜ git remote
164+
origin
165+
➜ git remote -v
166+
origin https://github.com/USERNAME/Paddle (fetch)
167+
origin https://github.com/USERNAME/Paddle (push)
168+
```
169+
170+
origin is the name of remote repository that we clone,which is also the Paddle under your own account. Next we create a remote host of an original Paddle and name it upstream.
171+
172+
```bash
173+
➜ git remote add upstream https://github.com/PaddlePaddle/Paddle
174+
➜ git remote
175+
origin
176+
upstream
177+
```
178+
179+
Get the latest code of upstream and update current branch.
180+
181+
```bash
182+
➜ git fetch upstream
183+
➜ git pull upstream develop
184+
```
185+
186+
## Push to remote repository
187+
188+
Push local modification to GitHub(https://github.com/USERNAME/Paddle).
189+
190+
```bash
191+
# submit it to remote git the branch my-cool-stuff of origin
192+
➜ git push origin my-cool-stuff
193+
```

0 commit comments

Comments
 (0)