User Tools

Site Tools


Table of Contents


Multiprocessing python code can work very slow (with linear equations) on multicore machines when numpy linked to the wrong blas library.
Here is the link how to install OpenBLAS and numpy in a proper way to speed up the performance:

This procedure has been done on Server: rose

  • sudo apt-get install git python-dev gfortran


To install OpenBLAS, do the following commands

  1. cd ~/src
  2. cd OpenBLAS
  3. make FC=gfortran
  4. sudo make PREFIX=/opt/openblas install

Need to tell the system about the new library; create config file and insert the path to new library!

vi /etc/


Update system with new library path!

sudo ldconfig

In case you have also the libblas lib installed, we need to change that.

update-alternatives --install /usr/lib/libblas/ /opt/openblas/lib/ 40
update-alternatives --config

There are 2 choices for the alternative (providing /usr/lib/libblas/

  Selection    Path                                    Priority   Status
* 0            /opt/openblas/lib/         40        auto mode
  1            /opt/openblas/lib/         40        manual mode
  2            /usr/lib/atlas-base/atlas/   35        manual mode

Press enter to keep the current choice[*], or type selection number: 0


Install Numpy

  1. cd ~/src
  2. cd ~/numpy

By default, the repository will be on the current development (master) branch. I prefer to use the latest stable branch. To find this, type git checkout v and press Tab.

  • git checkout v1.11.1

Add a config file site.cfg

  vi site.cfg
include_dirs = /opt/openblas/include
library_dirs = /opt/openblas/lib
openblas_libs = openblas
library_dirs = /opt/openblas/lib
lapack_libs = openblas
library_dirs = /opt/openblas/lib

Now run:

 python config
 python build --fcompiler=gnu95

If all configured without errors, finally install it!

 python install
/data/www/ · Last modified: 2019/01/16 10:03 by