11 Şubat 2013 Pazartesi

336. Compiling ATLAS, netblas, lapack and openblas on Arch Linux

To contact us Click HERE
Here's another Arch post.

I was a bit surprised to find that there's no ATLAS in the standard Arch repositories (it is in AUR though), so here's how to build some of the more common math libraries for yourself:


ATLAS

pacman -S wget base-devel gcc-fortran cpupowersudo systemctl enable cpupower
To build ATLAS you should set the governor for your CPU to performance to get the best optimization:
cpupower frequency-set -g performancesudo cp /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor

Basically copy the scaling_governor to all cpus (cpu0, cpu1, cpu2 ...) as shown in the last line above. When you set the governor back to e.g. ondemand, follow the same steps.

sudo mkdir /opt/ATLASchown ${USER} /opt/ATLASmkdir -p ~/tmp/atlascd ~/tmp/atlaswget http://www.netlib.org/lapack/lapack-3.4.2.tgzwget http://downloads.sourceforge.net/project/math-atlas/Stable/3.10.1/atlas3.10.1.tar.bz2tar xvf atlas3.10.1.tar.bz2mkdir build/cd build/../ATLAS/./configure --prefix=/opt/ATLAS -Fa alg '-fPIC' --with-netlib-lapack-tarfile=$HOME/tmp/atlas/lapack-3.4.2.tgz --sharedmakemake install

Simple as that. You can now change the governor back
cpupower frequency-set -g ondemandsudo cp /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor /sys/devices/system/cpu/cpu1/cpufreq/scaling_governorsudo cp /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor...


netlib BLAS and lapack
pacman -S wget base-devel gcc-fortran cmakesudo mkdir /opt/netlibsudo chown $USER /opt/netlibmkdir /opt/netlib/blas/lib -pmkdir -p ~/tmp/blascd ~/tmp/blaswget http://www.netlib.org/blas/blas.tgztar xvf blas.tgzcd BLAS/

Edit make.inc
OPTS = -O3 -shared -m64 -march=native -fPIC
make allgfortran -shared -Wl,-soname,libnetblas.so -o libblas.so.1.0.1 *.o -lcln -s libblas.so.1.0.1 libnetblas.socp lib*blas* /opt/netlib/blas/libcd ../wget http://www.netlib.org/lapack/lapack-3.4.2.tgztar xvf lapack-3.4.2.tgzmkdir /opt/netlib/lapackmkdir build/cd build/ccmake ../lapack-3.4.2/ -DCMAKE_INSTALL_PREFIX=/opt/netlib/lapack -DBUILD_SHARED_LIBS=ON -DUSE_OPTIMIZED_BLAS=ON 

Hit c twice to configure, then g to generate.
Edit CMakeCache.txt and add the following lines at the beginning:
######################### EXTERNAL cache entries######################## BLAS_FOUND:STRING=TRUE BLAS_GENERIC_FOUND:BOOL=TRUE BLAS_GENERIC_blas_LIBRARY:FILEPATH=/opt/netlib/blas/lib/libnetblas.so BLAS_LIBRARIES:PATH=/opt/netlib/blas/lib/libnetblas.so

Do
ccmake ../lapack-3.4.2/

again, then hit c once, then g.
Next,
makemake install

Done.

Openblas
Copied from here: http://verahill.blogspot.com.au/2013/02/334-compiling-nwchem-with-openmpi-and.html

Download from http://github.com/xianyi/OpenBLAS/tarball/v0.1.1

pacman -S wget base-devel gcc-fortransudo mkdir /opt/openblassudo chown $USER /opt/openblastar xvf xianyi-OpenBLAS-v0.1.1-0-g5b7f443.tar.gzcd xianyi-OpenBLAS-e6e87a2/make all BINARY=64 CC=/usr/bin/gcc FC=/usr/bin/gfortran USE_THREAD=0 INTERFACE64=1 1> make.log 2>make.errmake PREFIX=/opt/openblas installcp lib*.*  /opt/openblas/lib


Hiç yorum yok:

Yorum Gönder