You need to use Docker to build PaddlePaddle
to avoid installing dependencies by yourself. We have several pre-built
Docker images here ,
you can also find how to build and use paddle_manylinux_devel Docker image from
here
Or you can build your own image from source as the optional step below:

If you don’t wish to use docker，you need to install several compile dependencies manually as Compile Dependencies shows to start compilation.

If you haven’t heard of it, consider it something like Python’s virtualenv.

Docker or virtual machine?

Some people compare Docker with VMs, but Docker doesn’t virtualize any hardware nor running a guest OS, which means there is no compromise on the performance.

Why Docker?

Using a Docker image of build tools standardizes the building environment, which makes it easier for others to reproduce your problems and to help.

Also, some build tools don’t run on Windows or Mac or BSD, but Docker runs almost everywhere, so developers can use whatever computer they want.

Can I choose not to use Docker?

Sure, you don’t have to install build tools into a Docker image; instead, you can install them on your local computer. This document exists because Docker would make the development way easier.

How difficult is it to learn Docker?

It takes you ten minutes to read an introductory article and saves you more than one hour to install all required build tools, configure them, especially when new versions of PaddlePaddle require some new tools. Not even to mention the time saved when other people trying to reproduce the issue you have.

Can I use my favorite IDE?

Yes, of course. The source code resides on your local computer, and you can edit it using whatever editor you like.

Many PaddlePaddle developers are using Emacs. They add the following few lines into their ~/.emacs configure file:

Our building Docker image runs a Bash script , which calls make -j$(nproc) to starts as many processes as the number of your CPU cores.

Docker requires sudo

An owner of a computer has the administrative privilege, a.k.a., sudo, and Docker requires this privilege to work properly. If you use a shared computer for development, please ask the administrator to install and configure Docker. We will do our best to support rkt, another container technology that doesn’t require sudo.

Docker on Windows/MacOS builds slowly

On Windows and MacOS, Docker containers run in a Linux VM. You might want to give this VM some more memory and CPUs so to make the building efficient. Please refer to this issue for details.

Not enough disk space

Examples in this article use option –rm with the docker run command. This option ensures that stopped containers do not exist on hard disks. We can use docker ps -a to list all containers, including stopped. Sometimes docker build generates some intermediate dangling images, which also take disk space. To clean them, please refer to this article .

You can pass compile options to use intended BLAS/CUDA/Cudnn libraries.
When running cmake command, it will search system paths like
/usr/lib:/usr/local/lib and then search paths that you
passed to cmake, i.e.

cmake .. -DWITH_GPU=ON -DWITH_TESTING=OFF -DCUDNN_ROOT=/opt/cudnnv5

NOTE: These options only take effect when running cmake for the first time, you need to clean the cmake cache or clean the build directory (rm-rf) if you want to change it.