MKL FFTW Interface

Article ID: 204
Last updated: 19 Jun, 2018

FFTW is a free collection of C routines for computing the discrete Fourier Transform (DFT) in one or more dimensions, and provides portability across platforms. The Intel Math Kernel Library (MKL) offers FFTW2 (for version 2.x) and FFTW3 (for version 3.x) interfaces to the Intel MKL Fast Fourier Transform and Trigonometric Transform functionality. These interfaces enable applications using FFTW to gain performance with Intel MKL without changing the application source code.

Some users have installed FFTW in their own directories (for example, /u/username/fftw). If you choose to install these routines, you will link to the FFTW library as follows:

ifort -O3                                \
      -o fftw_example.exe fftw_example.f \
      -I/u/username/fftw/include         \
      -L/u/username/fftw/lib             \
      -lfftw2
or

ifort -O3                                \
      -o fftw_example.exe fftw_example.f \
      -I/u/username/fftw/include         \
      -L/u/username/fftw/lib             \
      -lfftw3

Note: The application programming interface of FFTW 3.x is incompatible with that of FFTW 2.x.

The MKL Interfaces

The MKL interfaces are available in the form of source files (under /nasa/intel/Compiler/[Version]/mkl/interfaces), which can be built into libraries and then linked when you compile your application.

Starting with Intel MKL release 10.2 (which was distributed in the Intel Compiler 11.1.x package), the FFTW3 interfaces are integrated into the MKL main libraries for ease of use. If you load an Intel compiler module (for example, comp-intel/2018.0.128), the above example of linking to an FFTW3 library in a user's directory can be changed to, for example:

module load comp-intel/2018.0.128

ifort -O3                                                \
      -o fftw_example.exe fftw_example.f                 \
      -I/nasa/intel/Compiler/2018.0.128/mkl/include/fftw \
      -mkl
TIP: The FFTW3 interfaces do not support long double precision because Intel MKL FFT functions operate only on single- and double-precision floating point data types. This means that the functions with prefix fftwl_, supporting the long double data type, are not provided. The interfaces have other limitations, as well. For more information, see the Intel Math Kernel Library documentation.

The older FFTW2 interfaces are not integrated into the MKL main libraries. For your convenience, we have built four interface libraries for every version of the Intel compiler:

  • libfftw2xc_single_intel.a
  • libfftw2xc_double_intel.a
  • libfftw2xf_single_intel.a
  • libfftw2xf_double_intel.a

Here, "single" and "double" refer to floating point numbers. These four libraries were built with Intel's default choice of 4-byte integer precision. So, the above example of linking to an FFTW2 library in a user's directory can be changed to the following, assuming single precision:

module load comp-intel/2018.0.128

ifort -O3                                                 \
      -o fftw_example.exe fftw_example.f                  \
      -I/nasa/intel/Compiler/2018.0.128/mkl/include/fftw  \
      -L/nasa/intel/Compiler/2018.0.128/mkl/lib/intel64   \
      -lfftw2xf_single_intel                              \
      -mkl

Contact Us

General User Assistance

Security

  • Report security issues 24x7x365
  • Toll-free: 1-877-NASA-SEC (1-877-627-2732)
  • E-mail: soc@nasa.gov

User Documentation

High-End Computing Capability (HECC) Portfolio Office

NASA High-End Computing Program

Tell Us About It

Our goal is furnish all the information you need to efficiently and effectively use the HECC resources needed for your NASA computational projects.

We welcome your input on features and topics that you would like to see included on this website.

Please send us email with your wish list and other feedback.