Skip to content

Commit

Permalink
Synchronize the English compilation and installation doc with chinese…
Browse files Browse the repository at this point in the history
…,test=develop (PaddlePaddle#1920)

Synchronize the English compilation and installation doc with chinese.
  • Loading branch information
zhwesky2010 authored Mar 16, 2020
1 parent 4c14798 commit 8e63ecf
Show file tree
Hide file tree
Showing 5 changed files with 190 additions and 154 deletions.
34 changes: 18 additions & 16 deletions doc/fluid/install/compile/compile_Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

## 环境准备

* **Windows 7/8/10 专业版/企业版 (64bit) (GPU版本支持CUDA 9.0/10.0, 且仅支持单卡)**
* **Python 版本 2.7/3.5.1+/3.6/3.7 (64 bit)**
* **Windows 7/8/10 专业版/企业版 (64bit)**
* **GPU版本支持CUDA 9.0/9.1/9.2/10.0/10.1,且仅支持单卡**
* **Python 版本 2.7.15+/3.5.1+/3.6/3.7 (64 bit)**
* **pip 版本 9.0.1+ (64 bit)**
* **Visual Studio 2015 Update3**

Expand All @@ -12,7 +13,7 @@
* 如果您的计算机没有 NVIDIA® GPU,请编译CPU版的PaddlePaddle

* 如果您的计算机有NVIDIA® GPU,并且满足以下条件,推荐编译GPU版的PaddlePaddle
* **CUDA 工具包9.0/10.0配合cuDNN v7.3+**
* **CUDA 工具包 9.0/9.1/9.2/10.0/10.1 配合 cuDNN v7.3+**
* **GPU运算能力超过1.0的硬件设备**

## 安装步骤
Expand All @@ -30,15 +31,17 @@
> python 需要 2.7 及以上版本, 可在官网[下载](https://www.python.org/download/releases/2.7/)
> 需要安装`numpy, protobuf, wheel` 。python2.7下, 请使用`pip`命令; 如果是python3.x, 请使用`pip3`命令
* 安装完python 后请通过 `python --version` 检查python版本是否是预期版本,因为您的计算机可能安装有多个python,您可通过修改环境变量的顺序来处理多个python时的冲突

* 安装 numpy 包可以通过命令 `pip install numpy` 或 `pip3 install numpy`
* 安装 protobuf 包可以通过命令 `pip install protobuf` 或 `pip3 install protobuf`
* 安装 wheel 包可以通过命令 `pip install wheel` 或 `pip3 install wheel`
> 需要安装`numpy, protobuf, wheel` 。 请使用`pip`命令;
* 安装 numpy 包可以通过命令 `pip install numpy`
* 安装 protobuf 包可以通过命令 `pip install protobuf`
* 安装 wheel 包可以通过命令 `pip install wheel`

> git可以在官网[下载](https://gitforwindows.org/),并添加到环境变量中。
2. 将PaddlePaddle的源码clone在当下目录下的Paddle的文件夹中,并进入Padde目录下:
2. 将PaddlePaddle的源码clone在当前目录下的Paddle的文件夹中,并进入Padde目录下:

- `git clone https://github.com/PaddlePaddle/Paddle.git`
- `cd Paddle`
Expand All @@ -49,7 +52,7 @@

例如:

`git checkout release/1.5`
`git checkout release/1.7`

注意:python3.6、python3.7版本从release/1.2分支开始支持

Expand All @@ -76,9 +79,9 @@
如果你的设备信息包含多个Python或CUDA版本,你也可以通过设置路径变量,来指定特定版本的Python或CUDA:

> -DPYTHON_EXECUTABLE 为python的可执行程序(python.exe)的路径
> -DPYTHON_EXECUTABLE: python的安装目录
> -DCUDA_TOOLKIT_ROOT_DIR 为cuda安装目录的根路径
> -DCUDA_TOOLKIT_ROOT_DIR: cuda的安装目录
例如:(仅作示例,请根据你的设备路径信息进行设置)

Expand All @@ -90,9 +93,9 @@

`cd \Paddle\build\python\dist`

8. 在当前机器或目标机器安装编译好的 `.whl` 包:
8. 安装编译好的 `.whl` 包:

`pip install -U(whl包的名字)``pip3 install -U(whl包的名字)`
`pip install -U(whl包的名字)`

恭喜,至此您已完成PaddlePaddle的编译安装

Expand All @@ -105,8 +108,7 @@
## **如何卸载**
请使用以下命令卸载PaddlePaddle:

* **CPU版本的PaddlePaddle**: `pip uninstall paddlepaddle``pip3 uninstall paddlepaddle`
* **CPU版本的PaddlePaddle**: `python -m pip uninstall paddlepaddle`

* **GPU版本的PaddlePaddle**: `pip uninstall paddlepaddle-gpu``pip3 uninstall paddlepaddle-gpu`
* **GPU版本的PaddlePaddle**: `python -m pip uninstall paddlepaddle-gpu`

使用Docker安装PaddlePaddle的用户,请进入包含PaddlePaddle的容器中使用上述命令,注意使用对应版本的pip
103 changes: 61 additions & 42 deletions doc/fluid/install/compile/compile_Windows_en.md
Original file line number Diff line number Diff line change
@@ -1,99 +1,118 @@
# **Compile on Windows from Source Code**

This instruction will show you how to compile PaddlePaddle on a *64-bit desktop or laptop* and Windows 10. The Windows systems we support must meet the following requirements:
## Environment preparation

* Windows 10 Professional Edition / Enterprise Edition
* Visual Studio 2015 Update3
* **Windows 7/8/10 Pro/Enterprise(64bit)**
* **GPU Version support CUDA 9.0/9.1/9.2/10.0/10.1, and only support single GPU**
* **Python version 2.7.15+/3.5.1+/3.6/3.7(64bit)**
* **pip version 9.0.1+(64bit)**
* **Visual Studio 2015 Update3**

## Choose a compilation method
## Choose CPU/GPU

We provide one compilation method under the Windows system:
* If your computer doesn't have NVIDIA® GPU, please install CPU version of PaddlePaddle

* Direct source code compilation
* If your computer has NVIDIA® GPU, and the following conditions are met,GPU version of PaddlePaddle is recommended.
* **CUDA toolkit 9.0/9.1/9.2/10.0/10.1 with cuDNN v7.3+**
* **GPU's computing capability exceeds 1.0**

Since the situation on host machine is more complicated, we only support specific systems.
## Installation steps

Please note: The current version does not support NCCL and distributed related functions.
There is one compilation methods in Windows system:

* Direct native source code compilation(NCCL, distributed and other related functions are not supported temporarily)

### ***Local compilation***
<a name="win_source"></a>
### ***Direct native source code compilation***

**Please strictly follow the following instructions step by step**

1. Check that your computer and operating system meet our supported compilation standards
1. Install the necessary tools i.e. cmake, git and python:

* Windows 10 Professional Edition / Enterprise Edition
> Cmake requires version 3.5 and above, which can be downloaded from the [official website](https://cmake.org/download/) and added to the environment variable.
* Visual Studio 2015 Update3
> Python requires version 2.7 and above, which can be downloaded from the [official website](https://www.python.org/download/releases/2.7/).
2. Install the necessary tools i.e. cmake, git and python :
* After installing python, please check whether the python version is the expected version by `python-version`, because you may have more than one python installed on your computer. You can handle conflicts of multiple pythons by changing the order of the environment variables.

> Cmake requires version 3.0 and above, which can be downloaded from the official website and added to the environment variable. [Download here](https://cmake.org/download/).
> `numpy, protobuf, wheel` are needed to be installed. Use the 'pip' command.
> Git can be downloaded on the official website and added to the environment variable. [Download here](https://gitforwindows.org/).
* To Install numpy package you can use command `pip install numpy`

> Python requires version 2.7 and above, and ensure that modules such as numpy, protobuf, wheel are installed. [Download here](https://www.python.org/download/releases/2.7/).
* To Install protobuf package you can use command `pip install protobuf`

* To Install Wheel package you can use command `pip install wheel`

* To Install numpy package you can use command `pip install numpy` or command `pip3 install numpy`
> Git can be downloaded on the [official website](https://gitforwindows.org/) and added to the environment variable.
* To Install protobuf package you can use command `pip install protobuf` or command `pip3 install protobuf`
2. Clone the PaddlePaddle source code to the Paddle subdirectories of the current directory and go to the Paddle subdirectories:

* To Install Wheel package you can use command `pip install wheel` or `pip3 install wheel`
- `git clone https://github.com/PaddlePaddle/Paddle.git`
- `cd Paddle`

3. Switch to a more stable release branch for compilation:

3. Clone the PaddlePaddle source in the Paddle folder in the current directory and go to the Paddle directory:
`git checkout [name of the branch]`

- `git clone https://github.com/PaddlePaddle/Paddle.git`
- `cd Paddle`
For example:

4. Switch to a more stable release branch for compilation :
`git checkout release/1.7`

- `git checkout release/1.5`
Note: python3.6、python3.7 version started supporting from release/1.2

5. Create a directory called build and enter it:
4. Create a directory called build and enter it:

- `mkdir build`
- `cd build`

6. Execute cmake:
5. Execute cmake:

> For details on the compilation options, see [the compilation options list](../Tables.html/#Compile).
* For users who need to compile **the CPU version PaddlePaddle**:

For Python2:`cmake .. -G "Visual Studio 14 2015 Win64" -DPYTHON_INCLUDE_DIR = $ {PYTHON_INCLUDE_DIRS}
-DPYTHON_LIBRARY = $ {PYTHON_LIBRARY}
-DPYTHON_EXECUTABLE = $ {PYTHON_EXECUTABLE} -DWITH_FLUID_ONLY = ON -DWITH_GPU = OFF -DWITH_TESTING = OFF -DCMAKE_BUILD_TYPE =Release`
`cmake .. -G "Visual Studio 14 2015 Win64" -DWITH_GPU=OFF -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release`

* For users who need to compile **the GPU version PaddlePaddle**:

For Python3: `cmake .. -G "Visual Studio 14 2015 Win64" -DPY_VERSION = 3.5 -DPYTHON_INCLUDE_DIR = $ {PYTHON_INCLUDE_DIRS}
-DPYTHON_LIBRARY = $ {PYTHON_LIBRARY}
-DPYTHON_EXECUTABLE = $ {PYTHON_EXECUTABLE} -DWITH_FLUID_ONLY = ON -DWITH_GPU = OFF -DWITH_TESTING =OFF -DCMAKE_BUILD_TYPE=Release`
`cmake .. -G "Visual Studio 14 2015 Win64" -DWITH_GPU=ON -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release`

Python2 by default,Python3 please add:

7. Some third-party dependencies (openblas, snappystream) currently require users to provide pre-compiled versions, or download pre-compiled files from `https://github.com/wopeizl/Paddle_deps` and place the entire `third_party` folder in the `build` directory.
> -DPY_VERSION=3 (or 3.5、3.6、3.7)
8. Use Blend for Visual Studio 2015 to open `paddle.sln` file, select the platform `x64`, configure with `Release`, then begin to compile
If your device information contains multiple Python or CUDA, you can also specify a specific version of Python or CUDA by setting the corresponding compile options:

9. Having compiled successfully, go to the `\paddle\build\python\dist`directory and find the generated `.whl` package:
> -DPYTHON_EXECUTABLE: the installation path of python
`cd \paddle\build\python\dist`
> -DCUDA_TOOLKIT_ROOT_DIR: the installation path of CUDA
For example: (for instance only, please set it according to your actual installation path)

10. Install the compiled `.whl` package on the current machine or target machine:
`cmake .. -G "Visual Studio 14 2015 Win64" -DCMAKE_BUILD_TYPE=Release -DWITH_GPU=ON -DWITH_TESTING=OFF -DPYTHON_EXECUTABLE=C:\\Python36\\python.exe -DCUDA_TOOLKIT_ROOT_DIR="C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\v10.0"`

`pip install (whl package name)` or `pip3 install (whl package name)`
6. Use Blend for Visual Studio 2015 to open `paddle.sln` file, select the platform `x64`, configure with `Release`, then begin to compile

Congratulations, now you have completed the process of compiling PaddlePaddle natively.
7. After compilation successfully, go to the `\paddle\build\python\dist` directory and find the generated `.whl` package:

`cd \paddle\build\python\dist`

8. Install the generated `.whl` package:

`pip install -U (whl package name)`

Congratulations, you have completed the process of compiling PaddlePaddle successfully!

### ***Verify installation***

After the installation is complete, you can use: `python` to enter the Python interpreter and then use `import paddle.fluid`. If there is no error prompted, the installation is successful.
After the compilation and installation is completed, you can use `python` to enter the Python interface, input `import paddle.fluid as fluid` and then `fluid.install_check.run_check()` to verify that the installation was successful.

If `Your Paddle Fluid is installed succesfully!` appears, it means the compilation and installation was successful.


### ***How to uninstall***

Please use the following command to uninstall PaddlePaddle:

* ***CPU version of PaddlePaddle*** : `pip uninstall paddlepaddle` or `pip3 uninstall paddlepaddle`
* ***CPU version of PaddlePaddle*** : `pip uninstall paddlepaddle`

* ***GPU version of PaddlePaddle*** : `pip uninstall paddlepaddle-gpu` or `pip3 uninstall paddlepaddle-gpu`
* ***GPU version of PaddlePaddle*** : `pip uninstall paddlepaddle-gpu`
Loading

0 comments on commit 8e63ecf

Please sign in to comment.