“6285edbb88412480f81193be4954f70d1cefc717”上不存在“paddle/fluid/framework/block_desc.cc”
docker_install_en.rst 4.5 KB
Newer Older
武毅 已提交
1
Run in Docker Containers
Y
Yi Wang 已提交
2
=================================
3

T
typhoonzero 已提交
4 5 6
Run PaddlePaddle in Docker container so that you don't need to care about
runtime dependencies, also you can run under Windows system. You can get
tutorials at `here <https://docs.docker.com/get-started/>`_ .
7

T
typhoonzero 已提交
8 9 10
If you are using Windows, please refer to
`this <https://docs.docker.com/toolbox/toolbox_install_windows/>`_
tutorial to start running docker under windows.
H
Helin Wang 已提交
11

T
typhoonzero 已提交
12
After you've read above tutorials you may proceed the following steps.
H
Helin Wang 已提交
13

T
typhoonzero 已提交
14
.. _docker_pull:
H
Helin Wang 已提交
15

T
typhoonzero 已提交
16 17
Pull PaddlePaddle Docker Image
------------------------------
H
Helin Wang 已提交
18

T
typhoonzero 已提交
19
Run the following command to download the latest Docker images:
H
Helin Wang 已提交
20 21 22

  .. code-block:: bash

T
typhoonzero 已提交
23
     docker pull paddlepaddle/paddle
H
Helin Wang 已提交
24

T
typhoonzero 已提交
25
For users in China, we provide a faster mirror:
26 27 28

  .. code-block:: bash

T
typhoonzero 已提交
29
     docker pull docker.paddlepaddle.org/paddle
30

T
typhoonzero 已提交
31
Download GPU version images:
H
Helin Wang 已提交
32 33

  .. code-block:: bash
T
typhoonzero 已提交
34

T
typhoonzero 已提交
35 36
     docker pull paddlepaddle/paddle:latest-gpu
     docker pull docker.paddlepaddle.org/paddle:latest-gpu
H
Helin Wang 已提交
37

T
typhoonzero 已提交
38 39 40 41 42 43 44 45 46 47
Choose between different BLAS version:

  .. code-block:: bash

     # image using MKL by default
     docker pull paddlepaddle/paddle
     # image using OpenBLAS
     docker pull paddlepaddle/paddle:latest-openblas


T
typhoonzero 已提交
48 49 50
If you want to use legacy versions, choose a tag from
`DockerHub <https://hub.docker.com/r/paddlepaddle/paddle/tags/>`_
and run:
51

T
typhoonzero 已提交
52
  .. code-block:: bash
T
typhoonzero 已提交
53

T
typhoonzero 已提交
54 55 56
     docker pull paddlepaddle/paddle:[tag]
     # i.e.
     docker pull docker.paddlepaddle.org/paddle:0.10.0-gpu
57

T
typhoonzero 已提交
58
.. _docker_run:
王益 已提交
59

T
typhoonzero 已提交
60 61
Launch your training program in Docker
------------------------------
62

T
typhoonzero 已提交
63
Assume that you have already written a PaddlePaddle program
T
typhoonzero 已提交
64
named :code:`train.py` under directory :code:`/home/work` (refer to 
T
typhoonzero 已提交
65
`PaddlePaddleBook <http://www.paddlepaddle.org/docs/develop/book/01.fit_a_line/index.cn.html>`_ 
T
typhoonzero 已提交
66
for more samples), then run the following command:
67

T
typhoonzero 已提交
68
  .. code-block:: bash
T
typhoonzero 已提交
69 70

     cd /home/work
T
typhoonzero 已提交
71
     docker run -it -v $PWD:/work paddlepaddle/paddle /work/train.py
72

T
typhoonzero 已提交
73 74 75 76 77
In the above command, :code:`-it` means run the container interactively;
:code:`-v $PWD:/work` means mount the current directory ($PWD will expand
to current absolute path in Linux) under :code:`/work` in the container.
:code:`paddlepaddle/paddle` to specify image to use; finnally
:code:`/work/train.py` is the command to run inside docker.
王益 已提交
78

T
typhoonzero 已提交
79 80
Also, you can go into the container shell, run or debug your code
interactively:
王益 已提交
81

T
typhoonzero 已提交
82 83 84 85
  .. code-block:: bash
     docker run -it -v $PWD:/work paddlepaddle/paddle /bin/bash
     cd /work
     python train.py
86

T
typhoonzero 已提交
87
**NOTE: We did not install vim in the default docker image to reduce the image size, you can run** :code:`apt-get install -y vim` **to install it if you need to edit python files.**
王益 已提交
88

T
typhoonzero 已提交
89
.. _docker_run_book:
90

H
Helin Wang 已提交
91 92
PaddlePaddle Book
------------------
93

T
typhoonzero 已提交
94
You can create a container serving PaddlePaddle Book using Jupyter Notebook in
T
typhoonzero 已提交
95 96
one minute using Docker. PaddlePaddle Book is an interactive Jupyter Notebook
for users and developers.If you want to
H
Helin Wang 已提交
97
dig deeper into deep learning, PaddlePaddle Book definitely is your best choice.
王益 已提交
98

H
Helin Wang 已提交
99
We provide a packaged book image, simply issue the command:
100

T
typhoonzero 已提交
101
  .. code-block:: bash
王益 已提交
102

T
typhoonzero 已提交
103
     docker run -p 8888:8888 paddlepaddle/book
王益 已提交
104

H
Helin Wang 已提交
105 106
Then, you would back and paste the address into the local browser:

T
typhoonzero 已提交
107
  .. code-block:: text
H
Helin Wang 已提交
108

T
typhoonzero 已提交
109
     http://localhost:8888/
H
Helin Wang 已提交
110 111

That's all. Enjoy your journey!
112

T
typhoonzero 已提交
113
.. _docker_run_gpu:
114

T
typhoonzero 已提交
115 116
Train with Docker with GPU
------------------------------
117

T
typhoonzero 已提交
118 119 120 121
We recommend using
`nvidia-docker <https://github.com/NVIDIA/nvidia-docker>`_
to run GPU training jobs. Please ensure you have latest
GPU driver installed before move on.
122

T
typhoonzero 已提交
123
  .. code-block:: bash
T
typhoonzero 已提交
124

T
typhoonzero 已提交
125
     nvidia-docker run -it -v $PWD:/work paddledev/paddle:latest-gpu /bin/bash
T
typhoonzero 已提交
126 127

**NOTE: If you don't have nvidia-docker installed, try the following method to mount CUDA libs and devices into the container.**
128

T
typhoonzero 已提交
129
  .. code-block:: bash
130

T
typhoonzero 已提交
131 132 133
     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 paddledev/paddle:latest-gpu
T
typhoonzero 已提交
134

T
typhoonzero 已提交
135
**About AVX:**
136

T
typhoonzero 已提交
137 138 139 140
AVX is a kind of CPU instruction can accelerate PaddlePaddle's calculations.
The latest PaddlePaddle Docker image turns AVX on by default, so, if your
computer doesn't support AVX, you'll probably need to
`build <./build_from_source_en.rst>`_ with :code:`WITH_AVX=OFF`.
141

T
typhoonzero 已提交
142 143 144 145 146
The following command will tell you whether your computer supports AVX.

   .. code-block:: bash

      if cat /proc/cpuinfo | grep -i avx; then echo Yes; else echo No; fi