PGI Guide to FFTW

This guide is intended to help build and test the Fastest Fourier Transform in the West (FFTW3) library for Linux using the PGI 12.6 compiler.

Version Information

This guide was created for FFTW 3.3.2 release of FFTW compiled using the PGI 12.6 compiler. This information is for both x64 processors running 64-bit Linux and x86 processors running 32 bit Linux.

Application Notes

Information about FFTW can be found on the FFTW website. From the FFTW home page:

"FFTW is a C subroutine library for computing the discrete Fourier transform (DFT) in one or more dimensions, of arbitrary input size, and of both real and complex data (as well as of even/odd data, i.e. the discrete cosine/sine transforms or DCT/DST). We believe that FFTW, which is free software, should become the FFT library of choice for most applications. "

"Our benchmarks, performed on a variety of platforms, show that FFTW's performance is typically superior to that of other publicly available FFT software, and is even competitive with vendor-tuned codes. In contrast to vendor-tuned codes, however, FFTW's performance is portable: the same program will perform well on most architectures without modification. Hence the name, FFTW, which stands for the somewhat whimsical title of 'Fastest Fourier Transform in the West.' "

"FFT version 2.1.5 is not compatible with the 3.x FFTW versions as the interfaces to the FFT routines changed in the 3.x release stream. Applications which take advantage of FFTW will usually specify where to use the 2.x version or the 3.x version of this library. If in doubt about which library to use, look for where the code either includes FFTW header files or library routines. FFTW 2.x will include fftw.h while FFTW 3.x will include fftw3.h. Since they have different header files and library names, both versions of fftw can be installed on a system at the same time."

Obtaining the Source Code

The FFTW 3.3.2 source code is available from the FFTW website referenced above. You may want to check there for recent updates.


Make sure that the $PGI environment variable is defined, that pgcc and pgfortran are in your $PATH ($PGI/linux86-64/12.6/bin),and that mpicc is also in your $PATH (The PGI version is in $PGI/linux86-64/2012/mpi/mpich/bin).

Building, Testing and Installing FFTW

  1. Untar the FFTW package:

      tar -xvzf fftw-3.3.2.tar.gz
      cd fftw-3.3.2
  2. Set the environment and configure the code to use threads, openmp, and mpi. The library can be configured and build for each of the two possible word sizes. Each compilation will result in uniquely named libraries. First set up the build environment for the default size (doubles).

      env CC=pgcc CFLAGS="-fast -Minfo -fPIC" F77=pgfortran FFLAGS="-fast -Minfo" MPICC=mpicc
      ./configure --enable-threads --enable-sse2 --enable-openmp --enable-shared                /
        --enable-mpi --prefix=/usr/local

    FFTW 3.3.2 is capable of using AVX intrinsics on AVX enabled processors (e.g. Intel Sandy Bridge and AMD Bulldozer) with PGI 12.6 and later compilers. To do this, compile for AVX instead of compiling using SSE2 intrinsics by using:

      env CC=pgcc CFLAGS="-fast -Minfo -fPIC" F77=pgfortran FFLAGS="-fast -Minfo" MPICC=mpicc
      ./configure --enable-threads --enable-avx --enable-openmp --enable-shared                /
        --enable-mpi --prefix=/usr/local
  3. Build the code:

       make >∓ make.log
  4. Test the build:

       make check >& make_check.log
  5. Install the results:

      sudo make install
  6. Now set up the build environment for single precision:

      env CC=pgcc CFLAGS="-fast -Minfo -fPIC" F77=pgfortran FFLAGS="-fast -Minfo" MPICC=mpicc
      ./configure --enable-threads --enable-sse2 --enable-openmp --enable-shared                /
        --enable-mpi --enable-single --prefix=/usr/local

    AVX instrinsic support can be configured by replacing --enable-sse2 with --enable-avx in the above line.

  7. Build the code:

      make clean
      make >& make.log
  8. Test the build:

      make check >& make_check.log
  9. Install the results:

      sudo make install

Known Issues and Limitations

FFTW has an option to build libraries to support long-doubles. The PGI compiler defines the long-double to be the same length as the double, so building a specific long-double library is not necessary

Click me