Skip to content

Commit 5674409

Browse files
authored
Merge pull request #10916 from PaddlePaddle/improveDocGenerationSpeed
Improve doc generation speed
2 parents ec7f1e9 + 0a135de commit 5674409

16 files changed

+55
-52
lines changed

doc/fluid/CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ set(SPHINX_CACHE_DIR_EN "${CMAKE_CURRENT_BINARY_DIR}/en/_doctrees")
1515
# HTML output director
1616
set(SPHINX_HTML_DIR_EN "${CMAKE_CURRENT_BINARY_DIR}/en/html")
1717

18+
set(IMPORT_PADDLE_STRING "")
19+
set(IMPORT_PADDLEV2_STRING "")
20+
1821
configure_file(
1922
"${CMAKE_CURRENT_SOURCE_DIR}/../templates/conf.py.en.in"
2023
"${BINARY_BUILD_DIR_EN}/conf.py"
@@ -27,8 +30,6 @@ sphinx_add_target(paddle_fluid_docs
2730
${CMAKE_CURRENT_SOURCE_DIR}
2831
${SPHINX_HTML_DIR_EN})
2932

30-
add_dependencies(paddle_fluid_docs gen_proto_py paddle_python)
31-
3233
# configured documentation tools and intermediate build results
3334
set(BINARY_BUILD_DIR_CN "${CMAKE_CURRENT_BINARY_DIR}/cn/_build")
3435

@@ -50,6 +51,4 @@ sphinx_add_target(paddle_fluid_docs_cn
5051
${CMAKE_CURRENT_SOURCE_DIR}
5152
${SPHINX_HTML_DIR_CN})
5253

53-
add_dependencies(paddle_fluid_docs_cn gen_proto_py paddle_python)
54-
5554
add_subdirectory(api)

doc/fluid/api/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ set(SPHINX_CACHE_DIR_EN "${CMAKE_CURRENT_BINARY_DIR}/en/_doctrees")
77
# HTML output director
88
set(SPHINX_HTML_DIR_EN "${CMAKE_CURRENT_BINARY_DIR}/en/html")
99

10+
set(IMPORT_PADDLE_STRING "import paddle")
11+
set(IMPORT_PADDLEV2_STRING "import paddle.v2")
12+
1013
configure_file(
1114
"${CMAKE_CURRENT_SOURCE_DIR}/../../templates/conf.py.en.in"
1215
"${BINARY_BUILD_DIR_EN}/conf.py"

doc/mobile/CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ set(SPHINX_CACHE_DIR_EN "${CMAKE_CURRENT_BINARY_DIR}/en/_doctrees")
1515
# HTML output director
1616
set(SPHINX_HTML_DIR_EN "${CMAKE_CURRENT_BINARY_DIR}/en/html")
1717

18+
set(IMPORT_PADDLE_STRING "")
19+
set(IMPORT_PADDLEV2_STRING "")
20+
1821
configure_file(
1922
"${CMAKE_CURRENT_SOURCE_DIR}/../templates/conf.py.en.in"
2023
"${BINARY_BUILD_DIR_EN}/conf.py"
@@ -27,8 +30,6 @@ sphinx_add_target(paddle_mobile_docs
2730
${CMAKE_CURRENT_SOURCE_DIR}
2831
${SPHINX_HTML_DIR_EN})
2932

30-
add_dependencies(paddle_mobile_docs gen_proto_py paddle_python)
31-
3233
# configured documentation tools and intermediate build results
3334
set(BINARY_BUILD_DIR_CN "${CMAKE_CURRENT_BINARY_DIR}/cn/_build")
3435

@@ -49,5 +50,3 @@ sphinx_add_target(paddle_mobile_docs_cn
4950
${SPHINX_CACHE_DIR_CN}
5051
${CMAKE_CURRENT_SOURCE_DIR}
5152
${SPHINX_HTML_DIR_CN})
52-
53-
add_dependencies(paddle_mobile_docs_cn gen_proto_py paddle_python)

doc/mobile/index_cn.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
移动端
2-
=====
2+
======
33

44
.. toctree::
55
:maxdepth: 1
66

77
cross_compiling_for_android_cn.md
88
cross_compiling_for_ios_cn.md
9-
cross_compiling_for_raspberry_cn.md
9+
cross_compiling_for_raspberry_cn.md

doc/templates/conf.py.cn.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import os, subprocess
1616
sys.path.insert(0, os.path.abspath('@PADDLE_BINARY_DIR@/python'))
1717
import shlex
1818
from recommonmark import parser, transform
19-
import paddle
20-
import paddle.v2
19+
@IMPORT_PADDLE_STRING@
20+
@IMPORT_PADDLEV2_STRING@
2121

2222
MarkdownParser = parser.CommonMarkParser
2323
AutoStructify = transform.AutoStructify

doc/templates/conf.py.en.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import os, subprocess
1616
sys.path.insert(0, os.path.abspath('@PADDLE_BINARY_DIR@/python'))
1717
import shlex
1818
from recommonmark import parser, transform
19-
import paddle
20-
import paddle.v2
19+
@IMPORT_PADDLE_STRING@
20+
@IMPORT_PADDLEV2_STRING@
2121

2222

2323
MarkdownParser = parser.CommonMarkParser

doc/v2/CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ set(SPHINX_CACHE_DIR_EN "${CMAKE_CURRENT_BINARY_DIR}/en/_doctrees")
1515
# HTML output director
1616
set(SPHINX_HTML_DIR_EN "${CMAKE_CURRENT_BINARY_DIR}/en/html")
1717

18+
set(IMPORT_PADDLE_STRING "")
19+
set(IMPORT_PADDLEV2_STRING "")
20+
1821
configure_file(
1922
"${CMAKE_CURRENT_SOURCE_DIR}/../templates/conf.py.en.in"
2023
"${BINARY_BUILD_DIR_EN}/conf.py"
@@ -27,8 +30,6 @@ sphinx_add_target(paddle_v2_docs
2730
${CMAKE_CURRENT_SOURCE_DIR}
2831
${SPHINX_HTML_DIR_EN})
2932

30-
add_dependencies(paddle_v2_docs gen_proto_py paddle_python)
31-
3233
# configured documentation tools and intermediate build results
3334
set(BINARY_BUILD_DIR_CN "${CMAKE_CURRENT_BINARY_DIR}/cn/_build")
3435

@@ -50,6 +51,4 @@ sphinx_add_target(paddle_v2_docs_cn
5051
${CMAKE_CURRENT_SOURCE_DIR}
5152
${SPHINX_HTML_DIR_CN})
5253

53-
add_dependencies(paddle_v2_docs_cn gen_proto_py paddle_python)
54-
5554
add_subdirectory(api)

doc/v2/api/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ set(SPHINX_CACHE_DIR_EN "${CMAKE_CURRENT_BINARY_DIR}/en/_doctrees")
77
# HTML output director
88
set(SPHINX_HTML_DIR_EN "${CMAKE_CURRENT_BINARY_DIR}/en/html")
99

10+
set(IMPORT_PADDLE_STRING "import paddle")
11+
set(IMPORT_PADDLEV2_STRING "import paddle.v2")
12+
1013
configure_file(
1114
"${CMAKE_CURRENT_SOURCE_DIR}/../../templates/conf.py.en.in"
1215
"${BINARY_BUILD_DIR_EN}/conf.py"

doc/v2/build_and_install/build_from_source_cn.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
----------------
2020

2121
PaddlePaddle需要使用Docker环境完成编译,这样可以免去单独安装编译依赖的步骤,可选的不同编译环境Docker镜像
22-
可以在 `这里 <https://hub.docker.com/r/paddlepaddle/paddle_manylinux_devel/tags/>`_ 找到,您也可以
23-
在 `这里 <https://github.com/PaddlePaddle/Paddle/tree/develop/tools/manylinux1/>`_ 找到 paddle_manylinux_devel
22+
可以在 `这里 <https://hub.docker.com/r/paddlepaddle/paddle_manylinux_devel/tags/>`__ 找到,您也可以
23+
在 `这里 <https://github.com/PaddlePaddle/Paddle/tree/develop/tools/manylinux1/>`__ 找到 paddle_manylinux_devel
2424
镜像的编译以及使用方法。或者参考下述可选步骤,从源码中构建用于编译PaddlePaddle的Docker镜像。
2525

2626
如果您选择不使用Docker镜像,则需要在本机安装下面章节列出的 `编译依赖`_ 之后才能开始编译的步骤。
@@ -116,11 +116,10 @@ PaddlePaddle需要使用Docker环境完成编译,这样可以免去单独安
116116

117117
很多 PaddlePaddle 开发者使用 Emacs。他们在自己的 `~/.emacs` 配置文件里加两行
118118

119-
```emacs
120-
(global-set-key "\C-cc" 'compile)
121-
(setq compile-command
122-
"docker run --rm -it -v $(git rev-parse --show-toplevel):/paddle paddle:dev")
123-
```
119+
.. code-block:: emacs
120+
121+
(global-set-key "\C-cc" 'compile)
122+
(setq compile-command "docker run --rm -it -v $(git rev-parse --show-toplevel):/paddle paddle:dev")
124123
125124
就可以按 `Ctrl-C` 和 `c` 键来启动编译了。
126125

doc/v2/build_and_install/build_from_source_en.rst

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ You need to use Docker to build PaddlePaddle
2323
to avoid installing dependencies by yourself. We have several pre-built
2424
Docker images `here <https://hub.docker.com/r/paddlepaddle/paddle_manylinux_devel/tags/>`_ ,
2525
you can also find how to build and use paddle_manylinux_devel Docker image from
26-
`here <https://github.com/PaddlePaddle/Paddle/tree/develop/tools/manylinux1/>`_
26+
`here <https://github.com/PaddlePaddle/Paddle/tree/develop/tools/manylinux1/>`__
2727
Or you can build your own image from source as the optional step below:
2828

2929
.. code-block:: bash
@@ -88,7 +88,7 @@ If you wish to run only one unit test, like :code:`test_sum_op`:
8888
.. _faq_docker:
8989

9090
Frequently Asked Questions
91-
----------------
91+
---------------------------
9292

9393
- What is Docker?
9494

@@ -118,11 +118,10 @@ Frequently Asked Questions
118118

119119
Many PaddlePaddle developers are using Emacs. They add the following few lines into their `~/.emacs` configure file:
120120

121-
```emacs
122-
(global-set-key "\C-cc" 'compile)
123-
(setq compile-command
124-
"docker run --rm -it -v $(git rev-parse --show-toplevel):/paddle paddle:dev")
125-
```
121+
.. code-block:: emacs
122+
123+
(global-set-key "\C-cc" 'compile)
124+
(setq compile-command "docker run --rm -it -v $(git rev-parse --show-toplevel):/paddle paddle:dev")
126125
127126
so they could type `Ctrl-C` and `c` to build PaddlePaddle from source.
128127

@@ -145,7 +144,7 @@ Frequently Asked Questions
145144
.. _compile_deps:
146145

147146
Appendix: Compile Dependencies
148-
----------------
147+
-------------------------------
149148

150149
PaddlePaddle need the following dependencies when compiling, other dependencies
151150
will be downloaded automatically.
@@ -166,11 +165,11 @@ will be downloaded automatically.
166165
.. _build_options:
167166

168167
Appendix: Build Options
169-
----------------
168+
-------------------------
170169

171170
Build options include whether build binaries for CPU or GPU, which BLAS
172171
library to use etc. You may pass these settings when running cmake.
173-
For detailed cmake tutorial please refer to `here <https://cmake.org/cmake-tutorial>`_
172+
For detailed cmake tutorial please refer to `here <https://cmake.org/cmake-tutorial>`__
174173

175174

176175
You can add :code:`-D` argument to pass such options, like:
@@ -219,7 +218,7 @@ keep on with latest cuDNN versions. Be sure to run with the same version of cuDN
219218
you built.
220219

221220
Pass Compile Options
222-
++++++++++++++
221+
++++++++++++++++++++++
223222

224223
You can pass compile options to use intended BLAS/CUDA/Cudnn libraries.
225224
When running cmake command, it will search system paths like

0 commit comments

Comments
 (0)