-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNumPy1.10+andopenblas.html
84 lines (75 loc) · 7.06 KB
/
NumPy1.10+andopenblas.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>NumPy 1.10+ changes with openBLAS</title>
<link rel="stylesheet" href="http://federicov.github.io/theme/css/main.css" />
<link href="http://federicov.github.io/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="Federico's Blog Atom Feed" />
<!--[if IE]>
<script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body id="index" class="home">
<header id="banner" class="body">
<h1><a href="http://federicov.github.io/">Federico's Blog </a></h1>
<nav><ul>
<li><a href="http://federicov.github.io/pages/about.html">About</a></li>
<li><a href="http://federicov.github.io/category/machine-learning.html">Machine Learning</a></li>
<li><a href="http://federicov.github.io/category/misc.html">misc</a></li>
<li><a href="http://federicov.github.io/category/optimization.html">Optimization</a></li>
<li class="active"><a href="http://federicov.github.io/category/programming.html">Programming</a></li>
<li><a href="http://federicov.github.io/category/science.html">Science</a></li>
</ul></nav>
</header><!-- /#banner -->
<section id="content" class="body">
<article>
<header>
<h1 class="entry-title">
<a href="http://federicov.github.io/NumPy1.10+andopenblas.html" rel="bookmark"
title="Permalink to NumPy 1.10+ changes with openBLAS">NumPy 1.10+ changes with openBLAS</a></h1>
<a href="https://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="f_vaggi">Tweet</a><script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script>
</header>
<div class="entry-content">
<footer class="post-info">
<abbr class="published" title="2014-09-15T00:00:00+02:00">
Published: Mon 15 September 2014
</abbr>
<address class="vcard author">
By <a class="url fn" href="http://federicov.github.io/author/federico-vaggi.html">Federico Vaggi</a>
</address>
<p>In <a href="http://federicov.github.io/category/programming.html">Programming</a>.</p>
<p>tags: <a href="http://federicov.github.io/tag/python.html">[Python</a> <a href="http://federicov.github.io/tag/openblas.html">openBLAS</a> <a href="http://federicov.github.io/tag/numpy.html">NumPy]</a> </p>
</footer><!-- /.post-info --> <p><a href="https://github.com/xianyi/OpenBLAS">OpenBLAS</a> is a terrific open source implementation of the BLAS libraries, forked from the no-longer maintained <a href="https://www.tacc.utexas.edu/tacc-projects/gotoblas2">gotoblas</a>. It's free, fast, available under a fairly permissive license, and quite easy to compile (unlike ATLAS).</p>
<p>Almost all scientific programming languages use BLAS under the hood to do the numerical heavy lifting for all linear algebra routines, and NumPy is no exception. There are lots of <a href="http://myvirtualbrain.blogspot.it/2013/01/compiling-and-installing-numpy-with.html">excellent</a> <a href="http://osdf.github.io/blog/numpyscipy-with-openblas-for-ubuntu-1204-second-try.html">guides</a> to building OpenBLAS and linking it with NumPy.</p>
<p>However, since until recently, building NumPy with OpenBLAS required a fair bit of tinkering, all the guides suggest testing to see if your build process worked like <a href="https://gist.github.com/osdf/3842524#file_test_numpy.py">so</a>. Since the NumPy 1.9 release though, all subsequent builds however changed so <em>numpy.core._dotblas</em> is no longer built as a standalone file.</p>
<p><strong>From 1.10 the release notes:</strong></p>
<ul>
<li>The _dotblas module is no longer available.</li>
</ul>
<p>If you are smart enough to actually read through the release notes before building a package, I admire your discipline, and you've earned the right to feel smug for the rest of the day. I, however, struggled like an idiot for 2 hours trying to figure out why _dotblas wasn't getting built. Relying on a private API module to check for a succesful build wasn't a very good idea in the first place - but if you want to check if NumPy succesfully linked openblas, do this instead:</p>
<div class="highlight"><pre><span></span><span class="o">>>></span> <span class="kn">from</span> <span class="nn">numpy.distutils.system_info</span> <span class="kn">import</span> <span class="n">get_info</span>
<span class="o">>>></span> <span class="n">get_info</span><span class="p">(</span><span class="s1">'blas'</span><span class="p">)</span>
<span class="p">{</span><span class="s1">'libraries'</span><span class="p">:</span> <span class="p">[</span><span class="s1">'openblas'</span><span class="p">],</span> <span class="s1">'library_dirs'</span><span class="p">:</span> <span class="p">[</span><span class="s1">'/opt/OpenBLAS/lib'</span><span class="p">],</span> <span class="s1">'define_macros'</span><span class="p">:</span> <span class="p">[(</span><span class="s1">'HAVE_CBLAS'</span><span class="p">,</span> <span class="bp">None</span><span class="p">)],</span> <span class="s1">'language'</span><span class="p">:</span> <span class="s1">'c'</span><span class="p">}</span>
<span class="o">>>></span> <span class="n">get_info</span><span class="p">(</span><span class="s1">'lapack'</span><span class="p">)</span>
<span class="p">{</span><span class="s1">'libraries'</span><span class="p">:</span> <span class="p">[</span><span class="s1">'openblas'</span><span class="p">],</span> <span class="s1">'library_dirs'</span><span class="p">:</span> <span class="p">[</span><span class="s1">'/opt/OpenBLAS/lib'</span><span class="p">],</span> <span class="s1">'language'</span><span class="p">:</span> <span class="s1">'f77'</span><span class="p">}</span>
</pre></div>
</div><!-- /.entry-content -->
</article>
</section>
<section id="extras" class="body">
<div class="social">
<h2>social</h2>
<ul>
<li><a href="http://federicov.github.io/feeds/all.atom.xml" type="application/atom+xml" rel="alternate">atom feed</a></li>
<li><a href="http://twitter.com/f_vaggi">@f_vaggi</a></li>
</ul>
</div><!-- /.social -->
</section><!-- /#extras -->
<footer id="contentinfo" class="body">
<address id="about" class="vcard body">
Proudly powered by <a href="http://getpelican.com/">Pelican</a>, which takes great advantage of <a href="http://python.org">Python</a>.
</address><!-- /#about -->
<p>The theme is by <a href="http://coding.smashingmagazine.com/2009/08/04/designing-a-html-5-layout-from-scratch/">Smashing Magazine</a>, thanks!</p>
</footer><!-- /#contentinfo -->
</body>
</html>