Skip to content


FFTW is a library for calculating discrete Fourier transforms.

The FFTW library is available as a module on Apocrita. The library computes discrete Fourier transform of data using a fast Fourier transform algorithm. The data may be of one or higher dimension and may be real or complex.

Using FFTW

On Apocrita we support only version 3 of the FFTW library. Version 2 of the library is obsolete and it is incompatible with the current.

We provide a number of different modules for the FFTW library. We provide these modules to support not only different releases of the package but to allow building code with support for numerous compilers or MPI implementations. For example: the module fftw/3.x.y-intel supports building user code with the Intel compiler suite but, unlike the module fftw/3.x.y-intelmpi, does not offer MPI features of the library. This latter module is for user code being built with the Intel compiler suite and using the Intel MPI features of the FFTW library.

Compiling using FFTW

FFTW modules on Apocrita support using pkg-config to indicate the compile and link options to pass to the compiler when building code against the FFTW library. For example, the output may look like (removing the full paths for clarity):

$ module load fftw/3.x.y-intelmpi
$ pkg-config --cflags --libs fftw3
 -I... -L... -lfftw3

The output of pkg-config used this way does not include the required flags to allow using the MPI components of the library. Instead, if you are using MPI features of the FFTW library then you should use the MPI compiler wrappers. Note that not all of the installations of FFTW on Apocrita support MPI and those that do will support only a single MPI implementation (Open MPI or Intel MPI). For clarity, we have configured the FFTW modules on Apocrita to depend on the appropriate MPI module.

Using the Fortran interface to FFTW

As noted in the FFTW user guide, version 3 of FFTW supports programming in modern Fortran. To access the Fortran interface one can include the "header file" fftw3.f03 after first using the C interoperability module. The suggested incantation

use, intrinsic :: iso_c_binding
include 'fftw3.f03'

should be used, but modified as appropriate.

For some installations of FFTW we have made available a Fortran module for the API. This may be used with

use fftw3

For installations without this module you may create your own similar module with

module fftw3
  use, intrinsic :: iso_c_binding
  include 'fftw3.f03'
end module

Further, where FFTW has been built with MPI features enabled, we may offer the similar Fortran module fftw3-mpi.


Man pages for the FFTW wisdom utilities are available on Apocrita:

man fftw-wisdom

A wider user manual is available on the FFTW website, with the C and Fortran interfaces described throughout.