blob: 7f59cc8e4d3a0701e2047676f995e84c7492f71b [file] [log] [blame]
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ソースからのビルド &mdash; incubator-singa 0.3.0 documentation</title>
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="top" title="incubator-singa 0.3.0 documentation" href="../index.html"/>
<script src="../_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="../index.html" class="icon icon-home"> incubator-singa
<img src="../_static/singa.png" class="logo" />
</a>
<div class="version">
0.3.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul>
<li class="toctree-l1"><a class="reference internal" href="index.html">ドキュメント</a></li>
</ul>
<p class="caption"><span class="caption-text">Development</span></p>
<ul class="simple">
</ul>
<p class="caption"><span class="caption-text">Community</span></p>
<ul class="simple">
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">incubator-singa</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html">Docs</a> &raquo;</li>
<li>ソースからのビルド</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="">
<span id="id1"></span><h1>ソースからのビルド<a class="headerlink" href="#" title="Permalink to this headline"></a></h1>
<hr class="docutils" />
<div class="section" id="dependencies">
<span id="dependencies"></span><h2>Dependencies (依存性)<a class="headerlink" href="#dependencies" title="Permalink to this headline"></a></h2>
<p>SINGA は Linux プラットフォームで開発されました。</p>
<p>下記のライブラリを必要とします。ご確認ください。</p>
<ul class="simple">
<li>glog version 0.3.3</li>
<li>google-protobuf version 2.6.0</li>
<li>openblas version &gt;= 0.2.10</li>
<li>zeromq version &gt;= 3.2</li>
<li>czmq version &gt;= 3</li>
<li>zookeeper version 3.4.6</li>
</ul>
<p>オプション</p>
<ul class="simple">
<li>lmdb version 0.9.10</li>
</ul>
<p>すべての Dependencies をインストールするには</p>
<div class="highlight-default"><div class="highlight"><pre><span></span># thirdparty フォルダに移動
cd thirdparty
./install.sh all $PREFIX
</pre></div>
</div>
<p>$PREFIX がシステムパス (例 /usr/local/) でない場合は、下記の変数を exportコマンドで設定してください。</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>export LD_LIBRARY_PATH=$PREFIX/lib:$LD_LIBRARY_PATH
export CPLUS_INCLUDE_PATH=$PREFIX/include:$CPLUS_INCLUDE_PATH
export LIBRARY_PATH=$PREFIX/lib:$LIBRARY_PATH
export PATH=$PREFIX/bin:$PATH
</pre></div>
</div>
<p>インストールスクリプトの詳細は、このページの下にあります。</p>
</div>
<div class="section" id="">
<span id="id2"></span><h2>ソースからのビルド<a class="headerlink" href="#" title="Permalink to this headline"></a></h2>
<p>GNU autotools を使用します。まずは GCC (version &gt;= 4.8) のバージョンを確認してください。</p>
<p>SINGA をビルドする2つの方法を用意しました。</p>
<ul>
<li><p class="first">Git コマンドを使用して <a class="reference external" href="https://github.com/apache/incubator-singa.git">Github</a> から最新のソースコード(レポジトリ)をクローンし、次のコマンドを実行します。</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ git clone git@github.com:apache/incubator-singa.git
$ cd incubator-singa
$ ./autogen.sh
$ ./configure
$ make
</pre></div>
</div>
</li>
</ul>
<p>Note: <a class="reference external" href="https://github.com/orgs/nusinga">nusinga</a> アカウントの singa repository は Apache Incubator project として使用していたものなので、最新ではありません。ご注意ください。</p>
<ul>
<li><p class="first">Release パッケージをダウンロードし、次のコマンドを実行します。</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ tar xvf singa-xxx
$ cd singa-xxx
$ ./configure
$ make
</pre></div>
</div>
<p>ある機能は外部ライブラリに依存します。
それらの機能を利用するために、<code class="docutils literal"><span class="pre">--enable-&lt;feature&gt;</span></code> を付けてコンパイルしてください。
例えば、lmdb サポートを追加するには</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ ./configure --enable-lmdb
</pre></div>
</div>
</li>
</ul>
<!---
Zhongle: please update the code to use the follow command<div class="highlight-default"><div class="highlight"><pre><span></span>$ make test
</pre></div>
</div>
<p>After compilation, you will find the binary file singatest. Just run it!
More details about configure script can be found by running:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span> $ ./configure -h
</pre></div>
</div>
<p>&#8211;&gt;</p>
<p>うまくコンパイルが成功すると、<em>.libs/</em> フォルダ内に <em>libsinga.so</em> と実行ファイル <em>singa</em> が生成されます。</p>
<p>特定の dependent ライブラリが見つからない場合、次のスクリプトを実行してください。</p>
<!---
to be updated after zhongle changes the code to use<div class="highlight-default"><div class="highlight"><pre><span></span><span class="o">./</span><span class="n">install</span><span class="o">.</span><span class="n">sh</span> <span class="n">libname</span> \<span class="o">-</span>\<span class="o">-</span><span class="n">prefix</span><span class="o">=</span>
</pre></div>
</div>
<p>&#8211;&gt;
# thirdparty フォルダに移動
$ cd thirdparty
$ ./install.sh LIB_NAME PREFIX</p>
<p>インストールパスを指定しない場合、ライブラリは(ソフトウェアが指定した)デフォルトのフォルダにインストールされます。
例えば、デフォルトのフォルダに <code class="docutils literal"><span class="pre">zeromq</span></code> ライブラリをインストールするには、次のコマンドを</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ ./install.sh zeromq
</pre></div>
</div>
<p>別のフォルダ(e.g., PREFIX)にインストールするには、次のコマンドを</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ ./install.sh zeromq PREFIX
</pre></div>
</div>
<p><em>/usr/local</em> フォルダにすべての Dependencies をインストールするには、次のコマンドを</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ ./install.sh all /usr/local
</pre></div>
</div>
<p>ライブラリ名(LIB_NAME)は以下のとおりです。</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>LIB_NAME Library
czmq(注)  czmq lib
glog glog lib
lmdb lmdb lib
OpenBLAS OpenBLAS lib
protobuf Google protobuf
zeromq zeromq lib
zookeeper Apache zookeeper
</pre></div>
</div>
<p>(注) <code class="docutils literal"><span class="pre">czmq</span></code> をインストールする時、<code class="docutils literal"><span class="pre">zeromq</span></code> のパスを -f オプションで指定する必要があります。
コマンドは次のとおりです。</p>
<!---
to be updated to<div class="highlight-default"><div class="highlight"><pre><span></span>$./install.sh czmq \-\-prefix=/usr/local \-\-zeromq=/usr/local/zeromq
</pre></div>
</div>
<p>&#8211;&gt;</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$./install.sh czmq /usr/local -f=/usr/local/zeromq
</pre></div>
</div>
<p>結果、<em>/usr/local</em> フォルダに <code class="docutils literal"><span class="pre">czmq</span></code> がインストールされます。</p>
<div class="section" id="faq">
<span id="faq"></span><h3>FAQ<a class="headerlink" href="#faq" title="Permalink to this headline">¶</a></h3>
<ul>
<li><p class="first">Q1:I get error <code class="docutils literal"><span class="pre">./configure</span> <span class="pre">--&gt;</span> <span class="pre">cannot</span> <span class="pre">find</span> <span class="pre">blas_segmm()</span> <span class="pre">function</span></code> even I
have installed OpenBLAS.</p>
<p>A1: This means the compiler cannot find the <code class="docutils literal"><span class="pre">OpenBLAS</span></code> library. If you installed
it to $PREFIX (e.g., /opt/OpenBLAS), then you need to export it as</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ export LIBRARY_PATH=$PREFIX/lib:$LIBRARY_PATH
# e.g.,
$ export LIBRARY_PATH=/opt/OpenBLAS/lib:$LIBRARY_PATH
</pre></div>
</div>
</li>
</ul>
<ul>
<li><p class="first">Q2: I get error <code class="docutils literal"><span class="pre">cblas.h</span> <span class="pre">no</span> <span class="pre">such</span> <span class="pre">file</span> <span class="pre">or</span> <span class="pre">directory</span> <span class="pre">exists</span></code>.</p>
<p>Q2: You need to include the folder of the cblas.h into CPLUS_INCLUDE_PATH,
e.g.,</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ export CPLUS_INCLUDE_PATH=$PREFIX/include:$CPLUS_INCLUDE_PATH
# e.g.,
$ export CPLUS_INCLUDE_PATH=/opt/OpenBLAS/include:$CPLUS_INCLUDE_PATH
# then reconfigure and make SINGA
$ ./configure
$ make
</pre></div>
</div>
</li>
</ul>
<ul>
<li><p class="first">Q3: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>A3:You can try following command:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ make CFLAGS=&#39;-msse2&#39; CXXFLAGS=&#39;-msse2&#39;
</pre></div>
</div>
</li>
</ul>
<ul>
<li><p class="first">Q4: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>A4:After install google protobuf by <code class="docutils literal"><span class="pre">make</span> <span class="pre">install</span></code>, we should install python
runtime libraries. Go to protobuf source directory, run:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ cd /PROTOBUF/SOURCE/FOLDER
$ cd python
$ python setup.py build
$ python setup.py install
</pre></div>
</div>
<p>You may need <code class="docutils literal"><span class="pre">sudo</span></code> when you try to install python runtime libraries in
the system folder.</p>
</li>
</ul>
<ul>
<li><p class="first">Q5: I get a linking error caused by gflags.</p>
<p>A5: SINGA does not depend on gflags. But you may have installed the glog with
gflags. In that case you can reinstall glog using <em>thirdparty/install.sh</em> into
a another folder and export the LDFLAGS and CPPFLAGS to include that folder.</p>
</li>
</ul>
<ul>
<li><p class="first">Q6: While compiling SINGA and installing <code class="docutils literal"><span class="pre">glog</span></code> on mac OS X, I get fatal error
<code class="docutils literal"><span class="pre">'ext/slist'</span> <span class="pre">file</span> <span class="pre">not</span> <span class="pre">found</span></code></p>
<p>A6:Please install <code class="docutils literal"><span class="pre">glog</span></code> individually and try :</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ make CFLAGS=&#39;-stdlib=libstdc++&#39; CXXFLAGS=&#39;stdlib=libstdc++&#39;
</pre></div>
</div>
</li>
<li><p class="first">Q7: When I start a training job, it reports error related with &#8220;ZOO_ERROR...zk retcode=-4...&#8221;.</p>
<p>A7: This is because the zookeeper is not started. Please start the zookeeper service</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ ./bin/zk-service start
</pre></div>
</div>
<p>If the error still exists, probably that you do not have java. You can simple
check it by</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ java --version
</pre></div>
</div>
</li>
<li><p class="first">Q8: When I build OpenBLAS from source, I am told that I need a fortran compiler.</p>
<p>A8: You can compile OpenBLAS by</p>
<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-default"><div class="highlight"><pre><span></span> $ sudo apt-get install openblas-dev
</pre></div>
</div>
<p>or</p>
<div class="highlight-default"><div class="highlight"><pre><span></span> $ sudo yum install openblas-devel
</pre></div>
</div>
<p>It is worth noting that you need root access to run the last two commands.
Remember to set the environment variables to include the header and library
paths of OpenBLAS after installation (please refer to the Dependencies section).</p>
</li>
<li><p class="first">Q9: When I build protocol buffer, it reports that GLIBC++_3.4.20 not found in /usr/lib64/libstdc++.so.6.</p>
<p>A9: This means the linker found libstdc++.so.6 but that library
belongs to an older version of GCC than was used to compile and link the
program. The program depends on code defined in
the newer libstdc++ that belongs to the newer version of GCC, so the linker
must be told how to find the newer libstdc++ shared library.
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-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-default"><div class="highlight"><pre><span></span>$ export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH
</pre></div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2016 The Apache Software Foundation. All rights reserved. Apache Singa, Apache, the Apache feather logo, and the Apache Singa project logos are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners..
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../',
VERSION:'0.3.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
<div class="rst-versions shift-up" data-toggle="rst-versions" role="note" aria-label="versions">
<img src="../_static/apache.jpg">
<span class="rst-current-version" data-toggle="rst-current-version">
<span class="fa fa-book"> incubator-singa </span>
v: 0.3.0
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
<dl>
<dt>Languages</dt>
<dd><a href="../../en/index.html">English</a></dd>
<dd><a href="../../zh/index.html">中文</a></dd>
<dd><a href="../../jp/index.html">日本語</a></dd>
<dd><a href="../../kr/index.html">한국어</a></dd>
</dl>
</div>
</div>
<a href="https://github.com/apache/incubator-singa">
<img style="position: absolute; top: 0; right: 0; border: 0; z-index: 10000;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"
alt="Fork me on GitHub">
</a>
</body>
</html>