提交 77eb729c 编写于 作者: G gangliao 提交者: GitHub

Merge pull request #1106 from gangliao/clean_docs

Update build and install docs
...@@ -286,22 +286,3 @@ PaddlePaddle的参数使用名字 :code:`name` 作为参数的ID,相同名字 ...@@ -286,22 +286,3 @@ PaddlePaddle的参数使用名字 :code:`name` 作为参数的ID,相同名字
.. code-block:: bash .. code-block:: bash
paddle train --use_gpu=true --trainer_count=2 --gpu_id=2 paddle train --use_gpu=true --trainer_count=2 --gpu_id=2
12. 编译源码提示warp-ctc/include/ctc.h 找不到的情况
---------------------------------------------------
目前Paddle使用\ :code:`git submodule`\ 来引用一些第三方模块。简单的\
:code:`git clone`\ 命令不能得到第三方模块的代码。需要使用\:
.. code-block:: bash
git clone --recursive https://github.com/PaddlePaddle/Paddle.git
来获取所有源码。对于已经clone的git版本库,可以在Paddle的源码目录中执行\:
.. code-block:: bash
git submodule init
git submodule update
来获得所有第三方模块。
...@@ -11,32 +11,21 @@ You can download PaddlePaddle from the [github source](https://github.com/Paddle ...@@ -11,32 +11,21 @@ You can download PaddlePaddle from the [github source](https://github.com/Paddle
```bash ```bash
git clone https://github.com/PaddlePaddle/Paddle paddle git clone https://github.com/PaddlePaddle/Paddle paddle
cd paddle cd paddle
git submodule update --init --recursive
``` ```
If you already have a local PaddlePaddle repo and have not initialized the submodule, your local submodule folder will be empty. You can simply run the last line of the above codes in your PaddlePaddle home directory to initialize your submodule folder.
If you have already initialized your submodule and you would like to sync with the upstream submodule repo, you can run the following command
```
git submodule update --remote
```
## <span id="requirements">Requirements</span> ## <span id="requirements">Requirements</span>
To compile the source code, your computer must be equipped with the following dependencies. To compile the source code, your computer must be equipped with the following dependencies.
- **Compiler**: GCC >= 4.8 or Clang >= 3.3 (AppleClang >= 5.1) - **Compiler**: GCC >= 4.8 or Clang >= 3.3 (AppleClang >= 5.1)
- **CMake**: version >= 2.8 - **CMake**: version >= 3.0 (at least CMake 3.4 on Mac OS X)
- **BLAS**: MKL, OpenBlas or ATLAS - **BLAS**: MKL, OpenBlas or ATLAS
- **Protocol Buffers**: version >= 2.4, **Note: 3.x is not supported**
- **Python**: only python 2.7 is supported currently
**Note:** For CUDA 7.0 and CUDA 7.5, GCC 5.0 and up are not supported! **Note:** For CUDA 7.0 and CUDA 7.5, GCC 5.0 and up are not supported!
For CUDA 8.0, GCC versions later than 5.3 are not supported! For CUDA 8.0, GCC versions later than 5.3 are not supported!
### Options ### Options
PaddlePaddle supports some build options. To enable it, first you need to install the related libraries. PaddlePaddle supports some build options.
<html> <html>
<table> <table>
...@@ -47,12 +36,21 @@ PaddlePaddle supports some build options. To enable it, first you need to instal ...@@ -47,12 +36,21 @@ PaddlePaddle supports some build options. To enable it, first you need to instal
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr><td class="left">WITH_GPU</td><td class="left">Compile with GPU mode.</td></tr> <tr><td class="left">WITH_GPU</td><td class="left">Compile PaddlePaddle with NVIDIA GPU</td></tr>
<tr><td class="left">WITH_DOUBLE</td><td class="left">Compile with double precision floating-point, default: single precision.</td></tr> <tr><td class="left">WITH_AVX</td><td class="left">Compile PaddlePaddle with AVX intrinsics</td></tr>
<tr><td class="left">WITH_TESTING</td><td class="left">Compile with gtest for PaddlePaddle's unit testing.</td></tr> <tr><td class="left">WITH_DSO</td><td class="left">Compile PaddlePaddle with dynamic linked CUDA</td></tr>
<tr><td class="left">WITH_DOC</td><td class="left"> Compile to generate PaddlePaddle's docs, default: disabled (OFF).</td></tr> <tr><td class="left">WITH_TESTING</td><td class="left">Compile PaddlePaddle with unit testing</td></tr>
<tr><td class="left">WITH_SWIG_PY</td><td class="left">Compile with python predict API, default: disabled (OFF).</td></tr> <tr><td class="left">WITH_SWIG_PY</td><td class="left">Compile PaddlePaddle with inference api</td></tr>
<tr><td class="left">WITH_STYLE_CHECK</td><td class="left">Compile with code style check, default: enabled (ON).</td></tr> <tr><td class="left">WITH_STYLE_CHECK</td><td class="left">Compile PaddlePaddle with style check</td></tr>
<tr><td class="left">WITH_PYTHON</td><td class="left">Compile PaddlePaddle with python interpreter</td></tr>
<tr><td class="left">WITH_DOUBLE</td><td class="left">Compile PaddlePaddle with double precision</td></tr>
<tr><td class="left">WITH_RDMA</td><td class="left">Compile PaddlePaddle with RDMA support</td></tr>
<tr><td class="left">WITH_TIMER</td><td class="left">Compile PaddlePaddle with stats timer</td></tr>
<tr><td class="left">WITH_PROFILER</td><td class="left">Compile PaddlePaddle with GPU profiler</td></tr>
<tr><td class="left">WITH_DOC</td><td class="left">Compile PaddlePaddle with documentation</td></tr>
<tr><td class="left">ON_COVERALLS</td><td class="left">Compile PaddlePaddle with code coverage</td></tr>
<tr><td class="left">COVERALLS_UPLOAD</td><td class="left">Package code coverage data to coveralls</td></tr>
<tr><td class="left">ON_TRAVIS</td><td class="left">Exclude special unit test on Travis CI</td></tr>
</tbody> </tbody>
</table> </table>
</html> </html>
...@@ -64,18 +62,15 @@ PaddlePaddle supports some build options. To enable it, first you need to instal ...@@ -64,18 +62,15 @@ PaddlePaddle supports some build options. To enable it, first you need to instal
As a simple example, consider the following: As a simple example, consider the following:
1. **Python Dependencies(optional)** 1. **BLAS Dependencies(optional)**
To compile PaddlePaddle with python predict API, make sure swig installed and set `-DWITH_SWIG_PY=ON` as follows: Paddle will find BLAS from system's default path. But you can specify MKL, OpenBLAS or ATLAS via `MKL_ROOT`, `OPENBLAS_ROOT` or `ATLAS_ROOT`.
```bash ```bash
# install swig on ubuntu # specify MKL
sudo apt-get install swig cmake .. -DMKL_ROOT=<mkl_path>
# install swig on Mac OS X # or specify OpenBLAS
brew install swig cmake .. -DOPENBLAS_ROOT=<openblas_path>
# active swig in cmake
cmake .. -DWITH_SWIG_PY=ON
``` ```
2. **Doc Dependencies(optional)** 2. **Doc Dependencies(optional)**
...@@ -104,17 +99,9 @@ As a simple example, consider the following: ...@@ -104,17 +99,9 @@ As a simple example, consider the following:
```bash ```bash
# necessary # necessary
sudo apt-get update sudo apt-get update
sudo apt-get install -y g++ make cmake swig build-essential libatlas-base-dev python python-pip libpython-dev m4 libprotobuf-dev protobuf-compiler python-protobuf python-numpy git sudo apt-get install -y g++ make cmake build-essential libatlas-base-dev python python-pip libpython-dev git
# optional sudo pip install wheel numpy
sudo apt-get install libgoogle-glog-dev sudo pip install 'protobuf>=3.0.0'
sudo apt-get install libgflags-dev
sudo apt-get install libgtest-dev
sudo pip install wheel
pushd /usr/src/gtest
cmake .
make
sudo cp *.a /usr/lib
popd
``` ```
- **GPU Dependencies (optional)** - **GPU Dependencies (optional)**
...@@ -149,51 +136,17 @@ As usual, the best option is to create build folder under paddle project directo ...@@ -149,51 +136,17 @@ As usual, the best option is to create build folder under paddle project directo
```bash ```bash
mkdir build && cd build mkdir build && cd build
cmake .. ```
```
CMake first check PaddlePaddle's dependencies in system default path. After installing some optional
libraries, corresponding build option will be set automatically (for instance, glog, gtest and gflags).
If still not found, you can manually set it based on CMake error information from your screen.
As a simple example, consider the following:
- **Only CPU with swig** Finally, you can build and install PaddlePaddle:
```bash
cmake .. -DWITH_GPU=OFF -DWITH_SWIG_PY=ON
```
- **GPU with swig**
```bash
cmake .. -DWITH_GPU=ON -DWITH_SWIG_PY=ON
```
- **GPU with doc and swig**
```bash
cmake .. -DWITH_GPU=ON -DWITH_DOC=ON -DWITH_SWIG_PY=ON
```
Finally, you can build PaddlePaddle:
```bash ```bash
# you can add build option here, such as: # you can add build option here, such as:
cmake .. -DWITH_GPU=ON -DCMAKE_INSTALL_PREFIX=<path to install> -DWITH_SWIG_PY=ON cmake .. -DCMAKE_INSTALL_PREFIX=<path to install>
# please use sudo make install, if you want to install PaddlePaddle into the system # please use sudo make install, if you want to install PaddlePaddle into the system
make -j `nproc` && make install make -j `nproc` && make install
# set PaddlePaddle installation path in ~/.bashrc # set PaddlePaddle installation path in ~/.bashrc
export PATH=<path to install>/bin:$PATH export PATH=<path to install>/bin:$PATH
``` # install PaddlePaddle Python modules.
If you set `WITH_SWIG_PY=ON`, related python dependencies also need to be installed.
Otherwise, PaddlePaddle will automatically install python dependencies
at first time when user run paddle commands, such as `paddle version`, `paddle train`.
It may require sudo privileges:
```bash
# you can run
sudo pip install <path to install>/opt/paddle/share/wheels/*.whl sudo pip install <path to install>/opt/paddle/share/wheels/*.whl
# or just run
sudo paddle version
``` ```
...@@ -40,4 +40,4 @@ PaddePaddle通过编译时指定路径来实现引用各种BLAS/CUDA/Cudnn库。 ...@@ -40,4 +40,4 @@ PaddePaddle通过编译时指定路径来实现引用各种BLAS/CUDA/Cudnn库。
cmake .. -DMKL_ROOT=/opt/mkl/ -DCUDNN_ROOT=/opt/cudnnv5 cmake .. -DMKL_ROOT=/opt/mkl/ -DCUDNN_ROOT=/opt/cudnnv5
注意:这几个编译选项的设置,只在第一次cmake的时候有效。如果之后想要重新设置,推荐清理整个编译目录(``rm -rf``)后,再指定。 注意:这几个编译选项的设置,只在第一次cmake的时候有效。如果之后想要重新设置,推荐清理整个编译目录(``rm -rf``)后,再指定。
\ No newline at end of file
...@@ -16,23 +16,13 @@ Developers can work on PaddlePaddle using Docker. This allows ...@@ -16,23 +16,13 @@ Developers can work on PaddlePaddle using Docker. This allows
developers to work on different platforms -- Linux, Mac OS X, and developers to work on different platforms -- Linux, Mac OS X, and
Windows -- in a consistent way. Windows -- in a consistent way.
The general development workflow with Docker and Bazel is as follows: The general development workflow with Docker and CMake is as follows:
1. Get the source code of Paddle: 1. Get the source code of Paddle:
.. code-block:: bash .. code-block:: bash
git clone --recursive https://github.com/PaddlePaddle/Paddle.git git clone https://github.com/PaddlePaddle/Paddle.git
Here **git clone --recursive is required** as we have a submodule `warp-ctc <https://github.com/baidu-research/warp-ctc>`_.
If you have used :code:`git clone https://github.com/PaddlePaddle/Paddle` and find that the directory :code:`warp-ctc` is
empty, please use the following command to get the submodule.
.. code-block:: bash
git submodule update --init --recursive
2. Build a development Docker image :code:`paddle:dev` from the source 2. Build a development Docker image :code:`paddle:dev` from the source
...@@ -162,7 +152,6 @@ source code: ...@@ -162,7 +152,6 @@ source code:
cd ~ cd ~
git clone https://github.com/PaddlePaddle/Paddle.git git clone https://github.com/PaddlePaddle/Paddle.git
cd Paddle cd Paddle
git submodule update --init --recursive
docker build --build-arg WITH_AVX=OFF -t paddle:cpu-noavx -f paddle/scripts/docker/Dockerfile . docker build --build-arg WITH_AVX=OFF -t paddle:cpu-noavx -f paddle/scripts/docker/Dockerfile .
docker build --build-arg WITH_AVX=OFF -t paddle:gpu-noavx -f paddle/scripts/docker/Dockerfile.gpu . docker build --build-arg WITH_AVX=OFF -t paddle:gpu-noavx -f paddle/scripts/docker/Dockerfile.gpu .
......
...@@ -33,7 +33,6 @@ cd Paddle ...@@ -33,7 +33,6 @@ cd Paddle
git checkout -b develop # 创建 develop 分支 git checkout -b develop # 创建 develop 分支
git remote add upstream https://github.com/PaddlePaddle/Paddle.git # 添加 upstream 到 baidu/Paddle git remote add upstream https://github.com/PaddlePaddle/Paddle.git # 添加 upstream 到 baidu/Paddle
git pull upstream develop # 更新 upstream git pull upstream develop # 更新 upstream
git submodule update --init --recursive
``` ```
然后你可以通过做一个本地开发分支开始开发 然后你可以通过做一个本地开发分支开始开发
......
...@@ -38,7 +38,6 @@ cd Paddle ...@@ -38,7 +38,6 @@ cd Paddle
git checkout -b develop # create develop branch. git checkout -b develop # create develop branch.
git remote add upstream https://github.com/PaddlePaddle/Paddle.git # add upstream to baidu/Paddle git remote add upstream https://github.com/PaddlePaddle/Paddle.git # add upstream to baidu/Paddle
git pull upstream develop # update to upstream git pull upstream develop # update to upstream
git submodule update --init --recursive
``` ```
Then you can start to develop by making a local developement branch Then you can start to develop by making a local developement branch
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册