HPC/Applications/fftw3

From CNM Wiki
Jump to navigation Jump to search

Linking FFTW3

Load the module in your .bashrc or simply on the command line.

Then, to link, you typically need to pass to make(1) or configure where to find include and library files.

In the simplest case, simply pass on the command line 3 items:

  1. path to include files -Ipath,
  2. path to library files -Lpath,
  3. the actual link request -llibname. (lowercase L)

For example, for a standalone C program:

icc … your obj files and flags … -I$FFTW3_HOME/include -L$FFTW3_HOME/lib -lfftw3

For MPI, simply replace icc by mpicc.

Sometimes application makefiles use variables to handle the paths, e.g. for LAMMPS, the following is needed:

make … \
       FFT_PATH="-L$FFTW3_HOME/lib" \
       FFT_LIB="-lfftw3" \
       …

Caveat: Distro-provided FFTW3

There is also a system-provided version of FFTW3, version 3.2.2. This version is installed under /usr/lib64, with man pages, etc. You can link this versions simply using -lfftw3 without the need for -L paths.