blob: 65cb9c4b6f7d1208327e495cc2a562c64f2162df [file] [log] [blame]
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Build SINGA from Source · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="&lt;!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --&gt;"/><meta name="docsearch:version" content="next"/><meta name="docsearch:language" content="en"/><meta property="og:title" content="Build SINGA from Source · Apache SINGA"/><meta property="og:type" content="website"/><meta property="og:url" content="https://feynmandna.github.io/"/><meta property="og:description" content="&lt;!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --&gt;"/><meta property="og:image" content="https://feynmandna.github.io/img/singa_twitter_banner.jpeg"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://feynmandna.github.io/img/singa_twitter_banner.jpeg"/><link rel="shortcut icon" href="/img/favicon.ico"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://feynmandna.github.io/blog/atom.xml" title="Apache SINGA Blog ATOM Feed"/><link rel="alternate" type="application/rss+xml" href="https://feynmandna.github.io/blog/feed.xml" title="Apache SINGA Blog RSS Feed"/><script type="text/javascript" src="https://buttons.github.io/buttons.js"></script><script src="https://unpkg.com/vanilla-back-to-top@7.1.14/dist/vanilla-back-to-top.min.js"></script><script>
document.addEventListener('DOMContentLoaded', function() {
addBackToTop(
{"zIndex":100}
)
});
</script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>next</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-internal"><li class="siteNavGroupActive"><a href="/docs/next/installation" target="_self">Docs</a></li><li class=""><a href="/docs/next/source-repository" target="_self">Community</a></li><li class=""><a href="/blog/" target="_self">News</a></li><li class=""><a href="https://apache-singa.readthedocs.io/en/latest/" target="_self">API</a></li><li class=""><a target="_self"></a></li><li class=""><a href="https://github.com/apache/singa-doc" target="_self">GitHub</a></li></ul></nav></div></header></div></div><div class="navPusher"><div class="docMainWrapper wrapper"><div class="docsNavContainer" id="docsNav"><nav class="toc"><div class="toggleNav"><section class="navWrapper wrapper"><div class="navBreadcrumb wrapper"><div class="navToggle" id="navToggler"><div class="hamburger-menu"><div class="line1"></div><div class="line2"></div><div class="line3"></div></div></div><h2><i></i><span>Development</span></h2><div class="tocToggler" id="tocToggler"><i class="icon-toc"></i></div></div><div class="navGroups"><div class="navGroup"><h3 class="navGroupCategoryTitle">Getting Started</h3><ul class=""><li class="navListItem"><a class="navItem" href="/docs/next/installation">Installation</a></li><li class="navListItem"><a class="navItem" href="/docs/next/software-stack">Software Stack</a></li><li class="navListItem"><a class="navItem" href="/docs/next/examples">Examples</a></li></ul></div><div class="navGroup"><h3 class="navGroupCategoryTitle">Guides</h3><ul class=""><li class="navListItem"><a class="navItem" href="/docs/next/device">Device</a></li><li class="navListItem"><a class="navItem" href="/docs/next/tensor">Tensor</a></li><li class="navListItem"><a class="navItem" href="/docs/next/autograd">Autograd</a></li><li class="navListItem"><a class="navItem" href="/docs/next/graph">Computational Graph</a></li><li class="navListItem"><a class="navItem" href="/docs/next/dist-train">Distributed Training</a></li></ul></div><div class="navGroup"><h3 class="navGroupCategoryTitle">Development</h3><ul class=""><li class="navListItem"><a class="navItem" href="/docs/next/download-singa">Download SINGA</a></li><li class="navListItem navListItemActive"><a class="navItem" href="/docs/next/build">Build SINGA from Source</a></li><li class="navListItem"><a class="navItem" href="/docs/next/contribute-code">How to Contribute Code</a></li><li class="navListItem"><a class="navItem" href="/docs/next/contribute-docs">How to Contribute to Documentation</a></li><li class="navListItem"><a class="navItem" href="/docs/next/how-to-release">How to Prepare a Release</a></li><li class="navListItem"><a class="navItem" href="/docs/next/git-workflow">Git Workflow</a></li></ul></div></div></section></div><script>
var coll = document.getElementsByClassName('collapsible');
var checkActiveCategory = true;
for (var i = 0; i < coll.length; i++) {
var links = coll[i].nextElementSibling.getElementsByTagName('*');
if (checkActiveCategory){
for (var j = 0; j < links.length; j++) {
if (links[j].classList.contains('navListItemActive')){
coll[i].nextElementSibling.classList.toggle('hide');
coll[i].childNodes[1].classList.toggle('rotate');
checkActiveCategory = false;
break;
}
}
}
coll[i].addEventListener('click', function() {
var arrow = this.childNodes[1];
arrow.classList.toggle('rotate');
var content = this.nextElementSibling;
content.classList.toggle('hide');
});
}
document.addEventListener('DOMContentLoaded', function() {
createToggler('#navToggler', '#docsNav', 'docsSliderActive');
createToggler('#tocToggler', 'body', 'tocActive');
var headings = document.querySelector('.toc-headings');
headings && headings.addEventListener('click', function(event) {
var el = event.target;
while(el !== headings){
if (el.tagName === 'A') {
document.body.classList.remove('tocActive');
break;
} else{
el = el.parentNode;
}
}
}, false);
function createToggler(togglerSelector, targetSelector, className) {
var toggler = document.querySelector(togglerSelector);
var target = document.querySelector(targetSelector);
if (!toggler) {
return;
}
toggler.onclick = function(event) {
event.preventDefault();
target.classList.toggle(className);
};
}
});
</script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs/build.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Build SINGA from Source</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->
<p>The source files could be downloaded either as a
<a href="https://dist.apache.org/repos/dist/dev/singa/">tar.gz file</a>, or as a git repo</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/singa.git</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> singa/</span>
</code></pre>
<p>If you want to contribute code to SINGA, refer to
<a href="/docs/next/contribute-code">contribute-code page</a> for the steps and requirements.</p>
<h2><a class="anchor" aria-hidden="true" id="use-conda-to-build-singa"></a><a href="#use-conda-to-build-singa" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Use Conda to build SINGA</h2>
<p>Conda-build is a building tool that installs the dependent libraries from
anaconda cloud and executes the building scripts.</p>
<p>To install conda-build (after installing conda)</p>
<pre><code class="hljs css language-shell">conda install conda-build
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="build-cpu-version"></a><a href="#build-cpu-version" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Build CPU Version</h3>
<p>To build the CPU version of SINGA</p>
<pre><code class="hljs css language-shell">conda build tool/conda/singa/
</code></pre>
<p>The above commands have been tested on Ubuntu (14.04, 16.04 and 18.04) and macOS
10.11. Refer to the <a href="https://travis-ci.org/apache/singa">Travis-CI page</a> for
more information.</p>
<h3><a class="anchor" aria-hidden="true" id="build-gpu-version"></a><a href="#build-gpu-version" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Build GPU Version</h3>
<p>To build the GPU version of SINGA, the building machine must have Nvida GPU, and
the CUDA driver (&gt;= 384.81), CUDA toolkit (&gt;=9) and cuDNN (&gt;=7) must have be
installed. The following two Docker images provide the building environment:</p>
<ol>
<li>apache/singa:conda-cuda9.0</li>
<li>apache/singa:conda-cuda10.0</li>
</ol>
<p>Once the building environment is ready, you need to export the CUDA version
first, and then run conda command to build SINGA</p>
<pre><code class="hljs css language-shell">export CUDA=x.y (e.g. 9.0)
conda build tool/conda/singa/
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="post-processing"></a><a href="#post-processing" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Post Processing</h3>
<p>The location of the generated package file (<code>.tar.gz</code>) is shown on the screen.
The generated package can be installed directly,</p>
<pre><code class="hljs css language-shell">conda install -c conda-forge --use-local &lt;path to the package file&gt;
</code></pre>
<p>or uploaded to anaconda cloud for others to download and install. You need to
register an account on anaconda for
<a href="https://docs.anaconda.com/anaconda-cloud/user-guide/getting-started/">uploading the package</a>.</p>
<pre><code class="hljs css language-shell">conda install anaconda-client
anaconda login
anaconda upload -l main &lt;path to the package file&gt;
</code></pre>
<p>After uploading the package to the cloud, you can see it on
<a href="https://anaconda.org/">Anaconda Cloud</a> website or via the following command</p>
<pre><code class="hljs css language-shell">conda search -c &lt;anaconda username&gt; singa
</code></pre>
<p>Each specific SINGA package is identified by the version and build string. To
install a specific SINGA package, you need to provide all the information, e.g.,</p>
<pre><code class="hljs css language-shell">conda install -c &lt;anaconda username&gt; -c conda-forge singa=2.1.0.dev=cpu_py36
</code></pre>
<p>To make the installation command simple, you can create the following additional
packages which depend on the latest CPU and GPU SINGA packages.</p>
<pre><code class="hljs css language-console"><span class="hljs-meta">#</span><span class="bash"> <span class="hljs-keyword">for</span> singa-cpu</span>
conda build tool/conda/cpu/ --python=3.6
conda build tool/conda/cpu/ --python=3.7
<span class="hljs-meta">#</span><span class="bash"> <span class="hljs-keyword">for</span> singa-gpu</span>
conda build tool/conda/gpu/ --python=3.6
conda build tool/conda/gpu/ --python=3.7
</code></pre>
<p>Therefore, when you run</p>
<pre><code class="hljs css language-shell">conda install -c &lt;anaconda username&gt; -c conda-forge singa-xpu
</code></pre>
<p>(<code>xpu</code> is either 'cpu' or 'gpu'), the corresponding real SINGA package is
installed as the dependent library.</p>
<h2><a class="anchor" aria-hidden="true" id="use-native-tools-to-build-singa-on-ubuntu"></a><a href="#use-native-tools-to-build-singa-on-ubuntu" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Use native tools to build SINGA on Ubuntu</h2>
<p>Refer to SINGA
<a href="https://github.com/apache/singa/blob/master/tool/docker/devel/ubuntu/cuda9/Dockerfile#L30">Dockerfiles</a>
for the instructions of installing the dependent libraries on Ubuntu 16.04. You
can also create a Docker container using the <a href="">devel images</a> and build SINGA
inside the container. To build SINGA with GPU, DNNL, Python and unit tests, run
the following instructions</p>
<pre><code class="hljs css language-shell">mkdir build # at the root of singa folder
cd build
cmake -DENABLE_TEST=ON -DUSE_CUDA=ON -DUSE_DNNL=ON -DUSE_PYTHON3=ON ..
make
cd python
pip install .
</code></pre>
<p>The details of the CMake options are explained in the last section of this page.
The last command install the Python package. You can also run
<code>pip install -e .</code>, which creates symlinks instead of copying the Python files
into the site-package folder.</p>
<p>If SINGA is compiled with ENABLE_TEST=ON, you can run the unit tests by</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> ./bin/test_singa</span>
</code></pre>
<p>You can see all the testing cases with testing results. If SINGA passes all
tests, then you have successfully installed SINGA.</p>
<h2><a class="anchor" aria-hidden="true" id="use-native-tools-to-build-singa-on-centos7"></a><a href="#use-native-tools-to-build-singa-on-centos7" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Use native tools to Build SINGA on Centos7</h2>
<p>Building from source will be different for Centos7 as package names
differ.Follow the instructions given below.</p>
<h3><a class="anchor" aria-hidden="true" id="installing-dependencies"></a><a href="#installing-dependencies" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Installing dependencies</h3>
<p>Basic packages/libraries</p>
<pre><code class="hljs css language-shell">sudo yum install freetype-devel libXft-devel ncurses-devel openblas-devel blas-devel lapack devel atlas-devel kernel-headers unzip wget pkgconfig zip zlib-devel libcurl-devel cmake curl unzip dh-autoreconf git python-devel glog-devel protobuf-devel
</code></pre>
<p>For build-essential</p>
<pre><code class="hljs css language-shell">sudo yum group install "Development Tools"
</code></pre>
<p>For installing swig</p>
<pre><code class="hljs css language-shell">sudo yum install pcre-devel
wget http://prdownloads.sourceforge.net/swig/swig-3.0.10.tar.gz
tar xvzf swig-3.0.10.tar.gz
cd swig-3.0.10.tar.gz
./configure --prefix=${RUN}
make
make install
</code></pre>
<p>For installing gfortran</p>
<pre><code class="hljs css language-shell">sudo yum install centos-release-scl-rh
sudo yum --enablerepo=centos-sclo-rh-testing install devtoolset-7-gcc-gfortran
</code></pre>
<p>For installing pip and other packages</p>
<pre><code class="hljs css language-shell">sudo yum install epel-release
sudo yum install python-pip
pip install matplotlib numpy pandas scikit-learn pydot
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="installation"></a><a href="#installation" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Installation</h3>
<p>Follow steps 1-5 of <em>Use native tools to build SINGA on Ubuntu</em></p>
<h3><a class="anchor" aria-hidden="true" id="testing"></a><a href="#testing" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Testing</h3>
<p>You can run the unit tests by,</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> ./bin/test_singa</span>
</code></pre>
<p>You can see all the testing cases with testing results. If SINGA passes all
tests, then you have successfully installed SINGA.</p>
<h2><a class="anchor" aria-hidden="true" id="compile-singa-on-windows"></a><a href="#compile-singa-on-windows" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Compile SINGA on Windows</h2>
<p>Instructions for building on Windows with Python support can be found
<a href="/docs/next/install-win">install-win page</a>.</p>
<h2><a class="anchor" aria-hidden="true" id="more-details-about-the-compilation-options"></a><a href="#more-details-about-the-compilation-options" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>More details about the compilation options</h2>
<h3><a class="anchor" aria-hidden="true" id="use_modules-deprecated"></a><a href="#use_modules-deprecated" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>USE_MODULES (deprecated)</h3>
<p>If protobuf and openblas are not installed, you can compile SINGA together with
them</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> In SINGA ROOT folder</span>
<span class="hljs-meta">$</span><span class="bash"> mkdir build</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> build</span>
<span class="hljs-meta">$</span><span class="bash"> cmake -DUSE_MODULES=ON ..</span>
<span class="hljs-meta">$</span><span class="bash"> make</span>
</code></pre>
<p>cmake would download OpenBlas and Protobuf (2.6.1) and compile them together
with SINGA.</p>
<p>You can use <code>ccmake ..</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>
<pre><code class="hljs css language-shell">export CMAKE_INCLUDE_PATH=&lt;path to the header file folder&gt;
export CMAKE_LIBRARY_PATH=&lt;path to the lib file folder&gt;
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="use_python"></a><a href="#use_python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>USE_PYTHON</h3>
<p>Option for compiling the Python wrapper for SINGA,</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> cmake -DUSE_PYTHON=ON ..</span>
<span class="hljs-meta">$</span><span class="bash"> make</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> python</span>
<span class="hljs-meta">$</span><span class="bash"> pip install .</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="use_cuda"></a><a href="#use_cuda" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>USE_CUDA</h3>
<p>Users are encouraged to install the CUDA and
<a href="https://developer.nvidia.com/cudnn">cuDNN</a> for running SINGA on GPUs to get
better performance.</p>
<p>SINGA has been tested over CUDA 9/10, and cuDNN 7. If cuDNN is installed 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>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> CMAKE_INCLUDE_PATH=/home/bob/<span class="hljs-built_in">local</span>/cudnn/include:<span class="hljs-variable">$CMAKE_INCLUDE_PATH</span></span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> CMAKE_LIBRARY_PATH=/home/bob/<span class="hljs-built_in">local</span>/cudnn/lib64:<span class="hljs-variable">$CMAKE_LIBRARY_PATH</span></span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> LD_LIBRARY_PATH=/home/bob/<span class="hljs-built_in">local</span>/cudnn/lib64:<span class="hljs-variable">$LD_LIBRARY_PATH</span></span>
</code></pre>
<p>The cmake options for CUDA and cuDNN should be switched on</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">#</span><span class="bash"> Dependent libs are install already</span>
<span class="hljs-meta">$</span><span class="bash"> cmake -DUSE_CUDA=ON ..</span>
<span class="hljs-meta">$</span><span class="bash"> make</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="use_dnnl"></a><a href="#use_dnnl" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>USE_DNNL</h3>
<p>User can enable DNNL to enhance the performance of CPU computation.</p>
<p>Installation guide of DNNL could be found
<a href="https://github.com/intel/mkl-dnn#installation">here</a>.</p>
<p>SINGA has been tested over DNNL v1.1.</p>
<p>To build SINGA with DNNL support:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">#</span><span class="bash"> Dependent libs are installed already</span>
<span class="hljs-meta">$</span><span class="bash"> cmake -DUSE_DNNL=ON ..</span>
<span class="hljs-meta">$</span><span class="bash"> make</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="use_opencl"></a><a href="#use_opencl" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>USE_OPENCL</h3>
<p>SINGA uses opencl-headers and viennacl (version 1.7.1 or newer) for OpenCL
support, which can be installed using via</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">#</span><span class="bash"> On Ubuntu 16.04</span>
<span class="hljs-meta">$</span><span class="bash"> sudo apt-get install opencl-headers, libviennacl-dev</span>
<span class="hljs-meta">#</span><span class="bash"> On Fedora</span>
<span class="hljs-meta">$</span><span class="bash"> sudo yum install opencl-headers, viennacl</span>
</code></pre>
<p>Additionally, you will need the OpenCL Installable Client Driver (ICD) for the
platforms that you want to run OpenCL on.</p>
<ul>
<li>For AMD and nVidia GPUs, the driver package should also install the correct
OpenCL ICD.</li>
<li>For Intel CPUs and/or GPUs, get the driver from the
<a href="https://software.intel.com/en-us/articles/opencl-drivers">Intel website.</a>
Note that the drivers provided on that website only supports recent CPUs and
Iris GPUs.</li>
<li>For older Intel CPUs, you can use the <code>beignet-opencl-icd</code> package.</li>
</ul>
<p>Note that running OpenCL on CPUs is not currently recommended because it is
slow. Memory transfer is on the order of whole seconds (1000's of ms on CPUs as
compared to 1's of ms on GPUs).</p>
<p>More information on setting up a working OpenCL environment may be found
<a href="https://wiki.tiker.net/OpenCLHowTo">here</a>.</p>
<p>If the package version of ViennaCL is not at least 1.7.1, you will need to build
it from source:</p>
<p>Clone <a href="https://github.com/viennacl/viennacl-dev">the repository from here</a>,
checkout the <code>release-1.7.1</code> tag and build it. Remember to add its directory to
<code>PATH</code> and the built libraries to <code>LD_LIBRARY_PATH</code>.</p>
<p>To build SINGA with OpenCL support (tested on SINGA 1.1):</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> cmake -DUSE_OPENCL=ON ..</span>
<span class="hljs-meta">$</span><span class="bash"> make</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="package"></a><a href="#package" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>PACKAGE</h3>
<p>This setting is used to build the Debian package. Set PACKAGE=ON and build the
package with make command like this:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> cmake -DPACKAGE=ON</span>
<span class="hljs-meta">$</span><span class="bash"> make package</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="faq"></a><a href="#faq" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>FAQ</h2>
<ul>
<li><p>Q: Error from 'import singa'</p>
<p>A: Please check the detailed error from
<code>python -c &quot;from singa import _singa_wrap&quot;</code>. Sometimes it is caused by the
dependent libraries, e.g. there are multiple versions of protobuf, missing of
cudnn, numpy version mismatch. Following steps show the solutions for
different cases</p>
<ol>
<li><p>Check the cudnn and cuda. If cudnn is missing or not match with the wheel
version, you can download the correct version of cudnn into ~/local/cudnn/
and</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">echo</span> <span class="hljs-string">"export LD_LIBRARY_PATH=/home/&lt;yourname&gt;/local/cudnn/lib64:<span class="hljs-variable">$LD_LIBRARY_PATH</span>"</span> &gt;&gt; ~/.bashrc</span>
</code></pre></li>
<li><p>If it is the problem related to protobuf. You can install protobuf (3.6.1)
from source into a local folder, say ~/local/; Decompress the tar file, and
then</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> ./configure --prefix=/home/&lt;yourname&gt;<span class="hljs-built_in">local</span></span>
<span class="hljs-meta">$</span><span class="bash"> make &amp;&amp; make install</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">echo</span> <span class="hljs-string">"export LD_LIBRARY_PATH=/home/&lt;yourname&gt;/local/lib:<span class="hljs-variable">$LD_LIBRARY_PATH</span>"</span> &gt;&gt; ~/.bashrc</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">source</span> ~/.bashrc</span>
</code></pre></li>
<li><p>If it cannot find other libs including python, then create virtual env
using <code>pip</code> or <code>conda</code>;</p></li>
<li><p>If it is not caused by the above reasons, go to the folder of
<code>_singa_wrap.so</code>,</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> python</span>
<span class="hljs-meta">&gt;</span><span class="bash">&gt; import importlib</span>
<span class="hljs-meta">&gt;</span><span class="bash">&gt; importlib.import_module(<span class="hljs-string">'_singa_wrap'</span>)</span>
</code></pre>
<p>Check the error message. For example, if the numpy version mismatches, the
error message would be,</p>
<pre><code class="hljs css language-shell">RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
</code></pre>
<p>Then you need to upgrade the numpy.</p></li>
</ol></li>
</ul>
<ul>
<li><p>Q: Error from running <code>cmake ..</code>, which cannot find the dependent libraries.</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>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> CMAKE_INCLUDE_PATH=&lt;path to your header file folder&gt;</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> CMAKE_LIBRARY_PATH=&lt;path to your lib file folder&gt;</span>
</code></pre></li>
</ul>
<ul>
<li><p>Q: Error from <code>make</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>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> LIBRARY_PATH=&lt;path to your lib file folder&gt;</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> LD_LIBRARY_PATH=&lt;path to your lib file folder&gt;</span>
</code></pre></li>
</ul>
<ul>
<li><p>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>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> CPLUS_INCLUDE_PATH=/opt/OpenBLAS/include:<span class="hljs-variable">$CPLUS_INCLUDE_PATH</span></span>
</code></pre></li>
<li><p>Q:While compiling SINGA, I get error <code>SSE2 instruction set not enabled</code></p>
<p>A:You can try following command:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> make CFLAGS=<span class="hljs-string">'-msse2'</span> CXXFLAGS=<span class="hljs-string">'-msse2'</span></span>
</code></pre></li>
<li><p>Q:I get <code>ImportError: cannot import name enum_type_wrapper</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>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> sudo apt-get install protobuf</span>
</code></pre>
<p>or from source</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> /PROTOBUF/SOURCE/FOLDER</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> python</span>
<span class="hljs-meta">$</span><span class="bash"> python setup.py build</span>
<span class="hljs-meta">$</span><span class="bash"> python setup.py install</span>
</code></pre></li>
<li><p>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>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> make ONLY_CBLAS=1</span>
</code></pre>
<p>or install it using</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> sudo apt-get install libopenblas-dev</span>
</code></pre></li>
<li><p>Q: When I build protocol buffer, it reports that <code>GLIBC++_3.4.20</code> not found in
<code>/usr/lib64/libstdc++.so.6</code>?</p>
<p>A: 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>
<pre><code class="hljs"> $ strings /usr/local/lib64/libstdc++.so.6|grep GLIBC++
</code></pre>
<p>then you just set your environment variable as</p>
<pre><code class="hljs"> $ export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH
</code></pre></li>
<li><p>Q: When I build glog, it reports that &quot;src/logging_unittest.cc:83:20: error:
‘gflags’ is not a namespace-name&quot;</p>
<p>A: It maybe that you have installed gflags with a different namespace such as
&quot;google&quot;. 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>
<pre><code class="hljs"> 1. cd to glog src directory
2. change line 125 of configure.ac to &quot;AC_CHECK_LIB(gflags, main, ac_cv_have_libgflags=0, ac_cv_have_libgflags=0)&quot;
3. autoreconf
</code></pre>
<p>After this, you can build glog again.</p></li>
<li><p>Q: When using virtual environment, every time I run pip install, it would
reinstall numpy. However, the numpy would not be used when I <code>import numpy</code></p>
<p>A: It could be caused by the <code>PYTHONPATH</code> which should be set to empty when
you are using virtual environment to avoid the conflicts with the path of the
virtual environment.</p></li>
<li><p>Q: When compiling PySINGA from source, there is a compilation error due to the
missing of &lt;numpy/objectarray.h&gt;</p>
<p>A: Please install numpy and export the path of numpy header files as</p>
<pre><code class="hljs"> $ export CPLUS_INCLUDE_PATH=`python -c &quot;import numpy; print numpy.get_include()&quot;`:$CPLUS_INCLUDE_PATH
</code></pre></li>
<li><p>Q: When I run SINGA in Mac OS X, I got the error &quot;Fatal Python error:
PyThreadState_Get: no current thread Abort trap: 6&quot;</p>
<p>A: This error happens typically when you have multiple version of Python on
your system and you installed SINGA via pip (this problem is resolved for
installation via conda), e.g, the one comes with the OS and the one installed
by Homebrew. The Python linked by PySINGA must be the same as the Python
interpreter. You can check your interpreter by <code>which python</code> and check the
Python linked by PySINGA via <code>otool -L &lt;path to _singa_wrap.so&gt;</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 href="http://stackoverflow.com/questions/15291500/i-have-2-versions-of-python-installed-but-cmake-is-using-older-version-how-do">cmake</a></p>
<pre><code class="hljs"> $ cmake -DPYTHON_LIBRARY=`python-config --prefix`/lib/libpython2.7.dylib -DPYTHON_INCLUDE_DIR=`python-config --prefix`/include/python2.7/ ..
</code></pre>
<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></li>
</ul>
</span></div></article></div><div class="docLastUpdate"><em>Last updated on 4/2/2020</em></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/next/download-singa"><span class="arrow-prev"></span><span>Download SINGA</span></a><a class="docs-next button" href="/docs/next/contribute-code"><span>How to Contribute Code</span><span class="arrow-next"></span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#use-conda-to-build-singa">Use Conda to build SINGA</a><ul class="toc-headings"><li><a href="#build-cpu-version">Build CPU Version</a></li><li><a href="#build-gpu-version">Build GPU Version</a></li><li><a href="#post-processing">Post Processing</a></li></ul></li><li><a href="#use-native-tools-to-build-singa-on-ubuntu">Use native tools to build SINGA on Ubuntu</a></li><li><a href="#use-native-tools-to-build-singa-on-centos7">Use native tools to Build SINGA on Centos7</a><ul class="toc-headings"><li><a href="#installing-dependencies">Installing dependencies</a></li><li><a href="#installation">Installation</a></li><li><a href="#testing">Testing</a></li></ul></li><li><a href="#compile-singa-on-windows">Compile SINGA on Windows</a></li><li><a href="#more-details-about-the-compilation-options">More details about the compilation options</a><ul class="toc-headings"><li><a href="#use_modules-deprecated">USE_MODULES (deprecated)</a></li><li><a href="#use_python">USE_PYTHON</a></li><li><a href="#use_cuda">USE_CUDA</a></li><li><a href="#use_dnnl">USE_DNNL</a></li><li><a href="#use_opencl">USE_OPENCL</a></li><li><a href="#package">PACKAGE</a></li></ul></li><li><a href="#faq">FAQ</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/#">API Reference (coming soon)</a><a href="/docs/model-zoo-cnn-cifar10">Model Zoo</a><a href="/docs/download-singa">Development</a></div><div><h5>Community</h5><a href="/en/users.html">User Showcase</a><a href="/docs/history-singa">SINGA History</a><a href="/docs/team-list">SINGA Team</a><a href="/news">SINGA News</a><a href="https://github.com/apache/singa-doc">GitHub</a><div class="social"><a class="github-button" href="https://github.com/apache/singa-doc" data-count-href="/apache/singa/stargazers" data-show-count="true" data-count-aria-label="# stargazers on GitHub" aria-label="Star this project on GitHub">apache/singa-doc</a></div><div class="social"><a href="https://twitter.com/ApacheSINGA" class="twitter-follow-button">Follow @ApacheSINGA</a></div></div><div><h5>Apache Software Foundation</h5><a href="https://apache.org/" target="_blank" rel="noreferrer noopener">Foundation</a><a href="http://www.apache.org/licenses/" target="_blank" rel="noreferrer noopener">License</a><a href="http://www.apache.org/foundation/sponsorship.html" target="_blank" rel="noreferrer noopener">Sponsorship</a><a href="http://www.apache.org/foundation/thanks.html" target="_blank" rel="noreferrer noopener">Thanks</a><a href="http://www.apache.org/events/current-event" target="_blank" rel="noreferrer noopener">Events</a><a href="http://www.apache.org/security/" target="_blank" rel="noreferrer noopener">Security</a></div></section><div style="width:100%;text-align:center"><a href="https://apache.org/" target="_blank" rel="noreferrer noopener" class="ApacheOpenSource"><img src="/img/asf_logo_wide.svg" alt="Apache Open Source"/></a><section class="copyright" style="max-width:60%;margin:0 auto">Copyright © 2020
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.</section></div></footer></div><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter-wjs'));</script></body></html>