Appendix¶
Compile Dependency Table¶
Dependency package name | Version | Description | Installation command |
---|---|---|---|
CMake | 3.4 | ||
GCC | 4.8 / 5.4 | recommends using devtools2 for CentOS | |
Python | 2.7.x. | depends on libpython2.7.so | apt install python-dev or yum install python-devel |
SWIG | at least 2.0 | apt install swig or yum install swig |
|
wget | any | apt install wget or yum install wget |
|
openblas | any | ||
pip | at least 9.0.1 | apt install python-pip or yum install Python-pip |
|
numpy | >=1.12.0 | pip install numpy==1.14.0 |
|
protobuf | 3.1.0 | pip install protobuf==3.1.0 |
|
wheel | any | pip install wheel |
|
patchELF | any | apt install patchelf or read github patchELF official documentation |
|
go | >=1.8 | optional |
Compile Option Table¶
Option | Description | Default |
---|---|---|
WITH_GPU | Whether to support GPU | ON |
WITH_C_API | Whether to compile CAPI | OFF |
WITH_DOUBLE | Whether to use double precision floating point numeber | OFF |
WITH_DSO | whether to load CUDA dynamic libraries dynamically at runtime, instead of statically loading CUDA dynamic libraries. | ON |
WITH_AVX | whether to compile PaddlePaddle binaries file containing the AVX instruction set | ON |
WITH_PYTHON | Whether the PYTHON interpreter is embedded | ON |
WITH_STYLE_CHECK | Whether to perform code style checking at compile time | ON |
WITH_TESTING | Whether to turn on unit test | OFF |
WITH_DOC | Whether to compile Chinese and English documents | OFF |
WITH_SWIG_PY | Whether to compile PYTHON's SWIG interface, which can be used for predicting and customizing training | Auto |
WITH_GOLANG | Whether to compile the fault-tolerant parameter server of the go language | OFF |
WITH_MKL | Whether to use the MKL math library, if not,using OpenBLAS | ON |
WITH_SYSTEM_BLAS | Whether to use the system's BLAS | OFF |
WITH_DISTRIBUTE | Whether to Compile with distributed version | OFF |
WITH_RDMA | Whether to compile the relevant parts that supports RDMA | OFF |
WITH_BRPC_RDMA | Whether to use BRPC RDMA as RPC protocol | OFF |
ON_INFER | Whether to turn on prediction optimization | OFF |
DWITH_ANAKIN | Whether to Compile ANAKIN | OFF |
BLAS
PaddlePaddle supports two BLAS libraries, MKL and OpenBlAS. MKL is used by default. If you use MKL and the machine contains the AVX2 instruction set, you will also download the MKL-DNN math library, for details please refer to here.
If you close MKL, OpenBLAS will be used as the BLAS library.
CUDA/cuDNN
PaddlePaddle automatically finds the CUDA and cuDNN libraries installed in the system for compilation and execution at compile time/runtime. Use the parameter -DCUDA_ARCH_NAME=Auto
to specify to enable automatic detection of the SM architecture and speed up compilation.
PaddlePaddle can be compiled and run using any version after cuDNN v5.1, but try to keep the same version of cuDNN in the compiling and running processes. We recommend using the latest version of cuDNN.
Configure Compile Options
PaddePaddle implements references to various BLAS/CUDA/cuDNN libraries by specifying paths at compile time. When cmake compiles, it first searches the system paths ( /usr/liby
and /usr/local/lib
) for these libraries, and also reads the relevant path variables for searching. Can be set by using the -D
command, for example:
Cmake .. -DWITH_GPU=ON -DWITH_TESTING=OFF -DCUDNN_ROOT=/opt/cudnnv5
Note: The settings introduced here for these compilation options are only valid for the first cmake. If you want to reset it later, it is recommended to clean up the entire build directory ( rm -rf ) and then specify it.
Installation Package List¶
Version Number | Release Discription |
---|---|
paddlepaddle==[version code] such as paddlepaddle==1.5.1 | Only support the corresponding version of the CPU PaddlePaddle, please refer to Pypi for the specific version. |
paddlepaddle-gpu==1.5.1 | Using version 1.5.1 compiled with CUDA 9.0 and cuDNN 7 |
paddlepaddle-gpu==1.5.1.post87 | Using version 1.5.1 compiled with CUDA 8.0 and cuDNN 7 |
You can find various distributions of PaddlePaddle-gpu in the Release History.
Please note that: paddlepaddle-gpu in windows, will download package compiled with CUDA 8.0 and cuDNN 7
Installation Mirrors and Introduction¶
Version Number | Release Description |
---|---|
hub.baidubce.com/paddlepaddle/paddle:latest | The latest pre-installed image of the PaddlePaddle CPU version |
hub.baidubce.com/paddlepaddle/paddle:latest-dev | The latest PaddlePaddle development environment |
hub.baidubce.com/paddlepaddle/paddle:[Version] | Replace version with a specific version, preinstalled PaddlePaddle image in historical version |
hub.baidubce.com/paddlepaddle/paddle:latest-gpu | The latest pre-installed image of the PaddlePaddle GPU version |
You can find the docker image for each release of PaddlePaddle in the DockerHub.
Multi-version whl package list - Release¶
Multi-version whl package list - dev¶
Execute the PaddlePaddle training program in Docker¶
Suppose you have written a PaddlePaddle program in the current directory (such as /home/work): train.py
( refer to PaddlePaddleBook to write), you can start the training with the following command:
cd /home/work
docker run -it -v $PWD:/work hub.baidubce.com/paddlepaddle/paddle /work/train.py
In the above commands, the -it
parameter indicates that the container has been run interactively; -v $PWD:/work
specifies that the current path (the absolute path where the PWD variable in Linux will expand to the current path) is mounted to the :/work
directory inside the container: Hub.baidubce.com/paddlepaddle/paddle
specifies the container to be used; finally /work/train.py
is the command executed inside the container, ie. the training program.
Of course, you can also enter into the Docker container and execute or debug your code interactively:
docker run -it -v $PWD:/work hub.baidubce.com/paddlepaddle/paddle /bin/bash
cd /work
python train.py
**Note: In order to reduce the size, vim is not installed in PaddlePaddle Docker image by default. You can edit the code in the container after executing ** apt-get install -y vim
(which installs vim for you) in the container.
Start PaddlePaddle Book tutorial with Docker¶
Use Docker to quickly launch a local Jupyter Notebook containing the PaddlePaddle official Book tutorial, which can be viewed on the web. PaddlePaddle Book is an interactive Jupyter Notebook for users and developers. If you want to learn more about deep learning, PaddlePaddle Book is definitely your best choice. You can read tutorials or create and share interactive documents with code, formulas, charts, and text.
We provide a Docker image that can run the PaddlePaddle Book directly, running directly:
docker run -p 8888:8888 hub.baidubce.com/paddlepaddle/book
Domestic users can use the following image source to speed up access:
docker run -p 8888:8888 hub.baidubce.com/paddlepaddle/book
Then enter the following URL in your browser:
http://localhost:8888/
It’s that simple and bon voyage! For further questions, please refer to the FAQ.
Perform GPU training using Docker¶
In order to ensure that the GPU driver works properly in the image, we recommend using nvidia-docker to run the image. Don’t forget to install the latest GPU drivers on your physical machine in advance.
Nvidia-docker run -it -v $PWD:/work hub.baidubce.com/paddlepaddle/paddle:latest-gpu /bin/bash
Note: If you don’t have nvidia-docker installed, you can try the following to mount the CUDA library and Linux devices into the Docker container:
export CUDA_SO="$(\ls /usr/lib64/libcuda* | xargs -I{} echo '-v {}:{}') \
$(\ls /usr/lib64/libnvidia* | xargs -I{} echo '-v {}:{}')"
export DEVICES=$(\ls /dev/nvidia* | xargs -I{} echo '--device {}:{}')
docker run ${CUDA_SO} \
${DEVICES} -it hub.baidubce.com/paddlepaddle/paddle:latest-gpu
About AVX:
AVX is a set of CPU instructions that speeds up the calculation of PaddlePaddle. The latest PaddlePaddle Docker image is enabled by default for AVX compilation, so if your computer does not support AVX, you need to compile PaddlePaddle to no-avx version separately.
The following instructions can check if the Linux computer supports AVX:
if cat /proc/cpuinfo | grep -i avx; then echo Yes; else echo No; fi
If the output is No, you need to choose a mirror that uses no-AVX.