Introduction
Wrappers Reference
1.
Complex FFTs
2. Real FFTs
3. Wisdom Wrappers
4. Memory Allocation
Parallel Mode
Multi-threaded FFTW
MPI FFTW
Calling Wrappers from Fortran
Installation
Creating a Wrapper Library
Application Assembling
Running Examples
Technical Support
This document describes a collection of C routines – wrappers that allow the FFTW interface to call the Intel® Math Kernel Library (Intel® MKL) discrete Fourier transform interface (DFTI). These wrappers correspond to the FFTW version 2.x and the Intel MKL versions 7.0 and later.
The purpose of this set of wrappers is to enable developers whose programs currently use FFTW to achieve the performance of the Intel MKL Fourier transforms without changing the program source code. Because of differences between FFTW and Intel MKL DFTI functionalities, there are restrictions on using wrappers instead of the FTTW functions. However, many typical DFTs can be computed using these wrappers.
Please refer to the Intel MKL DFTI documentation for better understanding the effects from the use of the wrappers.
Additional wrappers may be added in the future to extend FFTW functionality available with Intel MKL.
Each FFTW function has its own wrapper. Some of them are empty and do nothing,
but they are still needed to avoid compilation errors and satisfy the function
calls.
Intel MKL DFTI operates on both float and double-precision data types.
fftw_plan fftw_create_plan(int n, fftw_direction dir, int flags);
fftw_plan fftw_create_plan_specific(int n, fftw_direction dir, int flags,
fftw_complex *in, int istride, fftw_complex *out, int ostride);
woid fftw(fftw_plan plan, int howmany, fftw_complex *in, int istride, int idist,
fftw_complex *out, int ostride, int odist);
woid fftw_one(fftw_plan plan, fftw_complex *in, fftw_complex *out);
void fftw_destroy_plan(fftw_plan plan);
Argument restrictions. The same
algorithm corresponds to all values of the flags
parameter.
fftwnd_plan fftwnd_create_plan(int rank, const int *n, fftw_direction dir, int
flags);
fftwnd_plan fftw2d_create_plan(int nx, int ny, fftw_direction dir, int flags);
fftwnd_plan fftw3d_create_plan(int nx, int ny, int nz, fftw_direction dir, int
flags);
fftwnd_plan fftwnd_create_plan_specific(int rank, const int *n, fftw_direction
dir, int flags, fftw_complex *in, int istride, fftw_complex *out, int ostride);
fftwnd_plan fftw2d_create_plan_specific(int nx, int ny, fftw_direction dir, int
flags, fftw_complex *in, int istride, fftw_complex *out, int ostride);
fftwnd_plan fftw3d_create_plan_specific(int nx, int ny, int nz, fftw_direction
dir, int flags, fftw_complex *in, int istride, fftw_complex *out, int ostride);
woid fftwnd(fftwnd_plan plan, int howmany, fftw_complex *in, int istride, int
idist, fftw_complex *out, int ostride, int odist);
woid fftwnd_one(fftwnd_plan plan, fftw_complex *in, fftw_complex *out);
void fftwnd_destroy_plan(fftwnd_plan plan);
Argument restrictions. The same
algorithm corresponds to all values of the flags
parameter.
All wrappers are empty and do nothing, as the Intel MKL DFTI does not currently support this functionality.
rfftwnd_plan rfftwnd_create_plan(int rank, const int *n, fftw_direction
dir, int flags);
rfftwnd_plan rfftw2d_create_plan(int nx, int ny, fftw_direction dir, int
flags);
rfftwnd_plan rfftw3d_create_plan(int nx, int ny, int nz, fftw_direction
dir, int flags);
woid rfftwnd_real_to_complex(rfftwnd_plan plan, int howmany, fftw_real *in, int
istride, int idist, fftw_complex *out, int ostride, int odist);
woid rfftwnd_complex_to_real(rfftwnd_plan plan, int howmany, fftw_complex *in,
int istride, int idist, fftw_real *out, int ostride, int odist);
woid rfftwnd_one_real_to_complex(rfftwnd_plan plan, fftw_real *in, fftw_complex
*out);
woid rfftwnd_one_complex_to_real(rfftwnd_plan plan, fftw_complex *in, fftw_real
*out);
void rfftwnd_destroy_plan(rfftwnd_plan plan);
flags
parameter.
rfftwnd_one_real_to_complex()
and
rfftwnd_one_complex_to_real()
only.
All wrappers are empty and do nothing, as Intel MKL DFTI currently does not support these functionalities.
All wrappers in
this section are empty and do nothing. The Intel MKL
allocation function cannot align the allocatable array. It is recommended to
allocate memory using
malloc
or similar functions and align
your array yourself. To do that, it is necessary to allocate extra memory and
shift the array address for the DFT data. See also the
Performance section
in the Intel MKL documentation file
mkluse.htm
The
void fftw_threads_init(void)
wrapper in this section is empty and
does nothing, as the Intel MKL DFTI implements a different mechanism of
parallelization. If you want to use Intel MKL DFTI
routines in parallel mode or call wrappers from a multi-threaded application, please refer to the
Intel MKL documentation to learn how to manage the number of threads.
Each of other
wrappers in this section is the same as the respective wrapper in section 1 or 2
(whose name differs from the one of the given wrapper in cutting out "threads_
").
For
example,
woid fftw_threads_one(int threads, fftw_plan plan, fftw_complex *in,
fftw_complex *out);
is the same as
woid fftw_one(fftw_plan plan, fftw_complex *in, fftw_complex *out);
because
fftw_one
may be parallel depending on MKL variables.
The wrappers are currently not available.
Wrappers are available for all Fortran FFTW functions.
FFTW Fortran functions are actually the wrappers to FFTW C functions. Fortran wrappers are actually
the wrappers to C wrappers. So their functionality and argument
restrictions are the same as of the corresponding C wrappers.
Wrappers are delivered as the source code, which must be compiled by a user to build the wrapper library. Then the FFTW library can be substituted by the wrapper and Intel MKL libraries. The source code for the wrappers and makefiles with the wrapper list files are located in the \interfaces\fftw2xc and \interfaces\fftw2xf sub-directories in the Intel MKL directory for C and Fortran wrappers, respectively. Both __release_lnx and __release_win directories have the "interfaces" sub-directory.
The original FFTW (www.fftw.org) header files fftw.h
, rfftw.h
, fftw_threads.h
, rfftw_threads.h
, and fftw_f77.i
are placed in the
\include\fftw sub-directory in the Intel MKL directory.
A wrapper library contains C and Fortran wrappers for complex and real transforms in serial and multi-threaded mode for one of the two data types (double or float). The data type is managed by a makefile parameter.
Makefiles contain the following parameters: platform, compiler, precision and function. Description of these parameters is contained in the makefile comment heading.
platform is an obligatory parameter. Possible values:
lib32
– 32-bit applicationslibem64t
– applications for processors
supporting Intel® EM64T lib64
– Intel® Itanium® processor family applications.The rest of parameters have default values and are optional.
The compiler parameter may have values:
intel
– Intel® compilers version 8.0
or higher, defaultintel7
– Intel compilers version 7.1 or lowergnu
– GNU compiler on Linux*mc
– Microsoft* C++ Compiler on Windows*cvf
– Compaq* Visual Fortran Compiler on Windows.The precision parameter may have values:
MKL_DOUBLE
– double-precision data, defaultMKL_SINGLE
– float, single-precision data.The function parameter is not used for building a wrapper library.
Examples
The command
make lib64
builds a double-precision wrapper library for the Intel Itanium
processor family applications using the Intel®
C++ Compiler and
Intel®
Fortran Compiler version 8.0 or
higher
(Compilers and precision=MKL_DOUBLE
are chosen by default.).
The command
make lib64 precision=MKL_SINGLE
builds a single-precision wrapper library for the Intel Itanium
processor family applications using the Intel
C++ Compiler and Intel
Fortran Compiler version 8.0 or higher (Compilers are chosen by default.).
The command
make lib32 F=intel7
builds a wrapper library for the 32-bit platform using the Intel C++ Compiler
(version 7.1 or
lower).
As a result of a makefile execution, the wrapper library will be created in the directory with Intel MKL libraries corresponding to the used platform. For example, __release_lnx\lib\64 or __release_win\ia32\lib.
In the wrapper library names, the suffix corresponds to the used compiler and the underscore is preceded with letter
"f" for Fortran and "c" for C.
For example,
fftw2xf_intel.lib
(libfftw2xf_intel.a
for Linux)
fftw2xf_cvf.lib
(libfftw2xf_gnu.a
for Linux)
fftw2xc_intel.lib
(libfftw2xc_intel.a
for Linux)
fftw2xc_ms.lib
(libfftw2xc_gnu.a
for Linux).
The necessary original FFTW (www.fftw.org) header files are used without any modifications. The created wrapper library and the Intel MKL library are used instead of the FFTW library.
There are some examples that demonstrate how to use the wrapper library. The source code for the examples, makefiles used to run them, and the example list files are located in the \examples\fftw2xc and \examples\fftw2xf sub-directories in the Intel MKL directory for C and Fortran, respectively. Both __release_lnx and __release_win directories have the "examples" sub-directory.
Parameters for the example makefiles are described in the makefiles comment heading and are the same as the wrapper library makefile parameters (see Creating a Wrapper Library). Example makefiles run examples. However, if the appropriate wrapper library is not yet created, the makefile will first build it in the same way as the wrapper library makefile does and then proceed to examples.
If the parameter function=<example_name>
is defined, then only
the specified example will run. Otherwise, all examples from the appropriate sub-directory will run.
The sub-directory \_results will be created, and the results will be stored
there in the example_name.res
files.
Please see the Intel MKL support website at http://www.intel.com/support/performancetools/libraries/mkl/.
Intel, the Intel logo, Intel SpeedStep, Intel
NetBurst, Intel NetStructure, MMX, Intel386, Intel486, Celeron, Intel Centrino,
Intel Xeon, Intel XScale, Itanium, Pentium, Pentium II Xeon, Pentium III Xeon, Pentium M, and VTune are trademarks or registered
trademarks of Intel Corporation or its subsidiaries in the United States and
other countries.
* Other names and brands may be claimed as the property
of others.
Copyright © 2006, Intel Corporation.