ATLAS BLAS&LAPACK Package

Make a PKGBUILD? Submit it here for user review and possible placement into the repository.

ATLAS BLAS&LAPACK Package

Postby jdarm » Sat Aug 17, 2013 9:58 pm

The Automatically Tuned Linear Algebra Software (ATLAS) provides access to optimised Basic Linear Algebra Subprograms (BLAS) and Linear Algebra PACKage (LAPACK ) functions. Optimisation of BLAS and LAPACK functions for specific CPUs can result in substantial reduction of the time it takes to complete calculations. Common applications making use of these libraries are programmes like NumPy, SAGE, R and the like.

ATLAS is designed to find the right implementations for a specific target CPU/platform in an automated manner, hence the build should not be distributed to other CPUs/targets. Building this package can take a long time, on the BeagleBoard Black I have used to test it it took a few days. During the 'build()' the system should be dedicated to building the package, as differences in load could result in errors in the automated search for the optimal implementation of a BLAS/LAPACK function. During 'check()' this is not important.

In simple testing of the performance of BLAS in R on the BeagleBoard Black, the gains achievable on specific functions appear to be up to approximately 62%, with a total reduction of the running time of Simon Urbanek's 'R Benchmark 2.5) from 1663s to 1053s. (the standard packages provided in the repository were used as reference)

An issue popping up in my build was liblapack.so is not being built by the original configure script provided in the source archive, I have solved this by adding the creation of liblapack.so in the PKGBUILD.

It would be great if people could go over the package (and correct the silly stuff I have undoubtedly done) and maybe test ATLAS on various CPUs/platforms. Also a repository of binaries/formulation of good defaults for various CPUs/platforms might be nice, as building really can take a very long time.

PKGBUILD:
$this->bbcode_second_pass_code('', '
# Inspiration/substantial parts taken from atlas-lapack in Arch linux AUR

pkgname=atlas-lapack-arm
pkgver=3.10.1
_lapackver=3.4.2
pkgrel=1
pkgdesc="Complete LAPACK and BLAS implementation using optimised ATLAS routines"
url="http://math-atlas.sourceforge.net/"
depends=('gcc-libs')
makedepends=('binutils' 'sed' 'gcc-fortran')
arch=('armv7h')
conflicts=('blas' 'lapack' 'cblas')
provides=("blas" "lapack=$_lapackver" 'cblas')
license=('custom:blas' 'custom:lapack' 'custom:atlas')
options=(!makeflags)
install=$pkgname.install
source=(http://www.netlib.org/lapack/lapack-$_lapackver.tgz http://downloads.sourceforge.net/math-atlas/atlas${pkgver}.tar.bz2 blas-license.txt atlas-license.txt)
noextract=(lapack-$_lapackver.tgz atlas$pkgver.tar.bz2 armhardfp_archdef.tar)
md5sums=('61bf1a8a4469d4bdb7604f5897179478'
'78753e869231cc1417a92eebaa076718'
'38b6acb8ed5691d25863319d30a8b365'
'4903eb06072dfbf94710691ccb6660bf')

prepare() {
msg 'Prepare directories'
cd "$srcdir"
tar -xjf atlas$pkgver.tar.bz2

mkdir -p "$srcdir/build-atlas"
cd "$srcdir/build-atlas"
}

build() {
msg 'Build ATLAS'
unset MAKE
cd "$srcdir/build-atlas"
rm -rf *
../ATLAS/configure -D c -DATL_ARM_HARDFP=1 -Si archdef 0 -Fa alg -mfloat-abi=hard --dylibs --prefix=/usr/ --with-netlib-lapack-tarfile="$srcdir/lapack-$_lapackver.tgz"
make build

# Link liblapack.so seperately, as the default config which is generated does not work
cd "$srcdir/build-atlas/lib"
/usr/bin/gcc -shared -o liblapack.so -Wl,-soname,liblapack.so -Wl,--whole-archive liblapack.a -Wl,--no-whole-archive -L. -L/usr/lib -L/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/4.7.2/ -lcblas -lblas -lgcc_s
}

check() {
cd "$srcdir/ATLAS/build"

msg 'Check...'
unset MAKE
make check
make ptcheck
make time
}

package() {
cd "$srcdir/build-atlas"
make DESTDIR="$pkgdir/usr" install
cp -d lib/*.so* "$pkgdir/usr/lib"
[ -e lib/libptlapack.a ] && cp lib/libptlapack.a "$pkgdir/usr/lib"
cd "$pkgdir/usr/lib"
ln -s libblas.so libblas.so.3
ln -s liblapack.so liblapack.so.3.4.2

install -Dm644 "${srcdir}/blas-license.txt" \
"${pkgdir}/usr/share/licenses/$pkgname/blas-license.txt"
install -Dm644 "${srcdir}/build-atlas/src/lapack/reference/LICENSE" \
"${pkgdir}/usr/share/licenses/$pkgname/lapack-license.txt"
install -Dm644 "${srcdir}/atlas-license.txt" \
"${pkgdir}/usr/share/licenses/$pkgname/atlas-license.txt"
}
')
Attachments
atlas-lapack-arm-3.10.1-1.src.tar.gz
Package for building ATLAS
(2.78 KiB) Downloaded 1138 times
jdarm
 
Posts: 1
Joined: Sat Aug 17, 2013 9:16 pm

Return to User-Submitted Packages

Who is online

Users browsing this forum: No registered users and 3 guests