-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Update installation docs #5818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
luotao1
merged 7 commits into
PaddlePaddle:develop
from
typhoonzero:polish_install_docs
Nov 27, 2017
Merged
Update installation docs #5818
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4691659
update installation docs
typhoonzero 2e46c35
follow comments
typhoonzero 4c28d40
fix link
typhoonzero 669da50
follow comments2
typhoonzero 13ac960
add picture
typhoonzero 5331f93
update formats
typhoonzero bd6c905
update picture
typhoonzero File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
113 changes: 113 additions & 0 deletions
113
doc/getstarted/build_and_install/build_from_source_cn.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
从源码编译PaddlePaddle | ||
====================== | ||
|
||
.. _build_step: | ||
|
||
编译方法 | ||
---------------- | ||
|
||
PaddlePaddle主要使用 `CMake <https://cmake.org>`_ 以及GCC, G++作为编译工具。 | ||
我们推荐您使用PaddlePaddle编译环境镜像完成编译,这样可以免去单独安装编译依赖的步骤,可选的不同编译环境 | ||
可以在 `这里 <https://hub.docker.com/r/paddlepaddle/paddle_manylinux_devel/tags/>`_ 找到。 | ||
编译PaddlePaddle,需要执行: | ||
|
||
.. code-block:: bash | ||
|
||
git clone https://github.com/PaddlePaddle/Paddle.git | ||
cd Paddle | ||
# 如果使用Docker编译环境,执行下面的命令编译CPU-Only的二进制 | ||
docker run -it -v $PWD:/paddle -e "WITH_GPU=OFF" -e "WITH_TESTING=OFF" paddlepaddle/paddle_manylinux_devel:cuda8.0_cudnn5 bash -x paddle/scripts/docker/build.sh | ||
# 如果不使用Docker编译环境,执行下面的命令 | ||
mkdir build | ||
cd build | ||
cmake -DWITH_GPU=OFF -DWITH_TESTING=OFF .. | ||
make | ||
|
||
|
||
编译完成后会在build/python/dist目录下生成输出的whl包,可以选在在当前机器安装也可以拷贝到目标机器安装: | ||
|
||
.. code-block:: bash | ||
|
||
pip install python/dist/*.whl | ||
|
||
|
||
.. _build_step: | ||
|
||
编译依赖 | ||
---------------- | ||
|
||
PaddlePaddle编译需要使用到下面的依赖(包含但不限于),其他的依赖软件,会自动在编译时下载。 | ||
|
||
.. csv-table:: PaddlePaddle编译依赖 | ||
:header: "依赖", "版本", "说明" | ||
:widths: 10, 15, 30 | ||
|
||
"CMake", ">=3.5", "" | ||
"GCC", "4.8.2", "推荐使用CentOS的devtools2" | ||
"Python", "2.7.x", "依赖libpython2.7.so" | ||
"pip", ">=9.0", "" | ||
"numpy", "", "" | ||
"SWIG", ">=2.0", "" | ||
"Go", ">=1.8", "可选" | ||
|
||
|
||
.. _build_options: | ||
|
||
编译选项 | ||
---------------- | ||
|
||
PaddlePaddle的编译选项,包括生成CPU/GPU二进制文件、链接何种BLAS库等。 | ||
用户可在调用cmake的时候设置它们,详细的cmake使用方法可以参考 | ||
`官方文档 <https://cmake.org/cmake-tutorial>`_ 。 | ||
|
||
在cmake的命令行中,通过使用 ``-D`` 命令设置该类编译选项,例如: | ||
|
||
.. code-block:: bash | ||
|
||
cmake .. -DWITH_GPU=OFF | ||
|
||
.. csv-table:: 编译选项说明 | ||
:header: "选项", "说明", "默认值" | ||
:widths: 1, 7, 2 | ||
|
||
"WITH_GPU", "是否支持GPU", "ON" | ||
"WITH_C_API", "是否仅编译CAPI", "OFF" | ||
"WITH_DOUBLE", "是否使用双精度浮点数", "OFF" | ||
"WITH_DSO", "是否运行时动态加载CUDA动态库,而非静态加载CUDA动态库。", "ON" | ||
"WITH_AVX", "是否编译含有AVX指令集的PaddlePaddle二进制文件", "ON" | ||
"WITH_PYTHON", "是否内嵌PYTHON解释器", "ON" | ||
"WITH_STYLE_CHECK", "是否编译时进行代码风格检查", "ON" | ||
"WITH_TESTING", "是否开启单元测试", "ON" | ||
"WITH_DOC", "是否编译中英文文档", "OFF" | ||
"WITH_SWIG_PY", "是否编译PYTHON的SWIG接口,该接口可用于预测和定制化训练", "Auto" | ||
"WITH_GOLANG", "是否编译go语言的可容错parameter server", "ON" | ||
"WITH_MKL", "是否使用MKL数学库,如果为否则是用OpenBLAS", "ON" | ||
|
||
BLAS | ||
+++++ | ||
|
||
PaddlePaddle支持 `MKL <https://software.intel.com/en-us/intel-mkl>`_ 和 | ||
`OpenBlAS <http://www.openblas.net/>`_ 两种BLAS库。默认使用MKL。如果使用MKL并且机器含有AVX2指令集, | ||
还会下载MKL-DNN数学库,详细参考 `这里 <https://github.com/PaddlePaddle/Paddle/tree/develop/doc/design/mkldnn#cmake>`_ 。 | ||
|
||
如果关闭MKL,则会使用OpenBLAS作为BLAS库。 | ||
|
||
CUDA/cuDNN | ||
+++++++++++ | ||
|
||
PaddlePaddle在编译时/运行时会自动找到系统中安装的CUDA和cuDNN库进行编译和执行。 | ||
使用参数 :code:`-DCUDA_ARCH_NAME=Auto` 可以指定开启自动检测SM架构,加速编译。 | ||
|
||
PaddlePaddle可以使用cuDNN v5.1之后的任何一个版本来编译运行,但尽量请保持编译和运行使用的cuDNN是同一个版本。 | ||
我们推荐使用最新版本的cuDNN。 | ||
|
||
编译选项的设置 | ||
++++++++++++++ | ||
|
||
PaddePaddle通过编译时指定路径来实现引用各种BLAS/CUDA/cuDNN库。cmake编译时,首先在系统路径( :code:`/usr/lib:/usr/local/lib` )中搜索这几个库,同时也会读取相关路径变量来进行搜索。 通过使用 ``-D`` 命令可以设置,例如 | ||
|
||
.. code-block:: bash | ||
|
||
cmake .. -DWITH_GPU=ON -DWITH_TESTING=OFF -DCUDNN_ROOT=/opt/cudnnv5 | ||
|
||
**注意:这几个编译选项的设置,只在第一次cmake的时候有效。如果之后想要重新设置,推荐清理整个编译目录(** :code:`rm -rf` )**后,再指定。** |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
表格的标题是斜体?不过可以等merge进整体网站的时候看看标题是否还是斜体。