cmake .. -DWITH_GPU=ON -DWITH_DOC=OFF -DCMAKE_INSTALL_PREFIX=<path to install>
# please use sudo make install, if you want
# to install PaddlePaddle into the system
make -j `nproc` && make install
# set PaddlePaddle installation path in ~/.bashrc
export PATH=<path to install>/bin:$PATH
```
- **Python Dependencies(optional)**
If you want to compile PaddlePaddle with python predict api, you need to add -DWITH_SWIG_PY=ON in cmake command and install these first:
**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
sudo apt-get install swig
# you can run
sudo pip install <path to install>/opt/paddle/share/wheels/*.whl
# or just run
sudo paddle version
```
- **Doc Dependencies(optional)**
## <span id="mac">Building on Mac OS X</span>
If you want to compile PaddlePaddle with doc, you need to add -DWITH_DOC=ON in cmake command and install these first:
### Prerequisites
This guide is based on Mac OS X 10.11 (El Capitan). Note that if you are running an up to date version of OS X,
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.
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:
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).
- **CPU Dependencies**
Here are some examples of cmake command with different options:
<spanid="paddle"></span><spanclass="target"id="paddlenamespacepaddle"></span><emclass="property">namespace </em><codeclass="descname">paddle</code><aclass="headerlink"href="#_CPPv26paddle"title="Permalink to this definition">¶</a></dt>
<spanclass="target"id="paddlenamespacepaddle_1abcad9a84d03d6d95c6f95c2374c507f1"></span><codeclass="descname">__device__ T paddle::paddleAtomicAdd(T * address, T val)</code></dt>
<spanid="paddle::__attribute____paddle::IParameterUpdaterHook"></span><spanclass="target"id="paddlenamespacepaddle_1ae83136be5a20c0fcca6a7858f6cf7b56"></span><emclass="property">class</em><aclass="reference internal"href="../../math/matrix/matrix.html#_CPPv26paddle"title="paddle">paddle</a>::<aclass="reference internal"href="#_CPPv2N6paddle21IParameterUpdaterHookE"title="paddle::IParameterUpdaterHook">IParameterUpdaterHook</a><codeclass="descname">__attribute__</code><aclass="headerlink"href="#_CPPv2N6paddle13__attribute__E"title="Permalink to this definition">¶</a></dt>
<spanid="paddle::__attribute____paddle::IParameterUpdaterHook"></span><spanclass="target"id="paddlenamespacepaddle_1ae83136be5a20c0fcca6a7858f6cf7b56"></span><emclass="property">class</em><aclass="reference internal"href="../../cuda/rnn/rnn.html#_CPPv26paddle"title="paddle">paddle</a>::<aclass="reference internal"href="#_CPPv2N6paddle21IParameterUpdaterHookE"title="paddle::IParameterUpdaterHook">IParameterUpdaterHook</a><codeclass="descname">__attribute__</code><aclass="headerlink"href="#_CPPv2N6paddle13__attribute__E"title="Permalink to this definition">¶</a></dt>
<spanid="paddle::SpinLock"></span><spanclass="target"id="paddleclasspaddle_1_1SpinLock"></span><emclass="property">class </em><codeclass="descclassname">paddle::</code><codeclass="descname">SpinLock</code><aclass="headerlink"href="#_CPPv2N6paddle8SpinLockE"title="Permalink to this definition">¶</a></dt>
<dd><p>A simple wrapper for spin lock. The lock() method of <aclass="reference internal"href="#paddleclasspaddle_1_1SpinLock"><spanclass="std std-ref">SpinLock</span></a> is busy-waiting which means it will keep trying to lock until lock on successfully. The <aclass="reference internal"href="#paddleclasspaddle_1_1SpinLock"><spanclass="std std-ref">SpinLock</span></a> disable copy. </p>
<spanid="paddle::SpinLock::DISABLE_COPY__SpinLock"></span><spanclass="target"id="paddleclasspaddle_1_1SpinLock_1abb87cdb52fc8a8cc9576e2e220809085"></span><codeclass="descname">DISABLE_COPY</code><spanclass="sig-paren">(</span><aclass="reference internal"href="#_CPPv2N6paddle8SpinLockE"title="paddle::SpinLock">SpinLock</a><spanclass="sig-paren">)</span><aclass="headerlink"href="#_CPPv2N6paddle8SpinLock12DISABLE_COPYE8SpinLock"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="function">
<dtid="_CPPv2N6paddle8SpinLock8SpinLockEv">
<spanid="paddle::SpinLock::SpinLock"></span><spanclass="target"id="paddleclasspaddle_1_1SpinLock_1ae4b8664661115cae5d7a9f5c1e4cd4ed"></span><codeclass="descname">SpinLock</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#_CPPv2N6paddle8SpinLock8SpinLockEv"title="Permalink to this definition">¶</a></dt>
...
...
@@ -196,16 +200,6 @@ var _hmt = _hmt || [];
<spanid="paddle::SpinLock::~SpinLock"></span><spanclass="target"id="paddleclasspaddle_1_1SpinLock_1a12800af3f93511270eceba996f2e1233"></span><codeclass="descname">~SpinLock</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#_CPPv2N6paddle8SpinLockD0Ev"title="Permalink to this definition">¶</a></dt>
<spanid="paddle::SpinLock::SpinLock__SpinLockCR"></span><spanclass="target"id="paddleclasspaddle_1_1SpinLock_1a055efdc5fa3c87bf9c5efa19ca91fceb"></span><codeclass="descname">SpinLock</code><spanclass="sig-paren">(</span><emclass="property">const</em><aclass="reference internal"href="#_CPPv2N6paddle8SpinLock8SpinLockEv"title="paddle::SpinLock::SpinLock">SpinLock</a>&<spanclass="sig-paren">)</span><aclass="headerlink"href="#_CPPv2N6paddle8SpinLock8SpinLockERK8SpinLock"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="function">
<dtid="_CPPv2N6paddle8SpinLockaSERK8SpinLock">
<spanid="paddle::SpinLock::assign-operator__SpinLockCR"></span><spanclass="target"id="paddleclasspaddle_1_1SpinLock_1a65860c4525eafaf6c50f67bb7e6f1217"></span><aclass="reference internal"href="#_CPPv2N6paddle8SpinLockE"title="paddle::SpinLock">SpinLock</a>&<codeclass="descname">operator=</code><spanclass="sig-paren">(</span><emclass="property">const</em><aclass="reference internal"href="#_CPPv2N6paddle8SpinLockE"title="paddle::SpinLock">SpinLock</a>&<spanclass="sig-paren">)</span><aclass="headerlink"href="#_CPPv2N6paddle8SpinLockaSERK8SpinLock"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="function">
<dtid="_CPPv2N6paddle8SpinLock4lockEv">
<spanid="paddle::SpinLock::lock"></span><spanclass="target"id="paddleclasspaddle_1_1SpinLock_1ae5b78520a7808c9eee28674fa2dc1196"></span>void <codeclass="descname">lock</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#_CPPv2N6paddle8SpinLock4lockEv"title="Permalink to this definition">¶</a></dt>
...
...
@@ -216,19 +210,6 @@ var _hmt = _hmt || [];
<spanid="paddle::SpinLock::unlock"></span><spanclass="target"id="paddleclasspaddle_1_1SpinLock_1a14f55be9684bed14427537571e7b6f7a"></span>void <codeclass="descname">unlock</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#_CPPv2N6paddle8SpinLock6unlockEv"title="Permalink to this definition">¶</a></dt>
<spanid="paddle::SpinLock::lock___pthread_spinlock_t"></span><spanclass="target"id="paddleclasspaddle_1_1SpinLock_1a262929588dcc81d1740094988782f57e"></span>pthread_spinlock_t <codeclass="descname">lock_</code><aclass="headerlink"href="#_CPPv2N6paddle8SpinLock5lock_E"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="member">
<dtid="_CPPv2N6paddle8SpinLock8padding_E">
<spanid="paddle::SpinLock::padding___cA"></span><spanclass="target"id="paddleclasspaddle_1_1SpinLock_1a8c0dd8c3d3959525ecb169db292382ec"></span>char <codeclass="descname">padding_</code>[64-sizeof(pthread_spinlock_t)]<aclass="headerlink"href="#_CPPv2N6paddle8SpinLock8padding_E"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</div>
</dd></dl>
...
...
@@ -238,9 +219,25 @@ var _hmt = _hmt || [];
<dlclass="class">
<dtid="_CPPv2N6paddle9SemaphoreE">
<spanid="paddle::Semaphore"></span><spanclass="target"id="paddleclasspaddle_1_1Semaphore"></span><emclass="property">class </em><codeclass="descclassname">paddle::</code><codeclass="descname">Semaphore</code><aclass="headerlink"href="#_CPPv2N6paddle9SemaphoreE"title="Permalink to this definition">¶</a></dt>
<dd><p>A simple wapper of semaphore which can only be shared in the same process. </p>
<spanid="paddle::Semaphore::Semaphore__SemaphoreCR"></span><spanclass="target"id="paddleclasspaddle_1_1Semaphore_1a6d471a25979a5d8c85f3649576a01284"></span><codeclass="descname">Semaphore</code><spanclass="sig-paren">(</span><emclass="property">const</em><aclass="reference internal"href="#_CPPv2N6paddle9Semaphore9SemaphoreERK9Semaphore"title="paddle::Semaphore::Semaphore">Semaphore</a>&<em>other</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#_CPPv2N6paddle9Semaphore9SemaphoreERK9Semaphore"title="Permalink to this definition">¶</a></dt>
<dd><p>Disable copy & assign. </p>
</dd></dl>
<dlclass="function">
<dtid="_CPPv2N6paddle9SemaphoreaSERRK9Semaphore">
<spanid="paddle::Semaphore::assign-operator__SemaphoreCRR"></span><spanclass="target"id="paddleclasspaddle_1_1Semaphore_1a9072e5b688450318d9c55437b5593f46"></span><aclass="reference internal"href="#_CPPv2N6paddle9SemaphoreE"title="paddle::Semaphore">Semaphore</a>&<codeclass="descname">operator=</code><spanclass="sig-paren">(</span><emclass="property">const</em><aclass="reference internal"href="#_CPPv2N6paddle9SemaphoreE"title="paddle::Semaphore">Semaphore</a>&&<em>other</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#_CPPv2N6paddle9SemaphoreaSERRK9Semaphore"title="Permalink to this definition">¶</a></dt>
<spanid="paddle::Semaphore::Semaphore__SemaphoreRR"></span><spanclass="target"id="paddleclasspaddle_1_1Semaphore_1a0a3cacfa683029887de7a865a6956b72"></span><codeclass="descname">Semaphore</code><spanclass="sig-paren">(</span><aclass="reference internal"href="#_CPPv2N6paddle9Semaphore9SemaphoreERK9Semaphore"title="paddle::Semaphore::Semaphore">Semaphore</a>&&<em>other</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#_CPPv2N6paddle9Semaphore9SemaphoreERR9Semaphore"title="Permalink to this definition">¶</a></dt>
<dd><p>Enable move. </p>
</dd></dl>
<dlclass="function">
<dtid="_CPPv2N6paddle9Semaphore9SemaphoreEi">
<spanid="paddle::Semaphore::Semaphore__i"></span><spanclass="target"id="paddleclasspaddle_1_1Semaphore_1a4884c28f1f853a0467b70e7f33547670"></span><codeclass="descname">Semaphore</code><spanclass="sig-paren">(</span>int <em>initValue</em> = 0<spanclass="sig-paren">)</span><aclass="headerlink"href="#_CPPv2N6paddle9Semaphore9SemaphoreEi"title="Permalink to this definition">¶</a></dt>
...
...
@@ -290,14 +287,6 @@ var _hmt = _hmt || [];
<dd><p>increment the semaphore. If the semaphore’s value greater than 0, wake up a thread blocked in <aclass="reference internal"href="#paddleclasspaddle_1_1Semaphore_1a3d7d3699ad8f49ad8bbad260a174c28d"><spanclass="std std-ref">wait()</span></a>. </p>
<spanid="paddle::Semaphore::sem___sem_t"></span><spanclass="target"id="paddleclasspaddle_1_1Semaphore_1ab66cee48c4a02d13b4ef56cf2538ee42"></span>sem_t <codeclass="descname">sem_</code><aclass="headerlink"href="#_CPPv2N6paddle9Semaphore4sem_E"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</div>
</dd></dl>
...
...
@@ -307,9 +296,13 @@ var _hmt = _hmt || [];
<dlclass="class">
<dtid="_CPPv2N6paddle13ThreadBarrierE">
<spanid="paddle::ThreadBarrier"></span><spanclass="target"id="paddleclasspaddle_1_1ThreadBarrier"></span><emclass="property">class </em><codeclass="descclassname">paddle::</code><codeclass="descname">ThreadBarrier</code><aclass="headerlink"href="#_CPPv2N6paddle13ThreadBarrierE"title="Permalink to this definition">¶</a></dt>
<dd><p>A simple wrapper of thread barrier. The <aclass="reference internal"href="#paddleclasspaddle_1_1ThreadBarrier"><spanclass="std std-ref">ThreadBarrier</span></a> disable copy. </p>
<spanid="paddle::ThreadBarrier::DISABLE_COPY__ThreadBarrier"></span><spanclass="target"id="paddleclasspaddle_1_1ThreadBarrier_1ace6a9d5cf27b395ce3c478b3cbfd1f17"></span><codeclass="descname">DISABLE_COPY</code><spanclass="sig-paren">(</span><aclass="reference internal"href="#_CPPv2N6paddle13ThreadBarrierE"title="paddle::ThreadBarrier">ThreadBarrier</a><spanclass="sig-paren">)</span><aclass="headerlink"href="#_CPPv2N6paddle13ThreadBarrier12DISABLE_COPYE13ThreadBarrier"title="Permalink to this definition">¶</a></dt>
<spanid="paddle::ThreadBarrier::ThreadBarrier__i"></span><spanclass="target"id="paddleclasspaddle_1_1ThreadBarrier_1a2b4ee1af9857ce417455d6a343a1a117"></span><codeclass="descname">ThreadBarrier</code><spanclass="sig-paren">(</span>int <em>count</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#_CPPv2N6paddle13ThreadBarrier13ThreadBarrierEi"title="Permalink to this definition">¶</a></dt>
...
...
@@ -321,30 +314,12 @@ var _hmt = _hmt || [];
<spanid="paddle::ThreadBarrier::~ThreadBarrier"></span><spanclass="target"id="paddleclasspaddle_1_1ThreadBarrier_1a0922960555e03da24426cf8fdd0b15dd"></span><codeclass="descname">~ThreadBarrier</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#_CPPv2N6paddle13ThreadBarrierD0Ev"title="Permalink to this definition">¶</a></dt>
<spanid="paddle::ThreadBarrier::ThreadBarrier__ThreadBarrierCR"></span><spanclass="target"id="paddleclasspaddle_1_1ThreadBarrier_1a42b7d18074508549f5e53156d8791fd8"></span><codeclass="descname">ThreadBarrier</code><spanclass="sig-paren">(</span><emclass="property">const</em><aclass="reference internal"href="#_CPPv2N6paddle13ThreadBarrier13ThreadBarrierEi"title="paddle::ThreadBarrier::ThreadBarrier">ThreadBarrier</a>&<spanclass="sig-paren">)</span><aclass="headerlink"href="#_CPPv2N6paddle13ThreadBarrier13ThreadBarrierERK13ThreadBarrier"title="Permalink to this definition">¶</a></dt>
<spanid="paddle::ThreadBarrier::assign-operator__ThreadBarrierCR"></span><spanclass="target"id="paddleclasspaddle_1_1ThreadBarrier_1a84b0ef2c24d0ee7770fa453d385f5bdf"></span><aclass="reference internal"href="#_CPPv2N6paddle13ThreadBarrierE"title="paddle::ThreadBarrier">ThreadBarrier</a>&<codeclass="descname">operator=</code><spanclass="sig-paren">(</span><emclass="property">const</em><aclass="reference internal"href="#_CPPv2N6paddle13ThreadBarrierE"title="paddle::ThreadBarrier">ThreadBarrier</a>&<spanclass="sig-paren">)</span><aclass="headerlink"href="#_CPPv2N6paddle13ThreadBarrieraSERK13ThreadBarrier"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="function">
<dtid="_CPPv2N6paddle13ThreadBarrier4waitEv">
<spanid="paddle::ThreadBarrier::wait"></span><spanclass="target"id="paddleclasspaddle_1_1ThreadBarrier_1af63f9491d2644a258350e12120fedf89"></span>void <codeclass="descname">wait</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#_CPPv2N6paddle13ThreadBarrier4waitEv"title="Permalink to this definition">¶</a></dt>
<dd><p>If there were count - 1 threads waiting before, then wake up all the count - 1 threads and continue run together. Else block the thread until waked by other thread . </p>
<spanid="paddle::ThreadBarrier::barrier___pthread_barrier_t"></span><spanclass="target"id="paddleclasspaddle_1_1ThreadBarrier_1ae29548e35c5a20906647e8dcc48f9f39"></span>pthread_barrier_t <codeclass="descname">barrier_</code><aclass="headerlink"href="#_CPPv2N6paddle13ThreadBarrier8barrier_E"title="Permalink to this definition">¶</a></dt>