How to Install AccFFT

Amir Gholaim bio photo By Amir Gholaim

Dependencies

The library uses cmake for installation. You may need to use module load cmake, or install cmake yourself if one is not available. Also you need to have installed FFTW library on your machine.


Generic Installation

First get the latest version of AccFFT:

git clone https://github.com/amirgholami/accfft.git 

Then cd to the source directory and create a new folder called build.

mkdir build
cd build

Now to install the library use cmake as follows:

cmake -DCMAKE_INSTALL_PREFIX=INSTALL_PATH 
-DFFTW_ROOT=$FFTW_PATH 
-DFFTW_USE_STATIC_LIBS=true/false 
-DBUILD_GPU=true/false
-DBUILD_STEPS=true/false
-DCXX_FLAGS="-O3"
-DBUILD_SHARED=true/false
-DPNETCDF_DIR=${PNETCDF_DIR}
..

This is a short explanation:

  • -D: Defines a symbol for cmake
  • CMAKE_INSTALL_PREFIX=INSTALL_PATH: Sets where you want to install the library to INSTALL_PATH. By default it will be in the build directory you just created.
  • FFTW_ROOT=$FFTW_PATH: Sets the path of where FFTW is installed in your machine.
  • FFTW_USE_STATIC_LIBS=false/true: Depending on how you installed FFTW library (static or shared ).
  • CXX_FLAGS=-O3”: Passes compiler flags to CXX compiler.
  • BUILD_GPU=true/false: If true the GPU part of the library will be installed as well (fasle by default). (For the GPU installation you need CUDA. If the cmake could not find it, you should pass -DCUDA_ROOT=CUDA_PATH)
  • BUILD_STEPS=true/false: If true will compile all of the steps and puts in the build directory (fasle by default).
  • BUILD_SHARED=true/false: If true will create shared library (fasle by default).
  • PNETCDF_DIR=PATH_TO_PNETCDF: Path to PNETCDF library directory. This is an optional package which is used for dumping data for visualization.

After this step is finished without errors, make the library (you can use make -j to make in parallel):

make 
make install

Do not forget to set the following ot your ~/.bashrc (or equivalent):

export ACCFFT_DIR=INSTALL_PATH

And obviously source the changed bashrc!


Installing Dependencies

  • Optional: First your need to install PNETCDF library. You can download it from here.
 ./configure --prefix="installation path"
make
make install

Then add the installation path to your bashrc:

export PNETCDF_DIR="where you installed it"
  • Download FFTW from here, and install both double and single precision versions. To do so you need to install the library two times, once without enable-float option and once with it. Also note that if your hardware does not have support for AVX instructions then you should remove that option from the configure command.
./configure --prefix="installation path" --enable-threads --enable-openmp --enable-mpi --enable-sse2 --enable-avx CFLAGS=-O3
make -j
make install
./configure --prefix="installation path" --enable-float --enable-threads --enable-openmp --enable-mpi --enable-sse2 --enable-avx CFLAGS=-O3
make -j
make install
export FFTW_DIR="where you installed FFTW"

Installing on Maverick

  • Go to AccFFT directory and use cmake to build the library:
mkdir build
cd build
cmake  -DCMAKE_INSTALL_PREFIX="installation path" -DFFTW_ROOT=${FFTW_DIR}  -DFFTW_USE_STATIC_LIBS=true -DBUILD_GPU=true -DBUILD_SHARED=false -DPNETCDF_DIR=${PNETCDF_DIR} ..
make
make install
export ACCFFT_DIR="where you installed AccFFT" 

Installing on Stampede

Most of the steps are similar to Maverick. The only different is that PNETCDF may complain about a SEEK error. In that case, configure PNETCDF as follows:

 ./configure --prefix="installation path" CXXFLAGS=' -DMPICH_IGNORE_SEEK -DMPICH_IGNORE_CXX_SEEK' CFLAGS=' -DMPICH_IGNORE_SEEK -DMPICH_IGNORE_CXX_SEEK'