Skip to content
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

Refine install docs #5943

Merged
merged 4 commits into from
Nov 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 32 additions & 4 deletions doc/getstarted/build_and_install/build_from_source_cn.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
从源码编译PaddlePaddle
从源码编译
======================

.. _build_step:
Expand All @@ -7,8 +7,11 @@
----------------

PaddlePaddle主要使用 `CMake <https://cmake.org>`_ 以及GCC, G++作为编译工具。
我们推荐您使用PaddlePaddle编译环境镜像完成编译,这样可以免去单独安装编译依赖的步骤,可选的不同编译环境
我们推荐您使用PaddlePaddle Docker编译环境镜像完成编译,这样可以免去单独安装编译依赖的步骤,可选的不同编译环境Docker镜像
可以在 `这里 <https://hub.docker.com/r/paddlepaddle/paddle_manylinux_devel/tags/>`_ 找到。

如果您选择不使用Docker镜像,则需要在本机安装下面章节列出的 `编译依赖`_ 之后才能开始编译的步骤。

编译PaddlePaddle,需要执行:

.. code-block:: bash
Expand All @@ -22,7 +25,6 @@ PaddlePaddle主要使用 `CMake <https://cmake.org>`_ 以及GCC, G++作为编译
cd build
cmake -DWITH_GPU=OFF -DWITH_TESTING=OFF ..
make


编译完成后会在build/python/dist目录下生成输出的whl包,可以选在在当前机器安装也可以拷贝到目标机器安装:

Expand All @@ -31,7 +33,33 @@ PaddlePaddle主要使用 `CMake <https://cmake.org>`_ 以及GCC, G++作为编译
pip install python/dist/*.whl


.. _build_step:
.. _run_test:

执行单元测试
----------------

如果您期望在编译完成后立即执行所有的单元测试,可以按照下面的方法:

使用Docker的情况下,设置 :code:`RUN_TEST=ON` 和 :code:`WITH_TESTING=ON` 就会在完成编译之后,立即执行单元测试。
开启 :code:`WITH_GPU=ON` 可以指定同时执行GPU上的单元测试。

.. code-block:: bash

docker run -it -v $PWD:/paddle -e "WITH_GPU=OFF" -e "WITH_TESTING=ON" -e "RUN_TEST=ON" paddlepaddle/paddle_manylinux_devel:cuda8.0_cudnn5 bash -x paddle/scripts/docker/build.sh

如果不使用Docker,可以执行ctest命令即可:

.. code-block:: bash

mkdir build
cd build
cmake -DWITH_GPU=OFF -DWITH_TESTING=OFF ..
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • DWITH_TESTING=OFF应该是ON吧。
  • ctest的命令,还可以用make test ARG='-j 4',可以一起加上么?
  • 这里只列出了跑所有单测的命令,还可以加上跑指定单测的命令:make test ARGS="-R test_mul_op -V"ctest -R test_mul_op

参考:/~https://github.com/PaddlePaddle/Paddle/blob/develop/doc/howto/dev/new_op_cn.md#编译和执行单元测试

Copy link
Contributor Author

@typhoonzero typhoonzero Nov 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ctest的命令,还可以用make test ARG='-j 4',可以一起加上么?

这个感觉不用吧,只保留一种执行test的方式,避免费解。

其他的Comments都更新了。感谢Review~

make
ctest
# 指定执行其中一个单元测试 test_mul_op
ctest -R test_mul_op

.. _compile_deps:

编译依赖
----------------
Expand Down
40 changes: 36 additions & 4 deletions doc/getstarted/build_and_install/build_from_source_en.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Build PaddlePaddle from Sources
Build from Sources
==========================

.. _build_step:
Expand All @@ -9,14 +9,18 @@ How To Build
PaddlePaddle mainly uses `CMake <https://cmake.org>`_ and GCC, G++ as compile
tools. We recommend you to use our pre-built Docker image to run the build
to avoid installing dependencies by yourself. We have several build environment
Docker images `here <https://hub.docker.com/r/paddlepaddle/paddle_manylinux_devel/tags/>`_.
Docker images `here <https://hub.docker.com/r/paddlepaddle/paddle_manylinux_devel/tags/>`_ .

If you choose not to use Docker image for your build, you need to install the
below `Compile Dependencies`_ before run the build.

Then run:

.. code-block:: bash

git clone /~https://github.com/PaddlePaddle/Paddle.git
cd Paddle
# run the following command to build CPU-Only binaries if you are using docker
# run the following command to build a CPU-Only binaries if you are using docker
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
# else run these commands
mkdir build
Expand All @@ -32,7 +36,35 @@ machine or copy it to the target machine.

pip install python/dist/*.whl

.. _build_step:

.. _run_test:

Run Tests
----------------

If you wish to run the tests, you may follow the below steps:

When using Docker, set :code:`RUN_TEST=ON` and :code:`WITH_TESTING=ON` will run test immediately after the build.
Set :code:`WITH_GPU=ON` Can also run tests on GPU.

.. code-block:: bash

docker run -it -v $PWD:/paddle -e "WITH_GPU=OFF" -e "WITH_TESTING=ON" -e "RUN_TEST=ON" paddlepaddle/paddle_manylinux_devel:cuda8.0_cudnn5 bash -x paddle/scripts/docker/build.sh

If you don't use Docker, just run ctest will start the tests:

.. code-block:: bash

mkdir build
cd build
cmake -DWITH_GPU=OFF -DWITH_TESTING=ON ..
make
ctest
# run a single test like test_mul_op
ctest -R test_mul_op


.. _compile_deps:

Compile Dependencies
----------------
Expand Down
2 changes: 1 addition & 1 deletion doc/getstarted/build_and_install/docker_install_cn.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
使用Docker安装运行PaddlePaddle
使用Docker安装运行
================================

使用Docker安装和运行PaddlePaddle可以无需考虑依赖环境即可运行。并且也可以在Windows的docker中运行。
Expand Down
2 changes: 1 addition & 1 deletion doc/getstarted/build_and_install/docker_install_en.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PaddlePaddle in Docker Containers
Run in Docker Containers
=================================

Run PaddlePaddle in Docker container so that you don't need to care about
Expand Down
2 changes: 1 addition & 1 deletion doc/getstarted/build_and_install/pip_install_cn.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
使用pip安装PaddlePaddle
使用pip安装
================================

PaddlePaddle可以使用常用的Python包管理工具
Expand Down
2 changes: 1 addition & 1 deletion doc/getstarted/build_and_install/pip_install_en.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Install PaddlePaddle Using pip
Install Using pip
================================

You can use current widely used Python package management
Expand Down
1 change: 0 additions & 1 deletion doc/howto/index_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
.. toctree::
:maxdepth: 1

dev/build_cn.rst
dev/write_docs_cn.rst

模型配置
Expand Down
1 change: 0 additions & 1 deletion doc/howto/index_en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Development
.. toctree::
:maxdepth: 1

dev/build_en.rst
dev/new_layer_en.rst
dev/contribute_to_paddle_en.md

Expand Down