Intel® C++ Compiler for Windows* - Building FFTW with the Intel® compilers



This guide is intended to help Intel® C++ Compiler for Windows* customers build the FFTW* library. The FFTW library is used for high performance computation of the Discrete Fourier Transform (DFT).

Version information

This guide applies to FFTW* version 3.1.2 and the Intel® C++ Compiler for Windows* version 11.1.035.

Application notes

FFTW* is a portable open source library for computing DFTs and is one of the fastest such libraries available. In addition to the library, FFTW also includes a benchmark application. Though FFTW can be used on many platforms, this particular guide is intended for Windows*. FFTW can compute DFTs in multiple dimensions and with arbitrary sizes, using either real or complex data. More information about FFTW can be found at:† 

Obtaining the source code

The project files for Microsoft Visual Studio* 2008 can be downloaded here†:

Currently, the source files are distributed with project files for Microsoft Visual Studio .NET* 2003, but they should work on the newer versions of Visual Studio as well. Here is a direct link to that file:


Obtaining the latest version of the Intel® compilers

Licensed users of the Intel compilers may download the most recent versions of the compiler from the Intel download center which is accessed by logging into your account at the Intel® Registration Center .

Evaluation versions of the Intel compilers may be found at the Intel® Evaluation Software Center.


Hardware: This note has been tested on Intel® Core® 2 Quad and Pentium® M processors.

Software: This note applies to use of version 11.1.035 of the Intel® C++ Compiler for Windows*. It is assumed that the reader will be using Microsoft Visual Studio* .NET* 2003 or above to build FFTW. This note has been tested with Microsoft Visual Studio 2008 Professional Edition.

Configuration and set-up information

In order to use the provided project files you will need Microsoft Visual Studio* version .NET* 2003 or later and have the Intel® C++ Compiler installed. To ensure that the Intel compiler works properly within Visual Studio, the Intel compiler should be installed after Visual Studio. The project files provided are already configured to use the Intel® Compiler. The examples and screen captures shown in this document reflect the Visual Studio 2008 environment.

Source code changes

No source code changes are required to build FFTW* with the Intel compiler.

Building FFTW

After you download the source code and Microsoft Visual Studio* project files, extract the files. Windows* does not support .tar.gz files natively, so you may need a program like WinZip* that can handle that type of file. The files should be extracted by default to a directory named fftw-3.1.2. Inside that directory, open the win32 directory and open the bench.sln solution file. That solution file contains all of the FFTW projects.

If you are using a version of Microsoft Visual Studio newer than the .NET* 2003 edition and using the projects for .NET 2003 supplied with the source, it will tell you that it needs to convert the project files from the older version. Just follow the onscreen wizard with the default options and the project should convert without any problems.

There are several different configurations to choose from in the solution. Perhaps the most relevant one is the Release SSE2 configuration, which uses double precision floats and Intel® Streaming SIMD Extensions 2 (SSE2) instructions. To build FFTW*, just select a configuration and then click Build Solution in the Build menu.

You may encounter one of these two errors when building the solution:

Command-line error: cannot open precompiled header input file .\bench___Win32_Release_SSE2\bench.pchi<


Project : error PRJ0019: A tool returned an error code from "Performing Post-Build Event..."
LINK : fatal error LNK1181: cannot open input file 'libfftw.lib'

If so, please refer to the Known Issues and Limitations section at the bottom of this document.

After the solution builds successfully, both the benchmark executable and the FFTW static library will placed in the fftw-3.1.2 directory. The names of the files depend on the configuration that is used, but for the Release SSE2 configuration, the benchmark is called bench_sse2.exe and the static library is called libfftw_sse2.lib.

Building FFTW as a DLL

The FFTW* library normally compiles as a static library (.lib file), but can be compiled as a dynamic library (.dll file) as well. Follow the procedure from above for building as a static library, but with the following modifications.

Before building the solution, you will need to change some of the settings for the libfftw project. Right-click the libfftw project in the Solution Explorer and click Properties. On the General page (top level), change the Configuration Type to Dynamic Library (.dll).

FFTW configuration type screen capture

Next, on the Preprocessor page under the C/C++ section, add FFTW_DLL to the Preprocessor Definitions, so that it reads:


FFTW processor definitions screen capture

Now the FFTW library should build as a DLL. The resulting file will be called libfftw.dll and will be placed in the libfftw___Win32_Release_SSE2 (for the Release SSE2 configuration). Although the library will build successfully, the benchmark executable will try to link to the static library, so building the bench project will either fail (if the static library doesn’t exist) or use a previously built static library. This is not really a problem unless you need to build the benchmark and don’t want to keep switching between building the library statically and dynamically. The most elegant solution would be to create a separate project or configuration for building the library as a DLL. However, that goes beyond the scope of this document.

Running FFTW

Since FFTW* is a library, it cannot be run independently. It must be linked with an executable. However, there is a benchmark executable that uses FFTW which can be used for testing. The benchmark can be run from the Windows command line. Here is an example:

bench_sse2.exe -opatient 512 1024 2048 4096<

The –opatient switch is recommended for benchmarking. The numbers listed are the problem sizes that should be run in each trial. In the example shown, we are running four problems of sizes 512, 1024, 2048, and 4096. The number of trials and problem sizes chosen in this example are arbitrary. Also, problem sizes can be repeated in the list for multiple trials of the same problem size.

Verifying correctness

To verify that the results are being computed correctly, you can use the benchmark executable as you normally would, but with the --verify switch. For example, you could execute the following command on the Windows* command prompt from the fftw-3.1.2 directory:

bench_sse2.exe --verify 4096<

If the results were correct, no output will be shown. Otherwise, there will be an error message.


This note demonstrates the use of FFTW* with the latest version 11.1.035 Intel® C++ Compiler technology. Following this method will produce object files and libraries that are compatible with the latest Intel compilers.

Known issues and limitations

#1. When building the solution, you may encounter an error in the output window that says:

Command-line error: cannot open precompiled header input file .\bench___Win32_Release_SSE2\bench.pchi

This issue can be resolved by disabling precompiled headers in the bench project. As shown below, this option can be accessed in the properties page of the bench project. Right-click the bench project in the solution explorer and click Properties. Then, select the Precompiled Headers page under the C/C++ section. Change the Create/UsePrecompiled Header option to Not Using Precompiled Headers and click OK. The project should now build successfully.

Bench project properties screen capture

#2. When building the solution, you may encounter an error in the output window that says:

Project : error PRJ0019: A tool returned an error code from "Performing Post-Build Event..."
LINK : fatal error LNK1181: cannot open input file 'libfftw.lib'

You can fix the error by:

- Go to the properties for libfftw.
- Go to Configuration Properties->Build Events->Post-Build Event as shown below, and open the Command Line.


- Surround the following code in quotations: "$(OutDir)\$(ProjectName).lib"
- Within the bench project, use this same method to also surround "$(OutDir)\$(ProjectName).exe" in quotations.

This link will take you off of the Intel Web site. Intel does not control the content of the destination Web Site.

Para obter informações mais completas sobre otimizações do compilador, consulte nosso aviso de otimização.