19 May 2013

423. Openblas on Debian Wheezy

Update 23 May 2013: the url for the openblas tarball has been updated and a tab has been removed from the lapack url.

Note that the links to the openblas file tends to die after a while, so you might have to download it manually.

Original post:
I need more modular posts. I've covered how to build openblas several times before, but I need a simple post I can use as a reference. So here it is:

openblas
sudo mkdir /opt/openblas
sudo chown ${USER} /opt/openblas
cd ~/tmp
wget http://github.com/xianyi/OpenBLAS/tarball/v0.2.6

tar xvf v0.2.6
cd xianyi-OpenBLAS-87b4d0c
wget http://www.netlib.org/lapack/lapack-3.4.1.tgz
make all BINARY=64 CC=/usr/bin/gcc FC=/usr/bin/gfortran USE_THREAD=0 INTERFACE64=1 1> make.log 2>make.err
make PREFIX=/opt/openblas install
nm: '/lib/libpthread.so*': No such file make -j 2 -f Makefile.install install make[1]: Entering directory `/home/me/tmp/xianyi-OpenBLAS-87b4d0c' Generating openblas_config.h in /opt/openblas/include Generating f77blas.h in /opt/openblas/include Generating cblas.h in /opt/openblas/include Copying LAPACKE header files to /opt/openblas/lib Copy the static library to /opt/openblas/lib cp: cannot stat `libopenblas_opteronp-r0.2.6.a': No such file or directory make[1]: *** [install] Error 1 make[1]: Leaving directory `/home/me/tmp/xianyi-OpenBLAS-87b4d0c' make: *** [install] Error 2
Don't worry about the errors -- as long as you have libopenblas_PROCESSOR_rX.X.X.so, you're fine.

cp lib*.* /opt/openblas/lib

add
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/openblas/lib
to your ~/.bashrc, and/or add

/opt/openblas/lib

to your /etc/ld.so.conf

2 comments:

  1. The instructions in
    /usr/share/doc/libopenblas-base/README.Debian (as seen at http://anonscm.debian.org/gitweb/?p=debian-science/packages/openblas.git;a=blob;f=debian/README.Debian;h=afa78f0286041ab40e4bc0c017f7b61bd25a0984;hb=refs/heads/wheezy), offer another method:

    # apt-get source openblas
    # fakeroot debian/rules custom

    That produces a .deb compiled for you machine.

    ReplyDelete
    Replies
    1. Douglas,
      thank you for the information -- I hadn't noticed that openblas had been added to debian. Note that libopenblas is only available in wheezy and not squeeze or jessie, so presumably it will only work in wheezy. Having a deb package is normally preferable and using apt-get source takes care of that.

      However, on other debian releases and other linux distros, the method in this post is probably the way to do it.

      Delete