Skip to content


C library to compute the discrete Fourier transforms

FFTW requires an environment module

In order to use FFTW, you must first load the appropriate environment module:

module load gnu or intel

According to the FFTW website, "FFTW (Fastest Fourier Transform in the West) 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."

Using FFTW on RCC Resources#

The fftw3 libraries can be accessed in the RCC HPC environment. The following example (fftw_test) is from the webpage of Dr. John Burkhardt, who has compiled a group of programming examples and test files (See "Additional References and Resources" section below). You may follow this quick tutorial to download, compile, link, and execute this example using the fftw3 libraries with either the gnu or intel compiler. (Note that lines beginning with a "#" symbol are comments to provide information for the command.)

# Step 1: Download the test file to your test directory (e.g., ~/test/)
# Step 2: Load the compiler module ("gnu" or "intel")
module load <COMPLIER>
# Step 3: Compile (gnu or intel) the code using the include path with the FFTW header file (e.g., fftw3.h)
gcc -c fftw_test.c -I/opt/rcc/<COMPILER>/include/
# Step 4: Link the compiled code using the library path with the FFTW shared libraries
gcc -o fftw_test fftw_test.o -L/opt/rcc/<COMPILER>/lib64/ -lfftw3 -lm
# Step 5: Run the test code

Additional References and Resources#