Doing Fast Fourier Transforms with the FFTW3 library
FFTW3 is an effiecient Fast Fourier Transform package. It is distributed with the intel fortran compiler.
It is very easy to use. For example to do a forward discrete Fourier transform of real data you essentially need the following lines of code to your Fortran file:
include "fftw3.f"
...
call dfftw_plan_dft_r2c_1d(plan,nt,d,Aw,FFTW_ESTIMATE)
call dfftw_execute(plan)
call dfftw_destroy_plan(plan)
where plan is an integer, d is the nt real data points to be transformed, and Aw is the (complex) transformed data set of length nt/2+1.
To use the FFTW3, which comes with the intel fortran compiler you need to go through the following steps:
- The first time ever the FFTW3 library is used on the machine you should locate your mkl path, MKL_PATH (e.g., "/opt/intel/Compiler/11.0/056/Frameworks/mkl" or "/home/com/intel/mkl/10.0.1.014"). Then you will need to build the FFTW3 Fortran wrapper. This is done by typing, e.g., "make libem64t" from "MKL_PATH/interfaces/ffw3xf". You should now have a library called "libfftw3xf_intel.a" under "MKL_PATH/lib/em64t".
- When compiling your Fortran code make sure to include "MKL_PATH/include/fftw" under FFLAGS and " -lfftw3xf_intel -lmkl_intel_lp64 -lmkl_sequential -lmkl_core" under LDFLAGS.
Note: In case you get an error like "error while loading shared libraries: libmkl_intel_lp64.so: cannot open shared object file: No such file or directory" when trying to compile or run your program, you should find the path containing libmkl_intel_lp64.so and provide this path using the export /setenv for the Bourne shell/C-shell.
|