提交 9664322c 编写于 作者: 王益

Update English document

上级 437c98d5
......@@ -16,70 +16,66 @@ Developers can work on PaddlePaddle using Docker. This allows
developers to work on different platforms -- Linux, Mac OS X, and
Windows -- in a consistent way.
The general development workflow with Docker and CMake is as follows:
1. Get the source code of Paddle:
1. Build the Development Environment as a Docker Image
.. code-block:: bash
git clone https://github.com/PaddlePaddle/Paddle.git
git clone --recursive https://github.com/PaddlePaddle/Paddle
cd Paddle
docker build -t paddle:dev -f paddle/scripts/docker/Dockerfile .
2. Build a development Docker image :code:`paddle:dev` from the source
code. This image contains all the development tools and
dependencies of PaddlePaddle.
Note that by default :code:`docker build` wouldn't import source
tree into the image and build it. If we want to do that, we need
to set a build arg:
.. code-block:: bash
cd paddle
docker build -t paddle:dev -f paddle/scripts/docker/Dockerfile .
Sometimes docker build might suffer from a slow network connection to the official Ubuntu apt-source servers. In such case, we can specify an apt-source mirror server that is geologically nearer to us. In the following example, we specified an apt-source server that responds fast in China.You can specify the UBUNTU MIRROR with :code:`--build-arg UBUNTU_MIRROR` like the example below.
docker build -t paddle:dev -f paddle/scripts/docker/Dockerfile --build-arg BUILD_AND_INSTALL=ON .
.. code-block:: bash
docker build \
--build-arg UBUNTU_MIRROR="http://mirrors.163.com" \
-t paddle:dev \
-f paddle/scripts/docker/Dockerfile .
1. Run the Development Environment
3. Run the image as a container and mounting local source code
directory into the container. This allows us to change the code on
the host and build it within the container.
Once we got the image :code:`paddle:dev`, we can use it to develop
Paddle by mounting the local source code tree into a container that
runs the image:
.. code-block:: bash
docker run -d -p 2202:22 -v $PWD:/paddle paddle:dev
This runs a container of the development environment Docker image
with the local source tree mounted to :code:`/paddle` of the
container.
docker run \
-d \
--name paddle \
-p 2022:22 \
-v $PWD:/paddle \
paddle:dev
Note that the default entry-point of :code:`paddle:dev` is
:code:`sshd`, and above :code:`docker run` commands actually starts
an SSHD server listening on port 2202. This allows us to log into
this container with:
where :code:`-d` makes the container running in background,
:code:`--name paddle` allows us to run a nginx container to serve
documents in this container, :code:`-p 2022:22` allows us to SSH
into this container, :code:`-v $PWD:/paddle` shares the source code
on the host with the container.
.. code-block:: bash
ssh root@localhost -p 2202
4. SSH into the container:
Usually, I run above commands on my Mac. I can also run them on a
GPU server :code:`xxx.yyy.zzz.www` and ssh from my Mac to it:
.. code-block:: bash
my-mac$ ssh root@xxx.yyy.zzz.www -p 2202
ssh root@localhost -p 2022
1. Build and Install Using the Development Environment
5. We can edit the source code in the container or on this host. Then
we can build using cmake
Once I am in the container, I can use
:code:`paddle/scripts/docker/build.sh` to build, install, and test
Paddle:
.. code-block:: bash
/paddle/paddle/scripts/docker/build.sh
This builds everything about Paddle in :code:`/paddle/build`. And
we can run unit tests there:
cd /paddle # where paddle source code has been mounted into the container
mkdir -p build
cd build
cmake -DWITH_TESTING=ON ..
make -j `nproc`
CTEST_OUTPUT_ON_FAILURE=1 ctest
.. code-block:: bash
cd /paddle/build
ctest
CPU-only and GPU Images
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册