HPC/Applications/fftw3: Difference between revisions

From CNM Wiki
Jump to navigation Jump to search
(Created page with "== 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...")
 
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:


In the simplest case, simply pass on the command line 3 items:
In the simplest case, simply pass on the command line 3 items:
# path to include files <code>-I</code>,
# path to include files <code>-I''path''</code>,
# path to library files <code>-L</code>,
# path to library files <code>-L''path''</code>,
* the actual link request <code>-l</code>. (lowercase L)
# the actual link request <code>-l''libname''</code>. (lowercase L)
 
For example, for a standalone C program:
  icc … your obj files and flags … '''-I$FFTW3_HOME/include -L$FFTW3_HOME/lib -lfftw3'''
  icc … your obj files and flags … '''-I$FFTW3_HOME/include -L$FFTW3_HOME/lib -lfftw3'''


For example, for LAMMPS, the following is needed:
For MPI, simply replace <code>icc</code> by <code>mpicc</code>.
 
Sometimes application makefiles use variables to handle the paths, e.g. for LAMMPS, the following is needed:
  make … \
  make … \
         FFT_PATH="-L$FFTW3_HOME" \
         FFT_PATH="-L$FFTW3_HOME/lib" \
         FFT_LIB="-lfftw3" \
         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 <code>-lfftw3</code> without the need for -L paths.

Latest revision as of 16:14, December 19, 2013

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.