@@ -53,12 +53,20 @@ Docker is simple as long as we understand a few basic concepts:
53
53
Usage of CPU-only and GPU Images
54
54
----------------------------------
55
55
56
- For each version of PaddlePaddle, we release two types of Docker images:
57
- development image and production image. Production image includes
58
- CPU-only version and a CUDA GPU version and their no-AVX versions. We
59
- put the docker images on `dockerhub.com
56
+ We package PaddlePaddle's compile environment into a Docker image,
57
+ called the develop image, it contains all compiling tools that
58
+ PaddlePaddle needs. We package compiled PaddlePaddle program into a
59
+ Docker image as well, called the production image, it contains all
60
+ runtime environment that running PaddlePaddle needs. For each version
61
+ of PaddlePaddle, we release both of them. Production image includes
62
+ CPU-only version and a CUDA GPU version and their no-AVX versions.
63
+
64
+ We put the docker images on `dockerhub.com
60
65
<https://hub.docker.com/r/paddledev/paddle/> `_. You can find the
61
- latest versions under "tags" tab at dockerhub.com
66
+ latest versions under "tags" tab at dockerhub.com. If you are in
67
+ China, you can use our Docker image registry mirror to speed up the
68
+ download process. To use it, please replace all paddlepaddle/paddle in
69
+ the commands to docker.paddlepaddle.org/paddle.
62
70
63
71
1. Production images, this image might have multiple variants:
64
72
@@ -179,59 +187,40 @@ Develop PaddlePaddle or Train Model Using C++ API
179
187
We will be using PaddlePaddle development image since it contains all
180
188
compiling tools and dependencies.
181
189
182
- Let's clone PaddlePaddle repo first:
190
+ 1. Build PaddlePaddle develop image
183
191
184
- .. code-block :: bash
185
-
186
- git clone https://github.com/PaddlePaddle/Paddle.git && cd Paddle
187
-
188
- Mount both workspace folder and paddle code folder into docker
189
- container, so we can access them inside docker container. There are
190
- two ways of using PaddlePaddle development docker image:
191
-
192
- - run interactive bash directly
192
+ Use following command to build PaddlePaddle develop image:
193
193
194
- .. code-block :: bash
195
-
196
- # use nvidia-docker instead of docker if you need to use GPU
197
- docker run -it -v ~ /workspace:/workspace -v $( pwd) :/paddle paddlepaddle/paddle:0.10.0rc2-dev /bin/bash
198
- # now we are inside docker container
194
+ .. code-block :: bash
199
195
200
- - or, we can run it as a daemon container
196
+ git clone https://github.com/PaddlePaddle/Paddle.git && cd Paddle
197
+ docker build -t paddle:dev .
201
198
202
- .. code-block :: bash
199
+ 2. Build PaddlePaddle production image
203
200
204
- # use nvidia-docker instead of docker if you need to use GPU
205
- docker run -d -p 2202:22 -p 8888:8888 -v ~ /workspace:/workspace -v $( pwd) :/paddle paddlepaddle/paddle:0.10.0rc2-dev /usr/sbin/sshd -D
201
+ There are two steps for building production image, the first step is to run:
206
202
207
- and SSH to this container using password :code: `root `:
208
-
209
- .. code-block :: bash
203
+ .. code-block :: bash
210
204
211
- ssh -p 2202 root@localhost
205
+ docker run -v $( pwd ) :/paddle -e " WITH_GPU=OFF " -e " WITH_AVX=OFF " -e " WITH_TEST=ON " paddle:dev
212
206
213
- An advantage is that we can run the PaddlePaddle container on a
214
- remote server and SSH to it from a laptop.
207
+ The above command will compile PaddlePaddle and create a Dockerfile for building production image. All the generated files are in the build directory. "WITH_GPU" controls if the generated production image supports GPU. "WITH_AVX" controls if the generated production image supports AVX. "WITH_TEST" controls if the unit test will be generated.
215
208
216
- When developing PaddlePaddle, you can edit PaddlePaddle source code
217
- from outside of docker container using your favoriate editor. To
218
- compile PaddlePaddle, run inside container:
209
+ The second step is to run:
219
210
220
- .. code-block :: bash
211
+ .. code-block :: bash
221
212
222
- WITH_GPU=OFF WITH_AVX=ON WITH_TEST=ON bash / paddle/paddle/scripts/docker/ build.sh
213
+ docker build -t paddle:prod -f build/Dockerfile .
223
214
224
- This builds everything about Paddle in :code: `/paddle/build `. And we
225
- can run unit tests there:
215
+ The above command will generate the production image by copying the compiled PaddlePaddle program into the image.
226
216
227
- .. code-block :: bash
217
+ 3. Run unit test
228
218
229
- cd /paddle/build
230
- ctest
219
+ Following command will run unit test:
231
220
232
- When training model using C++ API, we can edit paddle program in
233
- ~/workspace outside of docker. And build from /workspace inside of
234
- docker.
221
+ .. code-block :: bash
222
+
223
+ docker run -it -v $( pwd ) :/paddle paddle:dev bash -c " cd /paddle/build && ctest "
235
224
236
225
PaddlePaddle Book
237
226
------------------
0 commit comments