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

Update English document

上级 437c98d5
...@@ -16,70 +16,66 @@ Developers can work on PaddlePaddle using Docker. This allows ...@@ -16,70 +16,66 @@ Developers can work on PaddlePaddle using Docker. This allows
developers to work on different platforms -- Linux, Mac OS X, and developers to work on different platforms -- Linux, Mac OS X, and
Windows -- in a consistent way. Windows -- in a consistent way.
The general development workflow with Docker and CMake is as follows: 1. Build the Development Environment as a Docker Image
1. Get the source code of Paddle:
.. code-block:: bash .. 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 Note that by default :code:`docker build` wouldn't import source
code. This image contains all the development tools and tree into the image and build it. If we want to do that, we need
dependencies of PaddlePaddle. to set a build arg:
.. code-block:: bash .. code-block:: bash
cd paddle docker build -t paddle:dev -f paddle/scripts/docker/Dockerfile --build-arg BUILD_AND_INSTALL=ON .
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.
.. 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 Once we got the image :code:`paddle:dev`, we can use it to develop
directory into the container. This allows us to change the code on Paddle by mounting the local source code tree into a container that
the host and build it within the container. runs the image:
.. code-block:: bash .. code-block:: bash
docker run -d -p 2202:22 -v $PWD:/paddle paddle:dev
docker run \ This runs a container of the development environment Docker image
-d \ with the local source tree mounted to :code:`/paddle` of the
--name paddle \ container.
-p 2022:22 \
-v $PWD:/paddle \
paddle:dev
where :code:`-d` makes the container running in background, Note that the default entry-point of :code:`paddle:dev` is
:code:`--name paddle` allows us to run a nginx container to serve :code:`sshd`, and above :code:`docker run` commands actually starts
documents in this container, :code:`-p 2022:22` allows us to SSH an SSHD server listening on port 2202. This allows us to log into
into this container, :code:`-v $PWD:/paddle` shares the source code this container with:
on the host with the container.
4. SSH into the container: .. code-block:: bash
ssh root@localhost -p 2202
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 .. 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 Once I am in the container, I can use
we can build using cmake :code:`paddle/scripts/docker/build.sh` to build, install, and test
Paddle:
.. code-block:: bash .. code-block:: bash
/paddle/paddle/scripts/docker/build.sh
cd /paddle # where paddle source code has been mounted into the container This builds everything about Paddle in :code:`/paddle/build`. And
mkdir -p build we can run unit tests there:
cd build
cmake -DWITH_TESTING=ON .. .. code-block:: bash
make -j `nproc` cd /paddle/build
CTEST_OUTPUT_ON_FAILURE=1 ctest ctest
CPU-only and GPU Images CPU-only and GPU Images
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册