From 8ebfb4040a19f9075c67eaad13bc94e1e1a6eb31 Mon Sep 17 00:00:00 2001 From: qijun Date: Wed, 31 Aug 2016 14:04:31 +0000 Subject: [PATCH] add docker and deb installation guide ISSUE=4605535 git-svn-id: https://svn.baidu.com/idl/trunk/paddle@1466 1ad973e4-5ce8-4261-8a94-b56d1f490c56 --- doc/build/build_from_source.md | 4 +- doc/build/docker_install.md | 91 ++++++++++++++++++++++++++++++++++ doc/build/index.rst | 10 ++-- doc/build/ubuntu_install.md | 21 ++++++++ 4 files changed, 120 insertions(+), 6 deletions(-) create mode 100644 doc/build/docker_install.md create mode 100644 doc/build/ubuntu_install.md diff --git a/doc/build/build_from_source.md b/doc/build/build_from_source.md index 9d3b030802..2c32c37e9d 100644 --- a/doc/build/build_from_source.md +++ b/doc/build/build_from_source.md @@ -87,9 +87,9 @@ sudo apt-get install swig If you want to compile PaddlePaddle with doc, you need to add -DWITH_DOC=ON in cmake command and install these first: ```bash -pip install sphinx +pip install 'sphinx>=1.4.0' pip install sphinx_rtd_theme breathe recommonmark -sudo apt-get install python-sphinx doxygen +sudo apt-get install doxygen ``` ### Build and Install diff --git a/doc/build/docker_install.md b/doc/build/docker_install.md new file mode 100644 index 0000000000..997a755956 --- /dev/null +++ b/doc/build/docker_install.md @@ -0,0 +1,91 @@ +Docker installation guide +==================== +PaddlePaddle provides some pre-compiled binary, including Docker images, ubuntu deb packages. It is welcomed to contributed more installation package of different linux distribution (such as ubuntu, centos, debian, gentoo and so on). We recommend to use Docker images to deploy PaddlePaddle. +## Docker installation + +Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. + +### PaddlePaddle Docker images +There are six Docker images: + +- paddledev/paddle:latest-cpu: PaddlePaddle CPU binary image. +- paddledev/paddle:latest-gpu: PaddlePaddle GPU binary image. +- paddledev/paddle:latest-cpu-devel: PaddlePaddle CPU binary image plus source code. +- paddledev/paddle:latest-gpu-devel: PaddlePaddle GPU binary image plus source code. +- paddledev/paddle:latest-cpu-demo: PaddlePaddle CPU binary image plus source code and demo +- paddledev/paddle:latest-gpu-demo: PaddlePaddle GPU binary image plus source code and demo + +Tags with latest will be replaced by a released version. + +### Download and Run Docker images + +You have to install Docker in your machine which has linux kernel version 3.10+ first. You can refer to the official guide https://docs.docker.com/engine/installation/ for further information. + +You can use ```docker pull ```to download images first, or just launch a container with ```docker run```: +```bash +docker run -it paddledev/paddle:lastest-cpu +``` + +If you want to launch container with GPU support, you need to set some environment variables at the same time: + +```bash +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 -it paddledev/paddle:latest-gpu +``` + +### Notice + +#### Performance + +Since Docker is based on the lightweight virtual containers, the CPU computing performance maintains well. And GPU driver and equipments are all mapped to the container, so the GPU computing performance would not be seriously affected. + +If you use high performance nic, such as RDMA(RoCE 40GbE or IB 56GbE), Ethernet(10GbE), it is recommended to use config "-net = host". + + + + +#### Remote access +If you want to enable ssh access background, you need to build an image by yourself. Please refer to official guide https://docs.docker.com/engine/reference/builder/ for further information. + +Following is a simple Dockerfile with ssh: +```bash +FROM paddledev/paddle + +MAINTAINER PaddlePaddle dev team + +RUN apt-get update +RUN apt-get install -y openssh-server +RUN mkdir /var/run/sshd +RUN echo 'root:root' | chpasswd + +RUN sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config +RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config + +EXPOSE 22 + +CMD ["/usr/sbin/sshd", "-D"] +``` + +Then you can build an image with Dockerfile and launch a container: + +```bash +# cd into Dockerfile directory +docker build . -t paddle_ssh +# run container, and map host machine port 8022 to container port 22 +docker run -d -p 8022:22 --name paddle_ssh_machine paddle_ssh +``` +Now, you can ssh on port 8022 to access the container, username is root, password is also root: + +```bash +ssh -p 8022 root@YOUR_HOST_MACHINE +``` + + +You can stop and delete the container as following: +```bash +# stop +docker stop paddle_ssh_machine +# delete +docker rm paddle_ssh_machine +``` diff --git a/doc/build/index.rst b/doc/build/index.rst index 2227234d77..6fefa7990a 100644 --- a/doc/build/index.rst +++ b/doc/build/index.rst @@ -20,10 +20,10 @@ If you want to hack and contribute PaddlePaddle source code, following guides ca build_from_source.md contribute_to_paddle.md -Build Docker Images -------------------- +Docker and Debian Package installation +-------------------------------------- -Note: The intallation packages are still in pre-release +Note: The installation packages are still in pre-release state and your experience of installation may not be smooth. If you want to pack docker image, the following guide can help you\: @@ -31,4 +31,6 @@ If you want to pack docker image, the following guide can help you\: .. toctree:: :glob: - docker/* + docker_install.md + ubuntu_install.md + diff --git a/doc/build/ubuntu_install.md b/doc/build/ubuntu_install.md new file mode 100644 index 0000000000..c30a8f6db5 --- /dev/null +++ b/doc/build/ubuntu_install.md @@ -0,0 +1,21 @@ +Debian Package installation guide +================================= + +## Debian Package installation +Currently , PaddlePaddle only provides ubuntu14.04 debian packages. +There are two versions package, including CPU and GPU. The download address is: + +https://github.com/baidu/Paddle/releases/tag/V0.8.0b0 + + +After downloading PaddlePaddle deb packages, you can run: + +```bash +dpkg -i paddle-0.8.0b-cpu.deb +apt-get install -f +``` +And if you use GPU version deb package, you need to install CUDA toolkit and cuDNN, and set related environment variables(such as LD_LIBRARY_PATH) first. It is normal when `dpkg -i` get errors. `apt-get install -f` will continue install paddle, and install dependences. + +**Note** + +PaddlePaddle package only supports x86 CPU with AVX instructions. If not, you have to download and build from source code. -- GitLab