Skip to content

Instantly share code, notes, and snippets.

@ashwinvis
Created June 15, 2017 22:38
Show Gist options
  • Save ashwinvis/f686a71b70dda653c4f590bab67ecbb9 to your computer and use it in GitHub Desktop.
Save ashwinvis/f686a71b70dda653c4f590bab67ecbb9 to your computer and use it in GitHub Desktop.
FFTW local installation
#!/bin/bash
pkgname='fftw'
pkgver=3.3.6-pl2
srcdir=$PWD
pkgdir='$HOME/.local/share/fftw'
download() {
cd ${srcdir}
if [ ! -f $pkgname-$pkgver.tar.gz ]; then
wget http://www.fftw.org/$pkgname-$pkgver.tar.gz
fi
tar vxzf $pkgname-$pkgver.tar.gz
}
build() {
cd ${srcdir}
cp -a ${pkgname}-${pkgver} ${pkgname}-${pkgver}-double
cp -a ${pkgname}-${pkgver} ${pkgname}-${pkgver}-long-double
cp -a ${pkgname}-${pkgver} ${pkgname}-${pkgver}-single
# use upstream default CFLAGS while keeping our -march/-mtune
CFLAGS+=" -O3 -fomit-frame-pointer -malign-double -fstrict-aliasing -ffast-math"
CONFIGURE="./configure F77=gfortran --prefix=${pkgdir} \
--enable-shared --enable-threads \
--enable-openmp \
--enable-mpi"
# build double precision
cd ${srcdir}/${pkgname}-${pkgver}-double
$CONFIGURE --enable-sse2 --enable-avx
make
# build & install long double precission
cd ${srcdir}/${pkgname}-${pkgver}-long-double
$CONFIGURE --enable-long-double
make
# build & install single precision
cd ${srcdir}/${pkgname}-${pkgver}-single
$CONFIGURE --enable-float --enable-sse --enable-avx
make
}
package() {
cd ${srcdir}/${pkgname}-${pkgver}-double
make install
cd ${srcdir}/${pkgname}-${pkgver}-long-double
make install
cd ${srcdir}/${pkgname}-${pkgver}-single
make install
}
if [ ! -d ${srcdir}/${pkgname}-${pkgver} ]
then
download
fi
build
package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment