SHTns  2.6.5
Compiling and installing SHTns

To compile SHTns, you need a C compiler and the FFTW library version 3.0 (or better 3.3) or later, carefully optimized and installed.

On modern x86 processors, we recommend using GCC 4.0 or later as it produces the fastest vectorized code.

First run

./configure --help

to see the available configure options. Then, for example run

./configure --prefix=$HOME --enable-openmp

if you want to install the multi-threaded transform library to $HOME/lib and the headers to $HOME/include.

To install the Python extension, see Using SHTns with Python.

The configure script will detect your FFTW library capabilities and other system dependant features. You may optionally adapt the resulting Makefile and sht_config.h to your architecture and compiler. Then compile with make and install with make install.

SHTns requires FFTW, which can be installed as a compiled package on many operating systems. However, we recommend to compile it and install it yourself, as it can lead to much better performance. If FFTW has not been compiled and tuned carefully for your machine, you may get bad performance with SHTns (down to 50% slower !). Furthermore, if FFTW is more recent than 3.3, or has not been configured with –enable-openmp (see below), SHTns cannot do the Fourier transform part in parallel.

Compiling and installing FFTW

You can download the latest FFTW package from http://www.fftw.org, compile it and install it. In order to use the parallel transforms, make sure to pass –enable-openmp to the configure script. We also recommend passing –enable-sse2 or –enable-avx to the configure script on x86 architectures. You may also take a look at the FFTW documentation for compilation advice.

For example:

./configure --enable-openmp --enable-shared --enable-avx --prefix=$HOME/usr
make
make install

That's it, FFTW is now installed and ready for use.

Using MKL instead of FFTW

SHTns can use MKL instead of FFTW. To do this, pass –enable-mkl to the configure script. Performance can be slightly better, but there is no DCT support, so only gauss grid is available.

Note
Currently the call of MKL through the fftw wrappers is not thread safe. The user is responsible for working around this MKL problem as indicated by intel. If you want to call SHT function from multiple threads, you must tell MKL how many threads you will use BEFORE initializing shtns :
#include "fftw3_mkl.h"
fftw3_mkl.number_of_user_threads = 4;
sht = shtns_create(...);
...

Preparing the Makefile

Run ./configure in the SHTns directory. You can use –enable-openmp to enable multi-threaded transforms, and –enable-long-double to (maybe) increase accuracy during initialization (not recommended). You can then edit the resulting Makefile:

Changing default options

Simple tunings can be done by passing options to ./configure (see ./configure –help)

Compiling