Skip to content

Build build accelerated numpy using ATLAS on Mac OSX

rhoef edited this page Dec 12, 2013 · 5 revisions

Mac OSX comes with its own "Accelerate.Framework" (Accelerate and vecLib). Numpy is linked against those libraries to perform linear algebra operations in parallel, although it does not depend on them. Unfortunately the native OSX Accelerate.Framework breaks the python multiprocessing in combination with numpy. The child processes will segfault almost every time if a method from the numpy.linalg package is used.

To overcome this problem one can use a different parallelization library. This guide describes how to install ATLAS and link numpy against it. This guide works also with openBlas.

Prerequisites

Download

Download the source code from ATLAS, lapack and numpy
http://math-atlas.sourceforge.net/
http://www.netlib.org/lapack/
https://github.com/numpy/numpy/

Installation

  1. Unpack the atlas-3.10.0.tar.gz file. Lapack needs not to be installed separately.
cd ATLAS
mkdir build
../configure -b 64 --prefix=<atlas/prefix> --with-netlib-lapack-tarfile=<path/to/lapack-XXX.tgz> 
make

then as root (or use sudo):

make install
  1. Go to the numpy directory, open the file site.cfg.example and uncomment and edit the lines accordingly
[atlas]
library_dirs = <atlas/prefix>/lib
include_dirs = <atlas/prefix>/include
  1. Build the package
python setup.py build
  1. Save the file as site.cfg finally as root (or use sudo ):
python setup.py install 
Clone this wiki locally