CMake will find dependent libraries in system default paths first. After installing some optional libraries, corresponding build option will automatically be on(such as glog, gtest and gflags). And if libraries are not found, you have to set following variables manually in cmake command(CUDNN_ROOT, ATLAS_ROOT, MKL_ROOT, OPENBLAS_ROOT).
As usual, the best option is to create build folder under paddle project directory.
Here are some examples of cmake command with different options:
**only cpu**
```bash
```bash
cmake -DWITH_GPU=OFF -DWITH_DOC=OFF
mkdir build &&cd build
cmake ..
```
```
**gpu**
CMake first check PaddlePaddle's dependecies in system default path. After installing some optional
libraries, corresponding build option will be set automatically (for instance, glog, gtest and gflags).
If still not found, you can manually set it based on CMake error information from your screen.
cmake -DWITH_GPU=ON -DWITH_DOC=OFF -DCMAKE_INSTALL_PREFIX=<path to install> ..
cmake .. -DWITH_GPU=ON -DWITH_DOC=OFF -DCMAKE_INSTALL_PREFIX=<path to install>
# please use sudo make install, if you want
# please use sudo make install, if you want
# to install PaddlePaddle into the system
# to install PaddlePaddle into the system
make -j`nproc`&& make install
make -j`nproc`&& make install
# PaddlePaddle installation path
# set PaddlePaddle installation path in ~/.bashrc
export PATH=<path to install>/bin:$PATH
export PATH=<path to install>/bin:$PATH
```
```
**Note**
And if you set WITH_SWIG_PY=ON, you have to install related python predict api at the same time:
**Note:**
If you set `WITH_SWIG_PY=ON`, related python dependencies also need to be installed.
Otherwise, PaddlePaddle will automatically install python dependencies
at first time when user run paddle commands, such as `paddle version`, `paddle train`.
It may require sudo privileges:
```bash
```bash
pip install <path to install>/opt/paddle/share/wheels/*.whl
# you can run
sudo pip install <path to install>/opt/paddle/share/wheels/*.whl
# or just run
sudo paddle version
```
```
## <span id="mac">Building on Mac OS X</span>
## <span id="mac">Building on Mac OS X</span>
### Prerequisites
### Prerequisites
...
@@ -150,7 +191,7 @@ This guide is based on Mac OS X 10.11 (El Capitan). Note that if you are running
...
@@ -150,7 +191,7 @@ This guide is based on Mac OS X 10.11 (El Capitan). Note that if you are running
you will already have Python 2.7.10 and Numpy 1.8 installed.
you will already have Python 2.7.10 and Numpy 1.8 installed.
The best option is to use the package manager homebrew to handle installations and upgrades for you.
The best option is to use the package manager homebrew to handle installations and upgrades for you.
To install homebrew, first open a terminal window (you can find Terminal in the Utilities folder in Applications), and issue the command:
To install [homebrew](http://brew.sh/), first open a terminal window (you can find Terminal in the Utilities folder in Applications), and issue the command: