Modified: incubator/singa/site/trunk/en/docs/cnn.html URL: http://svn.apache.org/viewvc/incubator/singa/site/trunk/en/docs/cnn.html?rev=1784386&r1=1784385&r2=1784386&view=diff ============================================================================== --- incubator/singa/site/trunk/en/docs/cnn.html (original) +++ incubator/singa/site/trunk/en/docs/cnn.html Sat Feb 25 15:30:33 2017 @@ -31,6 +31,9 @@ + <link rel="index" title="Index" + href="../genindex.html"/> + <link rel="search" title="Search" href="../search.html"/> <link rel="top" title="incubator-singa 1.1.0 documentation" href="../index.html"/> <link href="../_static/style.css" rel="stylesheet" type="text/css"> @@ -150,7 +153,7 @@ Convolution neural network (CNN) is a ty <span id="running-instructions-for-cpp-version"></span><h1>Running instructions for CPP version<a class="headerlink" href="#running-instructions-for-cpp-version" title="Permalink to this headline">¶</a></h1> <p>Please refer to <a class="reference external" href="installation.html">Installation</a> page for how to install SINGA. Currently, we CNN requires CUDNN, hence both CUDA and CUDNN should be installed and SINGA should be compiled with CUDA and CUDNN.</p> <p>The Cifar10 dataset could be downloaded by running</p> -<div class="highlight-python"><div class="highlight"><pre># switch to cifar10 directory +<div class="highlight-default"><div class="highlight"><pre><span></span># switch to cifar10 directory $ cd ../examples/cifar10 # download data for CPP version $ python download_data.py bin @@ -158,56 +161,56 @@ $ python download_data.py bin </div> <p>‘bin’ is for downloading binary version of Cifar10 data.</p> <p>During downloading, you should see the detailed output like</p> -<div class="highlight-python"><div class="highlight"><pre> Downloading CIFAR10 from http://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz +<div class="highlight-default"><div class="highlight"><pre><span></span> Downloading CIFAR10 from http://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz The tar file does exist. Extracting it now.. Finished! </pre></div> </div> <p>Now you have prepared the data for this Cifar10 example, the final step is to execute the <code class="docutils literal"><span class="pre">run.sh</span></code> script,</p> -<div class="highlight-python"><div class="highlight"><pre># in SINGA_ROOT/examples/cifar10/ +<div class="highlight-default"><div class="highlight"><pre><span></span># in SINGA_ROOT/examples/cifar10/ $ ./run.sh </pre></div> </div> <p>You should see the detailed output as follows: first read the data files in order, show the statistics of training and testing data, then show the details of neural net structure with some parameter information, finally illustrate the performance details during training and validation process. The number of epochs can be specified in <code class="docutils literal"><span class="pre">run.sh</span></code> file.</p> -<div class="highlight-python"><div class="highlight"><pre>Start training -Reading file cifar-10-batches-bin/data_batch_1.bin -Reading file cifar-10-batches-bin/data_batch_2.bin -Reading file cifar-10-batches-bin/data_batch_3.bin -Reading file cifar-10-batches-bin/data_batch_4.bin -Reading file cifar-10-batches-bin/data_batch_5.bin -Reading file cifar-10-batches-bin/test_batch.bin -Training samples = 50000, Test samples = 10000 -conv1(32, 32, 32, ) -pool1(32, 16, 16, ) -relu1(32, 16, 16, ) -lrn1(32, 16, 16, ) -conv2(32, 16, 16, ) -relu2(32, 16, 16, ) -pool2(32, 8, 8, ) -lrn2(32, 8, 8, ) -conv3(64, 8, 8, ) -relu3(64, 8, 8, ) -pool3(64, 4, 4, ) -flat(1024, ) -ip(10, ) -conv1_weight : 8.09309e-05 -conv1_bias : 0 -conv2_weight : 0.00797731 -conv2_bias : 0 -conv3_weight : 0.00795888 -conv3_bias : 0 -ip_weight : 0.00798683 -ip_bias : 0 -Messages will be appended to an existed file: train_perf -Messages will be appended to an existed file: val_perf -Epoch 0, training loss = 1.828369, accuracy = 0.329420, lr = 0.001000 -Epoch 0, val loss = 1.561823, metric = 0.420600 -Epoch 1, training loss = 1.465898, accuracy = 0.469940, lr = 0.001000 -Epoch 1, val loss = 1.361778, metric = 0.513300 -Epoch 2, training loss = 1.320708, accuracy = 0.529000, lr = 0.001000 -Epoch 2, val loss = 1.242080, metric = 0.549100 -Epoch 3, training loss = 1.213776, accuracy = 0.571620, lr = 0.001000 -Epoch 3, val loss = 1.175346, metric = 0.582000 +<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">Start</span> <span class="n">training</span> +<span class="n">Reading</span> <span class="n">file</span> <span class="n">cifar</span><span class="o">-</span><span class="mi">10</span><span class="o">-</span><span class="n">batches</span><span class="o">-</span><span class="nb">bin</span><span class="o">/</span><span class="n">data_batch_1</span><span class="o">.</span><span class="n">bin</span> +<span class="n">Reading</span> <span class="n">file</span> <span class="n">cifar</span><span class="o">-</span><span class="mi">10</span><span class="o">-</span><span class="n">batches</span><span class="o">-</span><span class="nb">bin</span><span class="o">/</span><span class="n">data_batch_2</span><span class="o">.</span><span class="n">bin</span> +<span class="n">Reading</span> <span class="n">file</span> <span class="n">cifar</span><span class="o">-</span><span class="mi">10</span><span class="o">-</span><span class="n">batches</span><span class="o">-</span><span class="nb">bin</span><span class="o">/</span><span class="n">data_batch_3</span><span class="o">.</span><span class="n">bin</span> +<span class="n">Reading</span> <span class="n">file</span> <span class="n">cifar</span><span class="o">-</span><span class="mi">10</span><span class="o">-</span><span class="n">batches</span><span class="o">-</span><span class="nb">bin</span><span class="o">/</span><span class="n">data_batch_4</span><span class="o">.</span><span class="n">bin</span> +<span class="n">Reading</span> <span class="n">file</span> <span class="n">cifar</span><span class="o">-</span><span class="mi">10</span><span class="o">-</span><span class="n">batches</span><span class="o">-</span><span class="nb">bin</span><span class="o">/</span><span class="n">data_batch_5</span><span class="o">.</span><span class="n">bin</span> +<span class="n">Reading</span> <span class="n">file</span> <span class="n">cifar</span><span class="o">-</span><span class="mi">10</span><span class="o">-</span><span class="n">batches</span><span class="o">-</span><span class="nb">bin</span><span class="o">/</span><span class="n">test_batch</span><span class="o">.</span><span class="n">bin</span> +<span class="n">Training</span> <span class="n">samples</span> <span class="o">=</span> <span class="mi">50000</span><span class="p">,</span> <span class="n">Test</span> <span class="n">samples</span> <span class="o">=</span> <span class="mi">10000</span> +<span class="n">conv1</span><span class="p">(</span><span class="mi">32</span><span class="p">,</span> <span class="mi">32</span><span class="p">,</span> <span class="mi">32</span><span class="p">,</span> <span class="p">)</span> +<span class="n">pool1</span><span class="p">(</span><span class="mi">32</span><span class="p">,</span> <span class="mi">16</span><span class="p">,</span> <span class="mi">16</span><span class="p">,</span> <span class="p">)</span> +<span class="n">relu1</span><span class="p">(</span><span class="mi">32</span><span class="p">,</span> <span class="mi">16</span><span class="p">,</span> <span class="mi">16</span><span class="p">,</span> <span class="p">)</span> +<span class="n">lrn1</span><span class="p">(</span><span class="mi">32</span><span class="p">,</span> <span class="mi">16</span><span class="p">,</span> <span class="mi">16</span><span class="p">,</span> <span class="p">)</span> +<span class="n">conv2</span><span class="p">(</span><span class="mi">32</span><span class="p">,</span> <span class="mi">16</span><span class="p">,</span> <span class="mi">16</span><span class="p">,</span> <span class="p">)</span> +<span class="n">relu2</span><span class="p">(</span><span class="mi">32</span><span class="p">,</span> <span class="mi">16</span><span class="p">,</span> <span class="mi">16</span><span class="p">,</span> <span class="p">)</span> +<span class="n">pool2</span><span class="p">(</span><span class="mi">32</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="p">)</span> +<span class="n">lrn2</span><span class="p">(</span><span class="mi">32</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="p">)</span> +<span class="n">conv3</span><span class="p">(</span><span class="mi">64</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="p">)</span> +<span class="n">relu3</span><span class="p">(</span><span class="mi">64</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="p">)</span> +<span class="n">pool3</span><span class="p">(</span><span class="mi">64</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="p">)</span> +<span class="n">flat</span><span class="p">(</span><span class="mi">1024</span><span class="p">,</span> <span class="p">)</span> +<span class="n">ip</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="p">)</span> +<span class="n">conv1_weight</span> <span class="p">:</span> <span class="mf">8.09309e-05</span> +<span class="n">conv1_bias</span> <span class="p">:</span> <span class="mi">0</span> +<span class="n">conv2_weight</span> <span class="p">:</span> <span class="mf">0.00797731</span> +<span class="n">conv2_bias</span> <span class="p">:</span> <span class="mi">0</span> +<span class="n">conv3_weight</span> <span class="p">:</span> <span class="mf">0.00795888</span> +<span class="n">conv3_bias</span> <span class="p">:</span> <span class="mi">0</span> +<span class="n">ip_weight</span> <span class="p">:</span> <span class="mf">0.00798683</span> +<span class="n">ip_bias</span> <span class="p">:</span> <span class="mi">0</span> +<span class="n">Messages</span> <span class="n">will</span> <span class="n">be</span> <span class="n">appended</span> <span class="n">to</span> <span class="n">an</span> <span class="n">existed</span> <span class="n">file</span><span class="p">:</span> <span class="n">train_perf</span> +<span class="n">Messages</span> <span class="n">will</span> <span class="n">be</span> <span class="n">appended</span> <span class="n">to</span> <span class="n">an</span> <span class="n">existed</span> <span class="n">file</span><span class="p">:</span> <span class="n">val_perf</span> +<span class="n">Epoch</span> <span class="mi">0</span><span class="p">,</span> <span class="n">training</span> <span class="n">loss</span> <span class="o">=</span> <span class="mf">1.828369</span><span class="p">,</span> <span class="n">accuracy</span> <span class="o">=</span> <span class="mf">0.329420</span><span class="p">,</span> <span class="n">lr</span> <span class="o">=</span> <span class="mf">0.001000</span> +<span class="n">Epoch</span> <span class="mi">0</span><span class="p">,</span> <span class="n">val</span> <span class="n">loss</span> <span class="o">=</span> <span class="mf">1.561823</span><span class="p">,</span> <span class="n">metric</span> <span class="o">=</span> <span class="mf">0.420600</span> +<span class="n">Epoch</span> <span class="mi">1</span><span class="p">,</span> <span class="n">training</span> <span class="n">loss</span> <span class="o">=</span> <span class="mf">1.465898</span><span class="p">,</span> <span class="n">accuracy</span> <span class="o">=</span> <span class="mf">0.469940</span><span class="p">,</span> <span class="n">lr</span> <span class="o">=</span> <span class="mf">0.001000</span> +<span class="n">Epoch</span> <span class="mi">1</span><span class="p">,</span> <span class="n">val</span> <span class="n">loss</span> <span class="o">=</span> <span class="mf">1.361778</span><span class="p">,</span> <span class="n">metric</span> <span class="o">=</span> <span class="mf">0.513300</span> +<span class="n">Epoch</span> <span class="mi">2</span><span class="p">,</span> <span class="n">training</span> <span class="n">loss</span> <span class="o">=</span> <span class="mf">1.320708</span><span class="p">,</span> <span class="n">accuracy</span> <span class="o">=</span> <span class="mf">0.529000</span><span class="p">,</span> <span class="n">lr</span> <span class="o">=</span> <span class="mf">0.001000</span> +<span class="n">Epoch</span> <span class="mi">2</span><span class="p">,</span> <span class="n">val</span> <span class="n">loss</span> <span class="o">=</span> <span class="mf">1.242080</span><span class="p">,</span> <span class="n">metric</span> <span class="o">=</span> <span class="mf">0.549100</span> +<span class="n">Epoch</span> <span class="mi">3</span><span class="p">,</span> <span class="n">training</span> <span class="n">loss</span> <span class="o">=</span> <span class="mf">1.213776</span><span class="p">,</span> <span class="n">accuracy</span> <span class="o">=</span> <span class="mf">0.571620</span><span class="p">,</span> <span class="n">lr</span> <span class="o">=</span> <span class="mf">0.001000</span> +<span class="n">Epoch</span> <span class="mi">3</span><span class="p">,</span> <span class="n">val</span> <span class="n">loss</span> <span class="o">=</span> <span class="mf">1.175346</span><span class="p">,</span> <span class="n">metric</span> <span class="o">=</span> <span class="mf">0.582000</span> </pre></div> </div> <p>The training details are stored in <code class="docutils literal"><span class="pre">train_perf</span></code> file in the same directory and the validation details in <code class="docutils literal"><span class="pre">val_perf</span></code> file.</p> @@ -215,73 +218,73 @@ Epoch 3, val loss = 1.175346, metric = 0 <div class="section" id="running-instructions-for-python-version"> <span id="running-instructions-for-python-version"></span><h1>Running instructions for Python version<a class="headerlink" href="#running-instructions-for-python-version" title="Permalink to this headline">¶</a></h1> <p>To run CNN example in Python version, we need to compile SINGA with Python binding,</p> -<div class="highlight-python"><div class="highlight"><pre>$ mkdir build && cd build +<div class="highlight-default"><div class="highlight"><pre><span></span>$ mkdir build && cd build $ cmake -DUSE_PYTHON=ON .. $ make </pre></div> </div> <p>Now download the Cifar10 dataset,</p> -<div class="highlight-python"><div class="highlight"><pre># switch to cifar10 directory +<div class="highlight-default"><div class="highlight"><pre><span></span># switch to cifar10 directory $ cd ../examples/cifar10 # download data for Python version $ python download_data.py py </pre></div> </div> <p>During downloading, you should see the detailed output like</p> -<div class="highlight-python"><div class="highlight"><pre> Downloading CIFAR10 from http://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz +<div class="highlight-default"><div class="highlight"><pre><span></span> Downloading CIFAR10 from http://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz The tar file does exist. Extracting it now.. Finished! </pre></div> </div> <p>Then execute the <code class="docutils literal"><span class="pre">train.py</span></code> script to build the model</p> -<div class="highlight-python"><div class="highlight"><pre>$ python train.py +<div class="highlight-default"><div class="highlight"><pre><span></span>$ python train.py </pre></div> </div> <p>You should see the output as follows including the details of neural net structure with some parameter information, reading data files, and the performance details during training and testing process.</p> -<div class="highlight-python"><div class="highlight"><pre>(32L, 32L, 32L) -(32L, 16L, 16L) -(32L, 16L, 16L) -(32L, 16L, 16L) -(32L, 16L, 16L) -(32L, 16L, 16L) -(32L, 8L, 8L) -(32L, 8L, 8L) -(64L, 8L, 8L) -(64L, 8L, 8L) -(64L, 4L, 4L) -(1024L,) -Start intialization............ -conv1_weight gaussian 7.938460476e-05 -conv1_bias constant 0.0 -conv2_weight gaussian 0.00793507322669 -conv2_bias constant 0.0 -conv3_weight gaussian 0.00799657031894 -conv3_bias constant 0.0 -dense_weight gaussian 0.00804364029318 -dense_bias constant 0.0 -Loading data .................. -Loading data file cifar-10-batches-py/data_batch_1 -Loading data file cifar-10-batches-py/data_batch_2 -Loading data file cifar-10-batches-py/data_batch_3 -Loading data file cifar-10-batches-py/data_batch_4 -Loading data file cifar-10-batches-py/data_batch_5 -Loading data file cifar-10-batches-py/test_batch -Epoch 0 -training loss = 1.881866, training accuracy = 0.306360 accuracy = 0.420000 -test loss = 1.602577, test accuracy = 0.412200 -Epoch 1 -training loss = 1.536011, training accuracy = 0.441940 accuracy = 0.500000 -test loss = 1.378170, test accuracy = 0.507600 -Epoch 2 -training loss = 1.333137, training accuracy = 0.519960 accuracy = 0.520000 -test loss = 1.272205, test accuracy = 0.540600 -Epoch 3 -training loss = 1.185212, training accuracy = 0.574120 accuracy = 0.540000 -test loss = 1.211573, test accuracy = 0.567600 +<div class="highlight-default"><div class="highlight"><pre><span></span><span class="p">(</span><span class="mi">32</span><span class="n">L</span><span class="p">,</span> <span class="mi">32</span><span class="n">L</span><span class="p">,</span> <span class="mi">32</span><span class="n">L</span><span class="p">)</span> +<span class="p">(</span><span class="mi">32</span><span class="n">L</span><span class="p">,</span> <span class="mi">16</span><span class="n">L</span><span class="p">,</span> <span class="mi">16</span><span class="n">L</span><span class="p">)</span> +<span class="p">(</span><span class="mi">32</span><span class="n">L</span><span class="p">,</span> <span class="mi">16</span><span class="n">L</span><span class="p">,</span> <span class="mi">16</span><span class="n">L</span><span class="p">)</span> +<span class="p">(</span><span class="mi">32</span><span class="n">L</span><span class="p">,</span> <span class="mi">16</span><span class="n">L</span><span class="p">,</span> <span class="mi">16</span><span class="n">L</span><span class="p">)</span> +<span class="p">(</span><span class="mi">32</span><span class="n">L</span><span class="p">,</span> <span class="mi">16</span><span class="n">L</span><span class="p">,</span> <span class="mi">16</span><span class="n">L</span><span class="p">)</span> +<span class="p">(</span><span class="mi">32</span><span class="n">L</span><span class="p">,</span> <span class="mi">16</span><span class="n">L</span><span class="p">,</span> <span class="mi">16</span><span class="n">L</span><span class="p">)</span> +<span class="p">(</span><span class="mi">32</span><span class="n">L</span><span class="p">,</span> <span class="mi">8</span><span class="n">L</span><span class="p">,</span> <span class="mi">8</span><span class="n">L</span><span class="p">)</span> +<span class="p">(</span><span class="mi">32</span><span class="n">L</span><span class="p">,</span> <span class="mi">8</span><span class="n">L</span><span class="p">,</span> <span class="mi">8</span><span class="n">L</span><span class="p">)</span> +<span class="p">(</span><span class="mi">64</span><span class="n">L</span><span class="p">,</span> <span class="mi">8</span><span class="n">L</span><span class="p">,</span> <span class="mi">8</span><span class="n">L</span><span class="p">)</span> +<span class="p">(</span><span class="mi">64</span><span class="n">L</span><span class="p">,</span> <span class="mi">8</span><span class="n">L</span><span class="p">,</span> <span class="mi">8</span><span class="n">L</span><span class="p">)</span> +<span class="p">(</span><span class="mi">64</span><span class="n">L</span><span class="p">,</span> <span class="mi">4</span><span class="n">L</span><span class="p">,</span> <span class="mi">4</span><span class="n">L</span><span class="p">)</span> +<span class="p">(</span><span class="mi">1024</span><span class="n">L</span><span class="p">,)</span> +<span class="n">Start</span> <span class="n">intialization</span><span class="o">............</span> +<span class="n">conv1_weight</span> <span class="n">gaussian</span> <span class="mf">7.938460476e-05</span> +<span class="n">conv1_bias</span> <span class="n">constant</span> <span class="mf">0.0</span> +<span class="n">conv2_weight</span> <span class="n">gaussian</span> <span class="mf">0.00793507322669</span> +<span class="n">conv2_bias</span> <span class="n">constant</span> <span class="mf">0.0</span> +<span class="n">conv3_weight</span> <span class="n">gaussian</span> <span class="mf">0.00799657031894</span> +<span class="n">conv3_bias</span> <span class="n">constant</span> <span class="mf">0.0</span> +<span class="n">dense_weight</span> <span class="n">gaussian</span> <span class="mf">0.00804364029318</span> +<span class="n">dense_bias</span> <span class="n">constant</span> <span class="mf">0.0</span> +<span class="n">Loading</span> <span class="n">data</span> <span class="o">..................</span> +<span class="n">Loading</span> <span class="n">data</span> <span class="n">file</span> <span class="n">cifar</span><span class="o">-</span><span class="mi">10</span><span class="o">-</span><span class="n">batches</span><span class="o">-</span><span class="n">py</span><span class="o">/</span><span class="n">data_batch_1</span> +<span class="n">Loading</span> <span class="n">data</span> <span class="n">file</span> <span class="n">cifar</span><span class="o">-</span><span class="mi">10</span><span class="o">-</span><span class="n">batches</span><span class="o">-</span><span class="n">py</span><span class="o">/</span><span class="n">data_batch_2</span> +<span class="n">Loading</span> <span class="n">data</span> <span class="n">file</span> <span class="n">cifar</span><span class="o">-</span><span class="mi">10</span><span class="o">-</span><span class="n">batches</span><span class="o">-</span><span class="n">py</span><span class="o">/</span><span class="n">data_batch_3</span> +<span class="n">Loading</span> <span class="n">data</span> <span class="n">file</span> <span class="n">cifar</span><span class="o">-</span><span class="mi">10</span><span class="o">-</span><span class="n">batches</span><span class="o">-</span><span class="n">py</span><span class="o">/</span><span class="n">data_batch_4</span> +<span class="n">Loading</span> <span class="n">data</span> <span class="n">file</span> <span class="n">cifar</span><span class="o">-</span><span class="mi">10</span><span class="o">-</span><span class="n">batches</span><span class="o">-</span><span class="n">py</span><span class="o">/</span><span class="n">data_batch_5</span> +<span class="n">Loading</span> <span class="n">data</span> <span class="n">file</span> <span class="n">cifar</span><span class="o">-</span><span class="mi">10</span><span class="o">-</span><span class="n">batches</span><span class="o">-</span><span class="n">py</span><span class="o">/</span><span class="n">test_batch</span> +<span class="n">Epoch</span> <span class="mi">0</span> +<span class="n">training</span> <span class="n">loss</span> <span class="o">=</span> <span class="mf">1.881866</span><span class="p">,</span> <span class="n">training</span> <span class="n">accuracy</span> <span class="o">=</span> <span class="mf">0.306360</span> <span class="n">accuracy</span> <span class="o">=</span> <span class="mf">0.420000</span> +<span class="n">test</span> <span class="n">loss</span> <span class="o">=</span> <span class="mf">1.602577</span><span class="p">,</span> <span class="n">test</span> <span class="n">accuracy</span> <span class="o">=</span> <span class="mf">0.412200</span> +<span class="n">Epoch</span> <span class="mi">1</span> +<span class="n">training</span> <span class="n">loss</span> <span class="o">=</span> <span class="mf">1.536011</span><span class="p">,</span> <span class="n">training</span> <span class="n">accuracy</span> <span class="o">=</span> <span class="mf">0.441940</span> <span class="n">accuracy</span> <span class="o">=</span> <span class="mf">0.500000</span> +<span class="n">test</span> <span class="n">loss</span> <span class="o">=</span> <span class="mf">1.378170</span><span class="p">,</span> <span class="n">test</span> <span class="n">accuracy</span> <span class="o">=</span> <span class="mf">0.507600</span> +<span class="n">Epoch</span> <span class="mi">2</span> +<span class="n">training</span> <span class="n">loss</span> <span class="o">=</span> <span class="mf">1.333137</span><span class="p">,</span> <span class="n">training</span> <span class="n">accuracy</span> <span class="o">=</span> <span class="mf">0.519960</span> <span class="n">accuracy</span> <span class="o">=</span> <span class="mf">0.520000</span> +<span class="n">test</span> <span class="n">loss</span> <span class="o">=</span> <span class="mf">1.272205</span><span class="p">,</span> <span class="n">test</span> <span class="n">accuracy</span> <span class="o">=</span> <span class="mf">0.540600</span> +<span class="n">Epoch</span> <span class="mi">3</span> +<span class="n">training</span> <span class="n">loss</span> <span class="o">=</span> <span class="mf">1.185212</span><span class="p">,</span> <span class="n">training</span> <span class="n">accuracy</span> <span class="o">=</span> <span class="mf">0.574120</span> <span class="n">accuracy</span> <span class="o">=</span> <span class="mf">0.540000</span> +<span class="n">test</span> <span class="n">loss</span> <span class="o">=</span> <span class="mf">1.211573</span><span class="p">,</span> <span class="n">test</span> <span class="n">accuracy</span> <span class="o">=</span> <span class="mf">0.567600</span> </pre></div> </div> <p>This script will call <code class="docutils literal"><span class="pre">alexnet.py</span></code> file to build the alexnet model. After the training is finished, SINGA will save the model parameters into a checkpoint file <code class="docutils literal"><span class="pre">model.bin</span></code> in the same directory. Then we can use this <code class="docutils literal"><span class="pre">model.bin</span></code> file for prediction.</p> -<div class="highlight-python"><div class="highlight"><pre>$ python predict.py +<div class="highlight-default"><div class="highlight"><pre><span></span>$ python predict.py </pre></div> </div> </div>
Modified: incubator/singa/site/trunk/en/docs/converter.html URL: http://svn.apache.org/viewvc/incubator/singa/site/trunk/en/docs/converter.html?rev=1784386&r1=1784385&r2=1784386&view=diff ============================================================================== --- incubator/singa/site/trunk/en/docs/converter.html (original) +++ incubator/singa/site/trunk/en/docs/converter.html Sat Feb 25 15:30:33 2017 @@ -31,6 +31,9 @@ + <link rel="index" title="Index" + href="../genindex.html"/> + <link rel="search" title="Search" href="../search.html"/> <link rel="top" title="incubator-singa 1.1.0 documentation" href="../index.html"/> <link rel="up" title="Documentation" href="index.html"/> <link rel="next" title="Utils" href="utils.html"/> @@ -104,7 +107,7 @@ <li class="toctree-l2"><a class="reference internal" href="data.html">Data</a></li> <li class="toctree-l2"><a class="reference internal" href="image_tool.html">Image Tool</a></li> <li class="toctree-l2"><a class="reference internal" href="snapshot.html">Snapshot</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="">Caffe Converter</a></li> +<li class="toctree-l2 current"><a class="current reference internal" href="#">Caffe Converter</a></li> <li class="toctree-l2"><a class="reference internal" href="utils.html">Utils</a></li> <li class="toctree-l2"><a class="reference internal" href="model_zoo/index.html">Model Zoo</a></li> </ul> Modified: incubator/singa/site/trunk/en/docs/data.html URL: http://svn.apache.org/viewvc/incubator/singa/site/trunk/en/docs/data.html?rev=1784386&r1=1784385&r2=1784386&view=diff ============================================================================== --- incubator/singa/site/trunk/en/docs/data.html (original) +++ incubator/singa/site/trunk/en/docs/data.html Sat Feb 25 15:30:33 2017 @@ -31,6 +31,9 @@ + <link rel="index" title="Index" + href="../genindex.html"/> + <link rel="search" title="Search" href="../search.html"/> <link rel="top" title="incubator-singa 1.1.0 documentation" href="../index.html"/> <link rel="up" title="Documentation" href="index.html"/> <link rel="next" title="Image Tool" href="image_tool.html"/> @@ -101,7 +104,7 @@ <li class="toctree-l2"><a class="reference internal" href="loss.html">Loss</a></li> <li class="toctree-l2"><a class="reference internal" href="metric.html">Metric</a></li> <li class="toctree-l2"><a class="reference internal" href="optimizer.html">Optimizer</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="">Data</a></li> +<li class="toctree-l2 current"><a class="current reference internal" href="#">Data</a></li> <li class="toctree-l2"><a class="reference internal" href="image_tool.html">Image Tool</a></li> <li class="toctree-l2"><a class="reference internal" href="snapshot.html">Snapshot</a></li> <li class="toctree-l2"><a class="reference internal" href="converter.html">Caffe Converter</a></li> @@ -171,8 +174,8 @@ <span id="data"></span><h1>Data<a class="headerlink" href="#module-singa.data" title="Permalink to this headline">¶</a></h1> <p>This module includes classes for loading and prefetching data batches.</p> <p>Example usage:</p> -<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">image_tool</span> -<span class="kn">from</span> <span class="nn">PIL</span> <span class="kn">import</span> <span class="n">Image</span> +<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">image_tool</span> +<span class="kn">from</span> <span class="nn">PIL</span> <span class="k">import</span> <span class="n">Image</span> <span class="n">tool</span> <span class="o">=</span> <span class="n">image_tool</span><span class="o">.</span><span class="n">ImageTool</span><span class="p">()</span> @@ -183,7 +186,7 @@ <span class="p">(</span><span class="mi">96</span><span class="p">,</span> <span class="mi">96</span><span class="p">))</span><span class="o">.</span><span class="n">flip</span><span class="p">()</span><span class="o">.</span><span class="n">get</span><span class="p">()</span> <span class="n">data</span> <span class="o">=</span> <span class="n">ImageBatchIter</span><span class="p">(</span><span class="s1">'train.txt'</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> - <span class="n">image_transform</span><span class="p">,</span> <span class="n">shuffle</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">delimiter</span><span class="o">=</span><span class="s1">','</span><span class="p">,</span> + <span class="n">image_transform</span><span class="p">,</span> <span class="n">shuffle</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">delimiter</span><span class="o">=</span><span class="s1">','</span><span class="p">,</span> <span class="n">image_folder</span><span class="o">=</span><span class="s1">'images/'</span><span class="p">,</span> <span class="n">capacity</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span> <span class="n">data</span><span class="o">.</span><span class="n">start</span><span class="p">()</span> Modified: incubator/singa/site/trunk/en/docs/dependencies.html URL: http://svn.apache.org/viewvc/incubator/singa/site/trunk/en/docs/dependencies.html?rev=1784386&r1=1784385&r2=1784386&view=diff ============================================================================== --- incubator/singa/site/trunk/en/docs/dependencies.html (original) +++ incubator/singa/site/trunk/en/docs/dependencies.html Sat Feb 25 15:30:33 2017 @@ -31,6 +31,9 @@ + <link rel="index" title="Index" + href="../genindex.html"/> + <link rel="search" title="Search" href="../search.html"/> <link rel="top" title="incubator-singa 1.1.0 documentation" href="../index.html"/> <link href="../_static/style.css" rel="stylesheet" type="text/css"> @@ -196,7 +199,7 @@ OpenBLAS with version 0.2.18 as test:</p <p>Step 1: Download and decompress the source code.</p> <p>Step 2: Start a cmd window under the OpenBLAS folder then run the following commands to generate the solution:</p> -<div class="highlight-python"><div class="highlight"><pre>$ md build $$ cd build +<div class="highlight-default"><div class="highlight"><pre><span></span>$ md build $$ cd build $ cmake -G "Visual Studio 14" .. </pre></div> </div> Modified: incubator/singa/site/trunk/en/docs/device.html URL: http://svn.apache.org/viewvc/incubator/singa/site/trunk/en/docs/device.html?rev=1784386&r1=1784385&r2=1784386&view=diff ============================================================================== --- incubator/singa/site/trunk/en/docs/device.html (original) +++ incubator/singa/site/trunk/en/docs/device.html Sat Feb 25 15:30:33 2017 @@ -31,6 +31,9 @@ + <link rel="index" title="Index" + href="../genindex.html"/> + <link rel="search" title="Search" href="../search.html"/> <link rel="top" title="incubator-singa 1.1.0 documentation" href="../index.html"/> <link rel="up" title="Documentation" href="index.html"/> <link rel="next" title="Tensor" href="tensor.html"/> @@ -93,7 +96,7 @@ <li class="toctree-l1 current"><a class="reference internal" href="index.html">Documentation</a><ul class="current"> <li class="toctree-l2"><a class="reference internal" href="installation.html">Installation</a></li> <li class="toctree-l2"><a class="reference internal" href="software_stack.html">Software Stack</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="">Device</a><ul> +<li class="toctree-l2 current"><a class="current reference internal" href="#">Device</a><ul> <li class="toctree-l3"><a class="reference internal" href="#specific-devices">Specific devices</a></li> <li class="toctree-l3"><a class="reference internal" href="#module-singa.device">Python API</a></li> <li class="toctree-l3"><a class="reference internal" href="#cpp-api">CPP API</a></li> @@ -231,7 +234,7 @@ to call singa::Device and its methods.</ </dd></dl> <p>The following code provides examples of creating devices:</p> -<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">singa</span> <span class="kn">import</span> <span class="n">device</span> +<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">singa</span> <span class="k">import</span> <span class="n">device</span> <span class="n">cuda</span> <span class="o">=</span> <span class="n">device</span><span class="o">.</span><span class="n">create_cuda_gpu_on</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="c1"># use GPU card of ID 0</span> <span class="n">host</span> <span class="o">=</span> <span class="n">device</span><span class="o">.</span><span class="n">get_default_device</span><span class="p">()</span> <span class="c1"># get the default host device (a CppCPU)</span> <span class="n">ary1</span> <span class="o">=</span> <span class="n">device</span><span class="o">.</span><span class="n">create_cuda_gpus</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="c1"># create 2 devices, starting from ID 0</span> Modified: incubator/singa/site/trunk/en/docs/docker.html URL: http://svn.apache.org/viewvc/incubator/singa/site/trunk/en/docs/docker.html?rev=1784386&r1=1784385&r2=1784386&view=diff ============================================================================== --- incubator/singa/site/trunk/en/docs/docker.html (original) +++ incubator/singa/site/trunk/en/docs/docker.html Sat Feb 25 15:30:33 2017 @@ -31,6 +31,9 @@ + <link rel="index" title="Index" + href="../genindex.html"/> + <link rel="search" title="Search" href="../search.html"/> <link rel="top" title="incubator-singa 1.1.0 documentation" href="../index.html"/> <link href="../_static/style.css" rel="stylesheet" type="text/css"> @@ -156,15 +159,15 @@ <div class="section" id="use-the-existing-docker-images"> <span id="use-the-existing-docker-images"></span><h2>Use the existing Docker images<a class="headerlink" href="#use-the-existing-docker-images" title="Permalink to this headline">¶</a></h2> <p>Users can pull the Docker images from Dockerhub via</p> -<div class="highlight-python"><div class="highlight"><pre>docker pull apache/singa:devel -# or -docker pull apache/singa:devel-cuda +<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">docker</span> <span class="n">pull</span> <span class="n">apache</span><span class="o">/</span><span class="n">singa</span><span class="p">:</span><span class="n">devel</span> +<span class="c1"># or</span> +<span class="n">docker</span> <span class="n">pull</span> <span class="n">apache</span><span class="o">/</span><span class="n">singa</span><span class="p">:</span><span class="n">devel</span><span class="o">-</span><span class="n">cuda</span> </pre></div> </div> <p>Run the docker container using</p> -<div class="highlight-python"><div class="highlight"><pre>docker run -it apache/singa:devel /bin/bash -# or -docker run -it apache/singa:devel-cuda /bin/bash +<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">docker</span> <span class="n">run</span> <span class="o">-</span><span class="n">it</span> <span class="n">apache</span><span class="o">/</span><span class="n">singa</span><span class="p">:</span><span class="n">devel</span> <span class="o">/</span><span class="nb">bin</span><span class="o">/</span><span class="n">bash</span> +<span class="c1"># or</span> +<span class="n">docker</span> <span class="n">run</span> <span class="o">-</span><span class="n">it</span> <span class="n">apache</span><span class="o">/</span><span class="n">singa</span><span class="p">:</span><span class="n">devel</span><span class="o">-</span><span class="n">cuda</span> <span class="o">/</span><span class="nb">bin</span><span class="o">/</span><span class="n">bash</span> </pre></div> </div> <p>The latest SINGA code is under the <code class="docutils literal"><span class="pre">incubator-singa</span></code> folder.</p> @@ -173,11 +176,11 @@ docker run -it apache/singa:devel-cuda / <span id="create-new-docker-images-from-dockerfile"></span><h2>Create new Docker images from Dockerfile<a class="headerlink" href="#create-new-docker-images-from-dockerfile" title="Permalink to this headline">¶</a></h2> <p>New Docker images could be created by executing the following command within the Dockerfile folder, e.g., tool/docker/devel/</p> -<div class="highlight-python"><div class="highlight"><pre>docker build -t singa:<TAG> -f Dockerfile +<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">docker</span> <span class="n">build</span> <span class="o">-</span><span class="n">t</span> <span class="n">singa</span><span class="p">:</span><span class="o"><</span><span class="n">TAG</span><span class="o">></span> <span class="o">-</span><span class="n">f</span> <span class="n">Dockerfile</span> </pre></div> </div> <p>The <code class="docutils literal"><span class="pre"><TAG></span></code> is named as</p> -<div class="highlight-python"><div class="highlight"><pre><span class="n">devel</span><span class="o">|</span><span class="n">runtime</span><span class="p">[</span><span class="o">-</span><span class="n">OS</span><span class="p">][</span><span class="o">-</span><span class="n">CUDA</span><span class="o">|</span><span class="n">OPENCL</span><span class="p">][</span><span class="o">-</span><span class="n">CUDNN</span><span class="p">]</span> +<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">devel</span><span class="o">|</span><span class="n">runtime</span><span class="p">[</span><span class="o">-</span><span class="n">OS</span><span class="p">][</span><span class="o">-</span><span class="n">CUDA</span><span class="o">|</span><span class="n">OPENCL</span><span class="p">][</span><span class="o">-</span><span class="n">CUDNN</span><span class="p">]</span> </pre></div> </div> <ul class="simple"> @@ -194,10 +197,10 @@ For -cuda version, the <strong>cudnn</st <p><code class="docutils literal"><span class="pre">devel</span></code>, <code class="docutils literal"><span class="pre">devel-cuda</span></code>, <code class="docutils literal"><span class="pre">runtime</span></code>, <code class="docutils literal"><span class="pre">runtime-cuda</span></code>, <code class="docutils literal"><span class="pre">devel-centos7-cuda</span></code>, <code class="docutils literal"><span class="pre">devel-ubuntu14.04</span></code>, <code class="docutils literal"><span class="pre">devel-ubuntu14.04-cuda7.5-cudnn4</span></code></p> <p>Please follow the existing Dockefiles under tool/docker/ to create other Dockefiles. The folder structure is like</p> -<div class="highlight-python"><div class="highlight"><pre>level1: devel|runtime -level2: Dockerfile, OS -level3: Dockerfile, CUDA|OPENCL -level4: CUDNN +<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">level1</span><span class="p">:</span> <span class="n">devel</span><span class="o">|</span><span class="n">runtime</span> +<span class="n">level2</span><span class="p">:</span> <span class="n">Dockerfile</span><span class="p">,</span> <span class="n">OS</span> +<span class="n">level3</span><span class="p">:</span> <span class="n">Dockerfile</span><span class="p">,</span> <span class="n">CUDA</span><span class="o">|</span><span class="n">OPENCL</span> +<span class="n">level4</span><span class="p">:</span> <span class="n">CUDNN</span> </pre></div> </div> <p>For example, the path of the Dockerfile for <code class="docutils literal"><span class="pre">devel-cuda</span></code> is <code class="docutils literal"><span class="pre">tool/docker/devel/cuda/Dockerfile</span></code>.</p> Modified: incubator/singa/site/trunk/en/docs/image_tool.html URL: http://svn.apache.org/viewvc/incubator/singa/site/trunk/en/docs/image_tool.html?rev=1784386&r1=1784385&r2=1784386&view=diff ============================================================================== --- incubator/singa/site/trunk/en/docs/image_tool.html (original) +++ incubator/singa/site/trunk/en/docs/image_tool.html Sat Feb 25 15:30:33 2017 @@ -31,6 +31,9 @@ + <link rel="index" title="Index" + href="../genindex.html"/> + <link rel="search" title="Search" href="../search.html"/> <link rel="top" title="incubator-singa 1.1.0 documentation" href="../index.html"/> <link rel="up" title="Documentation" href="index.html"/> <link rel="next" title="Snapshot" href="snapshot.html"/> @@ -102,7 +105,7 @@ <li class="toctree-l2"><a class="reference internal" href="metric.html">Metric</a></li> <li class="toctree-l2"><a class="reference internal" href="optimizer.html">Optimizer</a></li> <li class="toctree-l2"><a class="reference internal" href="data.html">Data</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="">Image Tool</a></li> +<li class="toctree-l2 current"><a class="current reference internal" href="#">Image Tool</a></li> <li class="toctree-l2"><a class="reference internal" href="snapshot.html">Snapshot</a></li> <li class="toctree-l2"><a class="reference internal" href="converter.html">Caffe Converter</a></li> <li class="toctree-l2"><a class="reference internal" href="utils.html">Utils</a></li> @@ -171,7 +174,7 @@ <span id="image-tool"></span><h1>Image Tool<a class="headerlink" href="#module-singa.image_tool" title="Permalink to this headline">¶</a></h1> <p>An utility model for image augmentation.</p> <p>Example usage:</p> -<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">singa</span> <span class="kn">import</span> <span class="n">image_tool</span> +<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">singa</span> <span class="k">import</span> <span class="n">image_tool</span> <span class="n">tool</span> <span class="o">=</span> <span class="n">image_tool</span><span class="o">.</span><span class="n">ImageTool</span><span class="p">()</span> <span class="n">imgs</span> <span class="o">=</span> <span class="n">tool</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="s1">'input.png'</span><span class="p">)</span><span class="o">.</span> <span class="n">resize_by_list</span><span class="p">([</span><span class="mi">112</span><span class="p">])</span><span class="o">.</span><span class="n">crop5</span><span class="p">((</span><span class="mi">96</span><span class="p">,</span> <span class="mi">96</span><span class="p">),</span> <span class="mi">5</span><span class="p">)</span><span class="o">.</span><span class="n">enhance</span><span class="p">()</span><span class="o">.</span><span class="n">flip</span><span class="p">()</span><span class="o">.</span><span class="n">get</span><span class="p">()</span> @@ -405,7 +408,7 @@ if True; otherwise, return the patches.< <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>patch</strong> (<em>tuple</em>) – width and height of the patch</li> -<li><strong>position</strong> (<em>list(str</em>) – left_top, left_bottom, right_top, right_bottom</li> +<li><strong>position</strong> (<em>list</em><em>(</em><em>str</em><em>)</em><em></em>) – left_top, left_bottom, right_top, right_bottom</li> <li><strong>center.</strong> (<em>and</em>) – </li> </ul> </td> @@ -425,7 +428,7 @@ it into given size.</p> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>patch</strong> (<em>tuple</em>) – width, height</li> -<li><strong>position</strong> (<em>list(str</em>) – left, center, right, top, middle, bottom.</li> +<li><strong>position</strong> (<em>list</em><em>(</em><em>str</em><em>)</em><em></em>) – left, center, right, top, middle, bottom.</li> </ul> </td> </tr> Modified: incubator/singa/site/trunk/en/docs/index.html URL: http://svn.apache.org/viewvc/incubator/singa/site/trunk/en/docs/index.html?rev=1784386&r1=1784385&r2=1784386&view=diff ============================================================================== --- incubator/singa/site/trunk/en/docs/index.html (original) +++ incubator/singa/site/trunk/en/docs/index.html Sat Feb 25 15:30:33 2017 @@ -31,6 +31,9 @@ + <link rel="index" title="Index" + href="../genindex.html"/> + <link rel="search" title="Search" href="../search.html"/> <link rel="top" title="incubator-singa 1.1.0 documentation" href="../index.html"/> <link rel="next" title="Installation" href="installation.html"/> <link rel="prev" title="Download SINGA" href="../downloads.html"/> @@ -89,7 +92,7 @@ <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="../downloads.html">Download SINGA</a></li> -<li class="toctree-l1 current"><a class="current reference internal" href="">Documentation</a><ul> +<li class="toctree-l1 current"><a class="current reference internal" href="#">Documentation</a><ul> <li class="toctree-l2"><a class="reference internal" href="installation.html">Installation</a></li> <li class="toctree-l2"><a class="reference internal" href="software_stack.html">Software Stack</a></li> <li class="toctree-l2"><a class="reference internal" href="device.html">Device</a></li> @@ -169,10 +172,9 @@ <div class="toctree-wrapper compound"> <ul> <li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a><ul> -<li class="toctree-l2"><a class="reference internal" href="installation.html#from-wheel">From wheel</a><ul> -<li class="toctree-l3"><a class="reference internal" href="installation.html#pre-requisite">Pre-requisite</a></li> -<li class="toctree-l3"><a class="reference internal" href="installation.html#virtual-environment">Virtual environment</a></li> -<li class="toctree-l3"><a class="reference internal" href="installation.html#instructions">Instructions</a></li> +<li class="toctree-l2"><a class="reference internal" href="installation.html#from-conda">From Conda</a><ul> +<li class="toctree-l3"><a class="reference internal" href="installation.html#linux">Linux</a></li> +<li class="toctree-l3"><a class="reference internal" href="installation.html#mac-osx">Mac OSX</a></li> </ul> </li> <li class="toctree-l2"><a class="reference internal" href="installation.html#from-debian-package">From Debian Package</a></li> Modified: incubator/singa/site/trunk/en/docs/initializer.html URL: http://svn.apache.org/viewvc/incubator/singa/site/trunk/en/docs/initializer.html?rev=1784386&r1=1784385&r2=1784386&view=diff ============================================================================== --- incubator/singa/site/trunk/en/docs/initializer.html (original) +++ incubator/singa/site/trunk/en/docs/initializer.html Sat Feb 25 15:30:33 2017 @@ -31,6 +31,9 @@ + <link rel="index" title="Index" + href="../genindex.html"/> + <link rel="search" title="Search" href="../search.html"/> <link rel="top" title="incubator-singa 1.1.0 documentation" href="../index.html"/> <link rel="up" title="Documentation" href="index.html"/> <link rel="next" title="Loss" href="loss.html"/> @@ -97,7 +100,7 @@ <li class="toctree-l2"><a class="reference internal" href="tensor.html">Tensor</a></li> <li class="toctree-l2"><a class="reference internal" href="layer.html">Layer</a></li> <li class="toctree-l2"><a class="reference internal" href="net.html">FeedForward Net</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="">Initializer</a><ul> +<li class="toctree-l2 current"><a class="current reference internal" href="#">Initializer</a><ul> <li class="toctree-l3"><a class="reference internal" href="#module-singa.initializer">Python API</a></li> <li class="toctree-l3"><a class="reference internal" href="#cpp-api">CPP API</a></li> </ul> @@ -177,8 +180,8 @@ <span id="python-api"></span><h2>Python API<a class="headerlink" href="#module-singa.initializer" title="Permalink to this headline">¶</a></h2> <p>Popular initialization methods for parameter values (Tensor objects).</p> <p>Example usages:</p> -<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">singa</span> <span class="kn">import</span> <span class="n">tensor</span> -<span class="kn">from</span> <span class="nn">singa</span> <span class="kn">import</span> <span class="n">initializer</span> +<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">singa</span> <span class="k">import</span> <span class="n">tensor</span> +<span class="kn">from</span> <span class="nn">singa</span> <span class="k">import</span> <span class="n">initializer</span> <span class="n">x</span> <span class="o">=</span> <span class="n">tensor</span><span class="o">.</span><span class="n">Tensor</span><span class="p">((</span><span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span> <span class="n">initializer</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span> <span class="c1"># use both fan_in and fan_out</span> Modified: incubator/singa/site/trunk/en/docs/installation.html URL: http://svn.apache.org/viewvc/incubator/singa/site/trunk/en/docs/installation.html?rev=1784386&r1=1784385&r2=1784386&view=diff ============================================================================== --- incubator/singa/site/trunk/en/docs/installation.html (original) +++ incubator/singa/site/trunk/en/docs/installation.html Sat Feb 25 15:30:33 2017 @@ -31,6 +31,9 @@ + <link rel="index" title="Index" + href="../genindex.html"/> + <link rel="search" title="Search" href="../search.html"/> <link rel="top" title="incubator-singa 1.1.0 documentation" href="../index.html"/> <link rel="up" title="Documentation" href="index.html"/> <link rel="next" title="Software Stack" href="software_stack.html"/> @@ -91,11 +94,10 @@ <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="../downloads.html">Download SINGA</a></li> <li class="toctree-l1 current"><a class="reference internal" href="index.html">Documentation</a><ul class="current"> -<li class="toctree-l2 current"><a class="current reference internal" href="">Installation</a><ul> -<li class="toctree-l3"><a class="reference internal" href="#from-wheel">From wheel</a><ul> -<li class="toctree-l4"><a class="reference internal" href="#pre-requisite">Pre-requisite</a></li> -<li class="toctree-l4"><a class="reference internal" href="#virtual-environment">Virtual environment</a></li> -<li class="toctree-l4"><a class="reference internal" href="#instructions">Instructions</a></li> +<li class="toctree-l2 current"><a class="current reference internal" href="#">Installation</a><ul> +<li class="toctree-l3"><a class="reference internal" href="#from-conda">From Conda</a><ul> +<li class="toctree-l4"><a class="reference internal" href="#linux">Linux</a></li> +<li class="toctree-l4"><a class="reference internal" href="#mac-osx">Mac OSX</a></li> </ul> </li> <li class="toctree-l3"><a class="reference internal" href="#from-debian-package">From Debian Package</a></li> @@ -186,101 +188,36 @@ <div class="section" id="installation"> <span id="installation"></span><h1>Installation<a class="headerlink" href="#installation" title="Permalink to this headline">¶</a></h1> -<div class="section" id="from-wheel"> -<span id="from-wheel"></span><h2>From wheel<a class="headerlink" href="#from-wheel" title="Permalink to this headline">¶</a></h2> -<p>Users can download the pre-compiled wheel files to install PySINGA. -PySINGA has been tested on Linux (Ubunu 14.04 and 16.04) and Mac OS (10.11 and 10.12).</p> -<div class="section" id="pre-requisite"> -<span id="pre-requisite"></span><h3>Pre-requisite<a class="headerlink" href="#pre-requisite" title="Permalink to this headline">¶</a></h3> -<p>Python 2.7 and pip are required</p> -<div class="highlight-python"><div class="highlight"><pre># For Ubuntu -$ sudo apt-get install python2.7-dev python-pip - -# For Mac -$ brew tap homebrew/python -$ brew install python -</pre></div> -</div> -<p>Note for Mac OS, you need to configure the (python) paths correctly if multiple python versions are installed. -Refer to FAQ for the errors and solutions.</p> +<div class="section" id="from-conda"> +<span id="from-conda"></span><h2>From Conda<a class="headerlink" href="#from-conda" title="Permalink to this headline">¶</a></h2> +<p>Conda is a package manager provided by <a class="reference external" href="https://www.continuum.io/downloads">Anaconda</a> or <a class="reference external" href="https://conda.io/miniconda.html">Miniconda</a>. +Currently, SINGA has conda packages (Python2.7) for Linux and MacOSX.</p> +<div class="section" id="linux"> +<span id="linux"></span><h3>Linux<a class="headerlink" href="#linux" title="Permalink to this headline">¶</a></h3> +<ol> +<li><p class="first">CPU only</p> +<p>conda install -c nusdbsystem singa</p> +</li> +<li><p class="first">GPU via CUDA+cuDNN</p> +<p>conda install -c nusdbsystem singa-cudax.y-cudnnz</p> +<p>where <x,y,z> is one of <8.0, 5>, <7.5, 5> and <7.5, 4>. +Users need to install CUDA and cuDNN before installing SINGA. +If cuDNN is not in system folders (e.g., /usr/local), export the folder of libcudnn.so to LD_LIBRARY_PATH</p> +</li> +</ol> </div> -<div class="section" id="virtual-environment"> -<span id="virtual-environment"></span><h3>Virtual environment<a class="headerlink" href="#virtual-environment" title="Permalink to this headline">¶</a></h3> -<p>Users are recommended to use PySINGA in python virtual environment.</p> -<p>To use pip with virtual environment,</p> -<div class="highlight-python"><div class="highlight"><pre># install virtualenv -$ pip install virtualenv -$ virtualenv pysinga -$ source pysinga/bin/activate -</pre></div> -</div> -<p>To use anaconda with virtual environment,</p> -<div class="highlight-python"><div class="highlight"><pre>$ conda create --name pysinga python=2 -$ source activate pysinga +<div class="section" id="mac-osx"> +<span id="mac-osx"></span><h3>Mac OSX<a class="headerlink" href="#mac-osx" title="Permalink to this headline">¶</a></h3> +<p>Only the CPU version is available,</p> +<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">conda</span> <span class="n">config</span> <span class="o">--</span><span class="n">add</span> <span class="n">channels</span> <span class="n">conda</span><span class="o">-</span><span class="n">forge</span> +<span class="n">conda</span> <span class="n">install</span> <span class="o">-</span><span class="n">c</span> <span class="n">nusdbsystem</span> <span class="n">singa</span> </pre></div> </div> -<p>Note that in python virtual environment, you may need to reset the <code class="docutils literal"><span class="pre">PYTHONPATH</span></code> to empty -to avoid the conflicts of system path and virtual environment path.</p> -</div> -<div class="section" id="instructions"> -<span id="instructions"></span><h3>Instructions<a class="headerlink" href="#instructions" title="Permalink to this headline">¶</a></h3> -<p>Currently, the following wheel files are available,</p> -<table border="1"> - <tr> - <th>OS</th> - <th>Device</th> - <th>CUDA/cuDNN</th> - <th>Link</th> - </tr> - <tr> - <td>Ubuntu14.04</td> - <td>CPU</td> - <td>-</td> - <td><a href="http://comp.nus.edu.sg/~dbsystem/singa/assets/file/wheel/linux/latest/ubuntu14.04-cpp/">latest</a>, <a href="http://www.comp.nus.edu.sg/~dbsystem/singa/assets/file/wheel/linux">history</a></td> - </tr> - <tr> - <td>Ubuntu14.04</td> - <td>GPU</td> - <td>CUDA7.5+cuDNN4</td> - <td><a href="http://comp.nus.edu.sg/~dbsystem/singa/assets/file/wheel/linux/latest/ubuntu14.04-cuda7.5-cudnn4/">latest</a>, <a href="http://www.comp.nus.edu.sg/~dbsystem/singa/assets/file/wheel/linux">history</a></td> - </tr> - <tr> - <td>Ubuntu14.04</td> - <td>GPU</td> - <td>CUDA7.5+cuDNN5</td> - <td><a href="http://comp.nus.edu.sg/~dbsystem/singa/assets/file/wheel/linux/latest/ubuntu14.04-cuda7.5-cudnn5/">latest</a>, <a href="http://www.comp.nus.edu.sg/~dbsystem/singa/assets/file/wheel/linux">history</a></td> - </tr> - <tr> - <td>Ubuntu16.04</td> - <td>CPU</td> - <td>-</td> - <td><a href="http://comp.nus.edu.sg/~dbsystem/singa/assets/file/wheel/linux/latest/ubuntu16.04-cpp/">latest</a>, <a href="http://www.comp.nus.edu.sg/~dbsystem/singa/assets/file/wheel/linux">history</a></td> - </tr> - <tr> - <td>Ubuntu16.04</td> - <td>GPU</td> - <td>CUDA8.0+cuDNN5</td> - <td><a href="http://comp.nus.edu.sg/~dbsystem/singa/assets/file/wheel/linux/latest/ubuntu16.04-cuda8.0-cudnn5/">latest</a>, <a href="http://www.comp.nus.edu.sg/~dbsystem/singa/assets/file/wheel/linux">history</a></td> - </tr> - <tr> - <td>MacOSX10.11</td> - <td>CPU</td> - <td>-</td> - <td><a href="http://comp.nus.edu.sg/~dbsystem/singa/assets/file/wheel/macosx/latest/macosx10.11-cpp/">latest</a>, <a href="http://www.comp.nus.edu.sg/~dbsystem/singa/assets/file/wheel/macosx">history</a></td> - </tr> - <tr> - <td>MacOSX10.12</td> - <td>CPU</td> - <td>-</td> - <td><a href="http://comp.nus.edu.sg/~dbsystem/singa/assets/file/wheel/macosx/latest/macosx10.12-cpp/">latest</a>, <a href="http://www.comp.nus.edu.sg/~dbsystem/singa/assets/file/wheel/macosx">history</a></td> - </tr> -</table><p>Download the whl file and execute the following command to install PySINGA,</p> -<div class="highlight-python"><div class="highlight"><pre>$ pip install --upgrade <path to the whel file> +<p>If there is no error message from</p> +<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">python</span> <span class="o">-</span><span class="n">c</span> <span class="s2">"from singa import tensor"</span> </pre></div> </div> -<p>To install the wheel file compiled with CUDA, you need to install CUDA and export the <code class="docutils literal"><span class="pre">LD_LIBRARY_PATH</span></code> to cuDNN before running the above instruction.</p> -<p>If you have sudo right, you can run the above commands using <code class="docutils literal"><span class="pre">sudo</span> <span class="pre">pip</span> <span class="pre">install</span></code> without python virtual environment. -The option <code class="docutils literal"><span class="pre">--upgrade</span></code> may cause errors sometimes, in which case you can ignore it.</p> +<p>then SINGA is installed successfully.</p> </div> </div> <div class="section" id="from-debian-package"> @@ -303,7 +240,7 @@ The option <code class="docutils literal <td>Ubuntu14.04</td> <td>GPU</td> <td>CUDA7.5+cuDNN4</td> - <td>coming soon</td> + <td></td> </tr> <tr> <td>Ubuntu14.04</td> @@ -312,19 +249,13 @@ The option <code class="docutils literal <td>coming soon</td> </tr> <tr> - <td>Ubuntu16.04</td> - <td>CPU</td> - <td>-</td> - <td><a href="http://comp.nus.edu.sg/~dbsystem/singa/assets/file/debian/latest/ubuntu16.04-cpp/python-singa.deb">latest</a>, <a href="http://www.comp.nus.edu.sg/~dbsystem/singa/assets/file/debian">history</a></td> - </tr> - <tr> - <td>Ubuntu16.04</td> + <td>Ubuntu14.04</td> <td>GPU</td> <td>CUDA8.0+cuDNN5</td> - <td>coming soon</td> + <td></td> </tr> </table><p>Download the deb file and install it via</p> -<div class="highlight-python"><div class="highlight"><pre>apt-get install <path to the deb file, e.g., ./python-singa.deb> +<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">apt</span><span class="o">-</span><span class="n">get</span> <span class="n">install</span> <span class="o"><</span><span class="n">path</span> <span class="n">to</span> <span class="n">the</span> <span class="n">deb</span> <span class="n">file</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">g</span><span class="o">.</span><span class="p">,</span> <span class="o">./</span><span class="n">python</span><span class="o">-</span><span class="n">singa</span><span class="o">.</span><span class="n">deb</span><span class="o">></span> </pre></div> </div> <p>Note that the path must include <code class="docutils literal"><span class="pre">./</span></code> if the file in inside the current folder.</p> @@ -332,17 +263,17 @@ The option <code class="docutils literal <div class="section" id="from-source"> <span id="from-source"></span><h2>From source<a class="headerlink" href="#from-source" title="Permalink to this headline">¶</a></h2> <p>The source files could be downloaded either as a <a class="reference external" href="https://dist.apache.org/repos/dist/dev/incubator/singa/">tar.gz file</a>, or as a git repo</p> -<div class="highlight-python"><div class="highlight"><pre>$ git clone https://github.com/apache/incubator-singa.git +<div class="highlight-default"><div class="highlight"><pre><span></span>$ git clone https://github.com/apache/incubator-singa.git $ cd incubator-singa/ </pre></div> </div> <div class="section" id="pre-requisite"> -<span id="id1"></span><h3>Pre-requisite<a class="headerlink" href="#pre-requisite" title="Permalink to this headline">¶</a></h3> +<span id="pre-requisite"></span><h3>Pre-requisite<a class="headerlink" href="#pre-requisite" title="Permalink to this headline">¶</a></h3> <p>The following libraries are required</p> <ul class="simple"> <li>cmake (>=2.8)</li> <li>gcc (>=4.8.1) or Clang</li> -<li>google protobuf (>=2.5,<3)</li> +<li>google protobuf (>=2.5)</li> <li>blas (tested with openblas >=0.2.10)</li> <li>swig(>=3.0.10) for compiling PySINGA</li> <li>numpy(>=1.11.0) for compiling PySINGA</li> @@ -355,7 +286,7 @@ $ cd incubator-singa/ </ul> </div> <div class="section" id="instructions"> -<span id="id2"></span><h3>Instructions<a class="headerlink" href="#instructions" title="Permalink to this headline">¶</a></h3> +<span id="instructions"></span><h3>Instructions<a class="headerlink" href="#instructions" title="Permalink to this headline">¶</a></h3> <ol class="simple"> <li>create a <code class="docutils literal"><span class="pre">build</span></code> folder inside incubator-singa and go into that folder</li> <li>run <code class="docutils literal"><span class="pre">cmake</span> <span class="pre">[options]</span> <span class="pre">..</span></code> @@ -379,7 +310,7 @@ Details on the installation of dependent <p>Most of the dependent libraries could be installed from source or via package mangers like apt-get, yum, and homebrew. Please refer to FAQ for problems caused by the path setting of the dependent libraries.</p> <p>The following instructions are tested on Ubuntu 14.04 and 16.04for installing dependent libraries.</p> -<div class="highlight-python"><div class="highlight"><pre># required libraries +<div class="highlight-default"><div class="highlight"><pre><span></span># required libraries $ sudo apt-get install libprotobuf-dev libopenblas-dev protobuf-compiler # optional libraries @@ -388,7 +319,7 @@ $ sudo apt-get install libopencv-dev lib </pre></div> </div> <p>The following instructions are tested on Mac OS X Yosemite (10.11 and 10.12) for installing dependent libraries.</p> -<div class="highlight-python"><div class="highlight"><pre># required libraries +<div class="highlight-default"><div class="highlight"><pre><span></span># required libraries $ brew tap homebrew/science $ brew install openblas $ brew install protobuf260 @@ -402,18 +333,18 @@ $ brew install -vd glog lmdb </div> <p>By default, openblas is installed into /usr/local/opt/openblas. To let the compiler (and cmake) know the openblas path,</p> -<div class="highlight-python"><div class="highlight"><pre>$ export CMAKE_INCLUDE_PATH=/usr/local/opt/openblas/include:$CMAKE_INCLUDE_PATH +<div class="highlight-default"><div class="highlight"><pre><span></span>$ export CMAKE_INCLUDE_PATH=/usr/local/opt/openblas/include:$CMAKE_INCLUDE_PATH $ export CMAKE_LIBRARY_PATH=/usr/local/opt/openblas/lib:$CMAKE_LIBRARY_PATH </pre></div> </div> <p>To let the runtime know the openblas path,</p> -<div class="highlight-python"><div class="highlight"><pre>$ export LD_LIBRARY_PATH=/usr/local/opt/openblas/library:$LD_LIBRARY_PATH +<div class="highlight-default"><div class="highlight"><pre><span></span>$ export LD_LIBRARY_PATH=/usr/local/opt/openblas/library:$LD_LIBRARY_PATH </pre></div> </div> <div class="section" id="compile-with-use-modules-on"> <span id="compile-with-use-modules-on"></span><h4>Compile with USE_MODULES=ON<a class="headerlink" href="#compile-with-use-modules-on" title="Permalink to this headline">¶</a></h4> <p>If protobuf and openblas are not installed, you can compile SINGA together with them</p> -<div class="highlight-python"><div class="highlight"><pre>$ In SINGA ROOT folder +<div class="highlight-default"><div class="highlight"><pre><span></span>$ In SINGA ROOT folder $ mkdir build $ cd build $ cmake -DUSE_MODULES=ON .. @@ -423,7 +354,7 @@ $ make <p>cmake would download OpenBlas and Protobuf (2.6.1) and compile them together with SINGA.</p> <p>After compiling SINGA, you can run the unit tests by</p> -<div class="highlight-python"><div class="highlight"><pre>$ ./bin/test_singa +<div class="highlight-default"><div class="highlight"><pre><span></span>$ ./bin/test_singa </pre></div> </div> <p>You can see all the testing cases with testing results. If SINGA passes all @@ -431,15 +362,15 @@ tests, then you have successfully instal <p>You can use <code class="docutils literal"><span class="pre">ccmake</span> <span class="pre">..</span></code> to configure the compilation options. If some dependent libraries are not in the system default paths, you need to export the following environment variables</p> -<div class="highlight-python"><div class="highlight"><pre>export CMAKE_INCLUDE_PATH=<path to the header file folder> -export CMAKE_LIBRARY_PATH=<path to the lib file folder> +<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">export</span> <span class="n">CMAKE_INCLUDE_PATH</span><span class="o">=<</span><span class="n">path</span> <span class="n">to</span> <span class="n">the</span> <span class="n">header</span> <span class="n">file</span> <span class="n">folder</span><span class="o">></span> +<span class="n">export</span> <span class="n">CMAKE_LIBRARY_PATH</span><span class="o">=<</span><span class="n">path</span> <span class="n">to</span> <span class="n">the</span> <span class="n">lib</span> <span class="n">file</span> <span class="n">folder</span><span class="o">></span> </pre></div> </div> </div> <div class="section" id="compile-with-use-python-on"> <span id="compile-with-use-python-on"></span><h4>Compile with USE_PYTHON=ON<a class="headerlink" href="#compile-with-use-python-on" title="Permalink to this headline">¶</a></h4> <p>swig and numpy can be install by</p> -<div class="highlight-python"><div class="highlight"><pre>$ Ubuntu 14.04 and 16.04 +<div class="highlight-default"><div class="highlight"><pre><span></span>$ Ubuntu 14.04 and 16.04 $ sudo apt-get install python-numpy # Ubuntu 16.04 $ sudo apt-get install swig @@ -447,18 +378,18 @@ $ sudo apt-get install swig </div> <p>Note that swig has to be installed from source on Ubuntu 14.04. After installing numpy, export the header path of numpy.i as</p> -<div class="highlight-python"><div class="highlight"><pre>$ export CPLUS_INCLUDE_PATH=`python -c "import numpy; print numpy.get_include()"`:$CPLUS_INCLUDE_PATH +<div class="highlight-default"><div class="highlight"><pre><span></span>$ export CPLUS_INCLUDE_PATH=`python -c "import numpy; print numpy.get_include()"`:$CPLUS_INCLUDE_PATH </pre></div> </div> <p>Similar to compile CPP code, PySINGA is compiled by</p> -<div class="highlight-python"><div class="highlight"><pre>$ cmake -DUSE_PYTHON=ON .. +<div class="highlight-default"><div class="highlight"><pre><span></span>$ cmake -DUSE_PYTHON=ON .. $ make $ cd python $ pip install . </pre></div> </div> <p>Developers can build the wheel file via</p> -<div class="highlight-python"><div class="highlight"><pre># under the build directory +<div class="highlight-default"><div class="highlight"><pre><span></span># under the build directory $ cd python </pre></div> </div> @@ -472,13 +403,13 @@ get better performance.</p> <p>SINGA has been tested over CUDA (7, 7.5, 8), and cuDNN (4 and 5). If cuDNN is decompressed into non-system folder, e.g. /home/bob/local/cudnn/, the following commands should be executed for cmake and the runtime to find it</p> -<div class="highlight-python"><div class="highlight"><pre>$ export CMAKE_INCLUDE_PATH=/home/bob/local/cudnn/include:$CMAKE_INCLUDE_PATH +<div class="highlight-default"><div class="highlight"><pre><span></span>$ export CMAKE_INCLUDE_PATH=/home/bob/local/cudnn/include:$CMAKE_INCLUDE_PATH $ export CMAKE_LIBRARY_PATH=/home/bob/local/cudnn/lib64:$CMAKE_LIBRARY_PATH $ export LD_LIBRARY_PATH=/home/bob/local/cudnn/lib64:$LD_LIBRARY_PATH </pre></div> </div> <p>The cmake options for CUDA and cuDNN should be switched on</p> -<div class="highlight-python"><div class="highlight"><pre># Dependent libs are install already +<div class="highlight-default"><div class="highlight"><pre><span></span># Dependent libs are install already $ cmake -DUSE_CUDA=ON .. </pre></div> </div> @@ -487,7 +418,7 @@ $ cmake -DUSE_CUDA=ON .. <span id="compile-singa-with-use-opencl-on"></span><h4>Compile SINGA with USE_OPENCL=ON<a class="headerlink" href="#compile-singa-with-use-opencl-on" title="Permalink to this headline">¶</a></h4> <p>SINGA uses opencl-headers and viennacl (version 1.7.1 or newer) for OpenCL support, which can be installed using via</p> -<div class="highlight-python"><div class="highlight"><pre># On Ubuntu 16.04 +<div class="highlight-default"><div class="highlight"><pre><span></span># On Ubuntu 16.04 $ sudo apt-get install opencl-headers, libviennacl-dev # On Fedora $ sudo yum install opencl-headers, viennacl @@ -505,7 +436,7 @@ $ sudo yum install opencl-headers, vienn <p>Clone <a class="reference external" href="https://github.com/viennacl/viennacl-dev">the repository from here</a>, checkout the <code class="docutils literal"><span class="pre">release-1.7.1</span></code> tag and build it. Remember to add its directory to <code class="docutils literal"><span class="pre">PATH</span></code> and the built libraries to <code class="docutils literal"><span class="pre">LD_LIBRARY_PATH</span></code>.</p> <p>To build SINGA with OpenCL support, you need to pass the flag during cmake:</p> -<div class="highlight-python"><div class="highlight"><pre>cmake -DUSE_OPENCL=ON .. +<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">cmake</span> <span class="o">-</span><span class="n">DUSE_OPENCL</span><span class="o">=</span><span class="n">ON</span> <span class="o">..</span> </pre></div> </div> </div> @@ -515,13 +446,13 @@ Remember to add its directory to <code c <p>For the dependent library installation, please refer to <a class="reference external" href="dependencies.md">Dependencies</a>. After all the dependencies are successfully installed, just run the following commands to generate the VS solution in cmd under singa folder:</p> -<div class="highlight-python"><div class="highlight"><pre>$ md build && cd build +<div class="highlight-default"><div class="highlight"><pre><span></span>$ md build && cd build $ cmake -G "Visual Studio 14" -DUSE_CUDA=OFF -DUSE_PYTHON=OFF .. </pre></div> </div> <p>The default project generated by the command is 32-bit version. You can also specify a 64-bit version project by:</p> -<div class="highlight-python"><div class="highlight"><pre>$ md build && cd build +<div class="highlight-default"><div class="highlight"><pre><span></span>$ md build && cd build $ cmake -G "Visual Studio 14 Win64" -DUSE_CUDA=OFF -DUSE_PYTHON=OFF .. </pre></div> </div> @@ -530,12 +461,12 @@ library missing, configure your library For example, you get an error “Could NOT find CBLAS” and suppose you installed openblas header files at “d:\include” and openblas library at “d:\lib”. You should run the following command to specify your cblas parameters in cmake:</p> -<div class="highlight-python"><div class="highlight"><pre>$ cmake -G "Visual Studio 14" -DUSE_CUDA=OFF -DUSE_PYTHON=OFF -DCBLAS_INCLUDE_DIR="d:\include" -DCBLAS_LIBRARIES="d:\lib\libopenblas.lib" -DProtobuf_INCLUDE_DIR=<include dir of protobuf> -DProtobuf_LIBRARIES=<path to libprotobuf.lib> -DProtobuf_PROTOC_EXECUTABLE=<path to protoc.exe> -DGLOG_INCLUDE_DIR=<include dir of glog> -DGLOG_LIBRARIES=<path to libglog.lib> .. +<div class="highlight-default"><div class="highlight"><pre><span></span>$ cmake -G "Visual Studio 14" -DUSE_CUDA=OFF -DUSE_PYTHON=OFF -DCBLAS_INCLUDE_DIR="d:\include" -DCBLAS_LIBRARIES="d:\lib\libopenblas.lib" -DProtobuf_INCLUDE_DIR=<include dir of protobuf> -DProtobuf_LIBRARIES=<path to libprotobuf.lib> -DProtobuf_PROTOC_EXECUTABLE=<path to protoc.exe> -DGLOG_INCLUDE_DIR=<include dir of glog> -DGLOG_LIBRARIES=<path to libglog.lib> .. </pre></div> </div> <p>To find out the parameters you need to specify for some special libraries, you can run the following command:</p> -<div class="highlight-python"><div class="highlight"><pre>$ cmake -LAH +<div class="highlight-default"><div class="highlight"><pre><span></span>$ cmake -LAH </pre></div> </div> <p>If you use cmake GUI tool in windows, make sure you configure the right @@ -557,14 +488,14 @@ steps show the solutions for different c <ol> <li><p class="first">Check the cudnn and cuda and gcc versions, cudnn5 and cuda7.5 and gcc4.8/4.9 are preferred. if gcc is 5.0, then downgrade it. If cudnn is missing or not match with the wheel version, you can download the correct version of cudnn into ~/local/cudnn/ and</p> -<div class="highlight-python"><div class="highlight"><pre> $ echo "export LD_LIBRARY_PATH=/home/<yourname>/local/cudnn/lib64:$LD_LIBRARY_PATH" >> ~/.bashrc +<div class="highlight-default"><div class="highlight"><pre><span></span> $ echo "export LD_LIBRARY_PATH=/home/<yourname>/local/cudnn/lib64:$LD_LIBRARY_PATH" >> ~/.bashrc </pre></div> </div> </li> <li><p class="first">If it is the problem related to protobuf, then download the newest whl files which have <a class="reference external" href="https://issues.apache.org/jira/browse/SINGA-255">compiled protobuf and openblas into the whl</a> file of PySINGA. Or you can install protobuf from source into a local folder, say ~/local/; Decompress the tar file, and then</p> -<div class="highlight-python"><div class="highlight"><pre> $ ./configure --prefix=/home/<yourname>local +<div class="highlight-default"><div class="highlight"><pre><span></span> $ ./configure --prefix=/home/<yourname>local $ make && make install $ echo "export LD_LIBRARY_PATH=/home/<yourname>/local/lib:$LD_LIBRARY_PATH" >> ~/.bashrc $ source ~/.bashrc @@ -573,7 +504,7 @@ Decompress the tar file, and then</p> </li> <li><p class="first">If it cannot find other libs including python, then create virtual env using pip or conda; and then install SINGA via</p> -<div class="highlight-python"><div class="highlight"><pre> $ pip install --upgrade <url of singa wheel> +<div class="highlight-default"><div class="highlight"><pre><span></span> $ pip install --upgrade <url of singa wheel> </pre></div> </div> </li> @@ -585,7 +516,7 @@ and then install SINGA via</p> <p>A: If you haven’t installed the libraries, install them. If you installed the libraries in a folder that is outside of the system folder, e.g. /usr/local, you need to export the following variables</p> -<div class="highlight-python"><div class="highlight"><pre> $ export CMAKE_INCLUDE_PATH=<path to your header file folder> +<div class="highlight-default"><div class="highlight"><pre><span></span> $ export CMAKE_INCLUDE_PATH=<path to your header file folder> $ export CMAKE_LIBRARY_PATH=<path to your lib file folder> </pre></div> </div> @@ -595,7 +526,7 @@ you need to export the following variabl <li><p class="first">Q: Error from <code class="docutils literal"><span class="pre">make</span></code>, e.g. the linking phase</p> <p>A: If your libraries are in other folders than system default paths, you need to export the following varaibles</p> -<div class="highlight-python"><div class="highlight"><pre> $ export LIBRARY_PATH=<path to your lib file folder> +<div class="highlight-default"><div class="highlight"><pre><span></span> $ export LIBRARY_PATH=<path to your lib file folder> $ export LD_LIBRARY_PATH=<path to your lib file folder> </pre></div> </div> @@ -605,23 +536,23 @@ to export the following varaibles</p> <li><p class="first">Q: Error from header files, e.g. ‘cblas.h no such file or directory exists’</p> <p>A: You need to include the folder of the cblas.h into CPLUS_INCLUDE_PATH, e.g.,</p> -<div class="highlight-python"><div class="highlight"><pre> $ export CPLUS_INCLUDE_PATH=/opt/OpenBLAS/include:$CPLUS_INCLUDE_PATH +<div class="highlight-default"><div class="highlight"><pre><span></span> $ export CPLUS_INCLUDE_PATH=/opt/OpenBLAS/include:$CPLUS_INCLUDE_PATH </pre></div> </div> </li> <li><p class="first">Q:While compiling SINGA, I get error <code class="docutils literal"><span class="pre">SSE2</span> <span class="pre">instruction</span> <span class="pre">set</span> <span class="pre">not</span> <span class="pre">enabled</span></code></p> <p>A:You can try following command:</p> -<div class="highlight-python"><div class="highlight"><pre> $ make CFLAGS='-msse2' CXXFLAGS='-msse2' +<div class="highlight-default"><div class="highlight"><pre><span></span> $ make CFLAGS='-msse2' CXXFLAGS='-msse2' </pre></div> </div> </li> <li><p class="first">Q:I get <code class="docutils literal"><span class="pre">ImportError:</span> <span class="pre">cannot</span> <span class="pre">import</span> <span class="pre">name</span> <span class="pre">enum_type_wrapper</span></code> from google.protobuf.internal when I try to import .py files.</p> <p>A: You need to install the python binding of protobuf, which could be installed via</p> -<div class="highlight-python"><div class="highlight"><pre> $ sudo apt-get install protobuf +<div class="highlight-default"><div class="highlight"><pre><span></span> $ sudo apt-get install protobuf </pre></div> </div> <p>or from source</p> -<div class="highlight-python"><div class="highlight"><pre> $ cd /PROTOBUF/SOURCE/FOLDER +<div class="highlight-default"><div class="highlight"><pre><span></span> $ cd /PROTOBUF/SOURCE/FOLDER $ cd python $ python setup.py build $ python setup.py install @@ -630,11 +561,11 @@ e.g.,</p> </li> <li><p class="first">Q: When I build OpenBLAS from source, I am told that I need a Fortran compiler.</p> <p>A: You can compile OpenBLAS by</p> -<div class="highlight-python"><div class="highlight"><pre> $ make ONLY_CBLAS=1 +<div class="highlight-default"><div class="highlight"><pre><span></span> $ make ONLY_CBLAS=1 </pre></div> </div> <p>or install it using</p> -<div class="highlight-python"><div class="highlight"><pre> $ sudo apt-get install libopenblas-dev +<div class="highlight-default"><div class="highlight"><pre><span></span> $ sudo apt-get install libopenblas-dev </pre></div> </div> </li> @@ -647,20 +578,20 @@ must be told how to find the newer libst The simplest way to fix this is to find the correct libstdc++ and export it to LD_LIBRARY_PATH. For example, if GLIBC++_3.4.20 is listed in the output of the following command,</p> -<div class="highlight-python"><div class="highlight"><pre> $ strings /usr/local/lib64/libstdc++.so.6|grep GLIBC++ +<div class="highlight-default"><div class="highlight"><pre><span></span> $ strings /usr/local/lib64/libstdc++.so.6|grep GLIBC++ </pre></div> </div> <p>then you just set your environment variable as</p> -<div class="highlight-python"><div class="highlight"><pre> $ export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH +<div class="highlight-default"><div class="highlight"><pre><span></span> $ export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH </pre></div> </div> </li> <li><p class="first">Q: When I build glog, it reports that “src/logging_unittest.cc:83:20: error: âgflagsâ is not a namespace-name”</p> <p>A: It maybe that you have installed gflags with a different namespace such as “google”. so glog can’t find ‘gflags’ namespace. Because it is not necessary to have gflags to build glog. So you can change the configure.ac file to ignore gflags.</p> -<div class="highlight-python"><div class="highlight"><pre> 1. cd to glog src directory - 2. change line 125 of configure.ac to "AC_CHECK_LIB(gflags, main, ac_cv_have_libgflags=0, ac_cv_have_libgflags=0)" - 3. autoreconf +<div class="highlight-default"><div class="highlight"><pre><span></span> <span class="mf">1.</span> <span class="n">cd</span> <span class="n">to</span> <span class="n">glog</span> <span class="n">src</span> <span class="n">directory</span> + <span class="mf">2.</span> <span class="n">change</span> <span class="n">line</span> <span class="mi">125</span> <span class="n">of</span> <span class="n">configure</span><span class="o">.</span><span class="n">ac</span> <span class="n">to</span> <span class="s2">"AC_CHECK_LIB(gflags, main, ac_cv_have_libgflags=0, ac_cv_have_libgflags=0)"</span> + <span class="mf">3.</span> <span class="n">autoreconf</span> </pre></div> </div> <p>After this, you can build glog again.</p> @@ -671,7 +602,7 @@ the virtual environment.</p> </li> <li><p class="first">Q: When compiling PySINGA from source, there is a compilation error due to the missing of <numpy/objectarray.h></p> <p>A: Please install numpy and export the path of numpy header files as</p> -<div class="highlight-python"><div class="highlight"><pre> $ export CPLUS_INCLUDE_PATH=`python -c "import numpy; print numpy.get_include()"`:$CPLUS_INCLUDE_PATH +<div class="highlight-default"><div class="highlight"><pre><span></span> $ export CPLUS_INCLUDE_PATH=`python -c "import numpy; print numpy.get_include()"`:$CPLUS_INCLUDE_PATH </pre></div> </div> </li> @@ -681,7 +612,7 @@ e.g, the one comes with the OS and the o You can check your interpreter by <code class="docutils literal"><span class="pre">which</span> <span class="pre">python</span></code> and check the Python linked by PySINGA via <code class="docutils literal"><span class="pre">otool</span> <span class="pre">-L</span> <span class="pre"><path</span> <span class="pre">to</span> <span class="pre">_singa_wrap.so></span></code>. To fix this error, compile SINGA with the correct version of Python. In particular, if you build PySINGA from source, you need to specify the paths when invoking <a class="reference external" href="http://stackoverflow.com/questions/15291500/i-have-2-versions-of-python-installed-but-cmake-is-using-older-version-how-do">cmake</a></p> -<div class="highlight-python"><div class="highlight"><pre> $ cmake -DPYTHON_LIBRARY=`python-config --prefix`/lib/libpython2.7.dylib -DPYTHON_INCLUDE_DIR=`python-config --prefix`/include/python2.7/ .. +<div class="highlight-default"><div class="highlight"><pre><span></span> $ cmake -DPYTHON_LIBRARY=`python-config --prefix`/lib/libpython2.7.dylib -DPYTHON_INCLUDE_DIR=`python-config --prefix`/include/python2.7/ .. </pre></div> </div> <p>If installed PySINGA from binary packages, e.g. debian or wheel, then you need to change the python interpreter, e.g., reset the $PATH to put the correct path of Python at the front position.</p>
