Table of Contents

OpenBLAS

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:

https://hunseblog.wordpress.com/2014/09/15/installing-numpy-and-openblas/

This procedure has been done on Server: rose

  • sudo apt-get install git python-dev gfortran

OpenBLAS

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/ld.so.conf.d/openblas.conf

/opt/openblas/lib

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/libblas.so.3 libblas.so.3 /opt/openblas/lib/libopenblas.so 40
update-alternatives --config libblas.so.3
 

There are 2 choices for the alternative libblas.so.3 (providing /usr/lib/libblas/libblas.so.3).

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

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

Numpy

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
[default]
include_dirs = /opt/openblas/include
library_dirs = /opt/openblas/lib
 
[openblas]
openblas_libs = openblas
library_dirs = /opt/openblas/lib
 
[lapack]
lapack_libs = openblas
library_dirs = /opt/openblas/lib

Now run:

 python setup.py config
 python setup.py build --fcompiler=gnu95
 

If all configured without errors, finally install it!

 python setup.py install
/var/www/wiki.inf.unibz.it/data/pages/public/openblas.txt · Last modified: 2019/01/16 10:03 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0