Difference between revisions of "Development/FFTW"

From bwHPC Wiki
Jump to: navigation, search
m
Line 1: Line 1:
  +
{| width=600px class="wikitable"
'''FFTW''' (Fast 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
 
  +
! Description !! Content
complex data (as well as of even/odd data, i.e. the discrete cosine/sine
 
  +
|-
transforms or DCT/DST).
 
  +
| module load
  +
| numlib/fftw
  +
|-
  +
| Availability
  +
| [[bwUniCluster]] | [[BwForCluster_Chemistry]]
  +
|-
  +
| License
  +
| [http://www.fftw.org/faq/section1.html#isfftwfree GPL] | [http://www.fftw.org/fftw3_doc/License-and-Copyright.html License and Copyright]
  +
|-
  +
|Citing
  +
| [https://github.com/FFTW/fftw3/blob/master/AUTHORS Authors]
  +
|-
  +
| Links
  +
| [http://www.fftw.org/ FFTW Homepage] | [http://www.fftw.org/#documentation Documentation]
  +
|-
  +
| Graphical Interface
  +
| No
  +
|}
  +
<br>
  +
= Description =
  +
'''FFTW''' 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.
  +
<br>
  +
[http://www.fftw.org/ More infos about FFTW]
  +
<br>
  +
This package provides three versions of the fftw3 library depending on precision:
  +
* libfft3
  +
* libfftw3f
  +
* libfftw3l <small>for double, single and long-double precision libraries</small>
  +
<br>
  +
<br>
  +
= Documentation =
  +
== Online ==
  +
[http://www.fftw.org/fftw3_doc/ Online Documentation]
  +
== Local ==
  +
* info fftw3
  +
* man fftw-wisdom
  +
* man fftw-wisdom-to-conf
  +
<br>
  +
See also documentation folder pointed to by shell variable $FFTW_DOC_DIR
  +
<br>
  +
<br>
  +
= Versions and Availability =
   
  +
A list of versions currently available on all bwHPC-C5-Clusters can be obtained from the
This package provides three versions of the fftw3
 
  +
<br>
library depending on precision: libfft3, libfftw3f and libfftw3l for double,
 
  +
<big>
single and long-double precision libraries.
 
   
  +
[https://cis-hpc.uni-konstanz.de/prod.cis/ Cluster Information System CIS]
'''Online Documentation:''' http://www.fftw.org/fftw3_doc/
 
   
  +
</big>
'''Local documentation:'''
 
  +
{{#widget:Iframe
 
  +
|url=https://cis-hpc.uni-konstanz.de/prod.cis/bwUniCluster/numlib/fftw
See 'info fftw3', 'man fftw-wisdom' and 'man fftw-wisdom-to-conf'.
 
  +
|width=99%
See also documentation folder pointed to by shell variable $FFTW_DOC_DIR
 
  +
|height=200
 
  +
|border=0
'''Hints for compiling and linking:'''
 
  +
}}
  +
On the command line interface of any bwHPC cluster you'll get a list of available versions
  +
by using the command 'module avail chem/gamess'.
  +
<pre>
  +
$ module avail chem/gamess
  +
------------------------ /opt/bwhpc/common/modulefiles -------------------------
  +
chem/gamess/12052014
  +
</pre>
  +
<br>
   
  +
= Loading =
 
Load the fftw module, and, if needed, the corresponding openmpi module.
 
Load the fftw module, and, if needed, the corresponding openmpi module.
   
  +
<br>
After having loaded the appropriate module(s), you can use several
 
  +
<br>
environment variables to compile and link your application.
 
  +
= Hints for compiling and linking =
 
  +
== FFTW Specific Environments ==
* Compile serial program:
 
  +
To see a list of all FFTW environments set by the 'module load'-command use the command
 
  +
'module display numlib/fftw'.
  +
<br>
  +
After having loaded the appropriate module(s), you can use several environment variables to compile and link your application.
  +
<pre>
  +
$ module display numlib/fftw
  +
-------------------------------------------------------------------
  +
/opt/bwhpc/common/modulefiles/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1:
  +
FTW_VERSION = 3.3.3-impi-4.1.1-intel-13.1
  +
FFTW_HOME = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1
  +
FFTW_BIN_DIR = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/bin
  +
FFTW_INC_DIR = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/include
  +
FFTW_LIB_DIR = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/lib
  +
FFTW_STA_DIR = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/lib
  +
FFTW_SHA_DIR ??
  +
FFTW_MAN_DIR = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/share/man
  +
FFTW_INF_DIR = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/share/info
  +
FFTW_DOC_DIR = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/doc
  +
FFTW_EXA_DIR = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/examples
  +
FFTW_WWW = http://www.fftw.org/
  +
PATH = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/bin:$PATH
  +
MANPATH = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/share/man:$MANPATH
  +
INFOPATH = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/share/info:$INFOPATH
  +
LD_LIBRARY_PATH = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/lib:$LD_LIBRARY_PATH
  +
[...]
  +
</pre>
  +
== Compile a Serial Program ==
 
<pre>
 
<pre>
 
$ gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3 -lm
 
$ gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3 -lm
 
</pre>
 
</pre>
  +
=== with POSIX Threads ===
 
* Compile program with support for POSIX threads:
+
Compile program with support for POSIX threads:
 
 
<pre>
 
<pre>
 
$ gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3_threads -lfftw3 -lpthread -lm
 
$ gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3_threads -lfftw3 -lpthread -lm
 
</pre>
 
</pre>
   
* Compile program with support for OpenMP threads:
+
== Compile program with support for OpenMP threads ==
 
 
<pre>
 
<pre>
 
$ gcc example.c -o example -fopenmp -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3_omp -lfftw3 -lm
 
$ gcc example.c -o example -fopenmp -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3_omp -lfftw3 -lm
 
</pre>
 
</pre>
   
* Compile program with support for MPI:
+
== Compile program with support for MPI ==
 
 
<pre>
 
<pre>
 
$ mpicc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3_mpi -lfftw3 -lm
 
$ mpicc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3_mpi -lfftw3 -lm
 
</pre>
 
</pre>
   
* Run program with MPI support:
+
== Run program with MPI support ==
 
 
<pre>
 
<pre>
 
$ mpirun -n <ncpu> ./example
 
$ mpirun -n <ncpu> ./example
Line 63: Line 137:
 
but not for executing the program.
 
but not for executing the program.
   
* Compile program with static fftw library versions (example for POSIX threads support):
+
== Compile program with static fftw library versions ==
  +
Example for POSIX threads support
 
 
<pre>
 
<pre>
 
$ gcc example.c -o example -I$FFTW_INC_DIR $FFTW_LIB_DIR/{libfftw3_threads.a,libfftw3.a} -lpthread -lm
 
$ gcc example.c -o example -I$FFTW_INC_DIR $FFTW_LIB_DIR/{libfftw3_threads.a,libfftw3.a} -lpthread -lm
 
</pre>
 
</pre>
 
 
or:
 
or:
 
 
<pre>
 
<pre>
 
$ gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -Wl,-Bstatic -lfftw3 -lfftw3_threads \
 
$ gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -Wl,-Bstatic -lfftw3 -lfftw3_threads \
Line 82: Line 154:
 
variable $FFTW_EXA_DIR.
 
variable $FFTW_EXA_DIR.
   
  +
<!--
 
[[Category:Numerical_libraries]][[Category:bwUniCluster]]
 
[[Category:Numerical_libraries]][[Category:bwUniCluster]]
  +
-->

Revision as of 11:09, 15 December 2015

Description Content
module load numlib/fftw
Availability bwUniCluster | BwForCluster_Chemistry
License GPL | License and Copyright
Citing Authors
Links FFTW Homepage | Documentation
Graphical Interface No


1 Description

FFTW 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.
More infos about FFTW
This package provides three versions of the fftw3 library depending on precision:

  • libfft3
  • libfftw3f
  • libfftw3l for double, single and long-double precision libraries



2 Documentation

2.1 Online

Online Documentation

2.2 Local

  • info fftw3
  • man fftw-wisdom
  • man fftw-wisdom-to-conf


See also documentation folder pointed to by shell variable $FFTW_DOC_DIR

3 Versions and Availability

A list of versions currently available on all bwHPC-C5-Clusters can be obtained from the

Cluster Information System CIS

{{#widget:Iframe |url=https://cis-hpc.uni-konstanz.de/prod.cis/bwUniCluster/numlib/fftw |width=99% |height=200 |border=0 }} On the command line interface of any bwHPC cluster you'll get a list of available versions by using the command 'module avail chem/gamess'.

$ module avail chem/gamess
------------------------ /opt/bwhpc/common/modulefiles -------------------------
chem/gamess/12052014


4 Loading

Load the fftw module, and, if needed, the corresponding openmpi module.



5 Hints for compiling and linking

5.1 FFTW Specific Environments

To see a list of all FFTW environments set by the 'module load'-command use the command 'module display numlib/fftw'.
After having loaded the appropriate module(s), you can use several environment variables to compile and link your application.

$ module display numlib/fftw
-------------------------------------------------------------------
/opt/bwhpc/common/modulefiles/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1:
FTW_VERSION = 3.3.3-impi-4.1.1-intel-13.1 
FFTW_HOME = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1 
FFTW_BIN_DIR = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/bin 
FFTW_INC_DIR = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/include 
FFTW_LIB_DIR = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/lib 
FFTW_STA_DIR = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/lib 
FFTW_SHA_DIR ?? 
FFTW_MAN_DIR = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/share/man 
FFTW_INF_DIR = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/share/info 
FFTW_DOC_DIR = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/doc 
FFTW_EXA_DIR = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/examples 
FFTW_WWW = http://www.fftw.org/ 
PATH = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/bin:$PATH
MANPATH = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/share/man:$MANPATH
INFOPATH = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/share/info:$INFOPATH
LD_LIBRARY_PATH = /opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/lib:$LD_LIBRARY_PATH 
[...]

5.2 Compile a Serial Program

 $ gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3 -lm

5.2.1 with POSIX Threads

Compile program with support for POSIX threads:

 $ gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3_threads -lfftw3 -lpthread -lm

5.3 Compile program with support for OpenMP threads

 $ gcc example.c -o example -fopenmp -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3_omp -lfftw3 -lm

5.4 Compile program with support for MPI

 $ mpicc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3_mpi -lfftw3 -lm 

5.5 Run program with MPI support

 $ mpirun -n <ncpu> ./example 

(Replace <ncpu> by number of processor cores.)

Replace -lfftw3, -lfftw3_threads, etc. by -lfftw3f, -lfftw3f_threads, etc. for single precision and by -lfftw3l, -lfftw3l_threads etc. for long-double precision codes, respectively.

These commands will compile your program with dynamic fftw library versions in which case you also have to have the fftw module loaded for running the program. Alternatively, you may want to link your program with static fftw library versions. With static fftw libraries it is only necessary to load the fftw module for compiling but not for executing the program.

5.6 Compile program with static fftw library versions

Example for POSIX threads support

 $ gcc example.c -o example -I$FFTW_INC_DIR $FFTW_LIB_DIR/{libfftw3_threads.a,libfftw3.a} -lpthread -lm 

or:

 $ gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -Wl,-Bstatic -lfftw3 -lfftw3_threads \
       -Wl,-Bdynamic -lpthread -lm 

Environment variables $FFTW_INC_DIR, $FFTW_LIB_DIR etc. are available after loading the module.

Sample code for various test cases is provided in folder pointed to by environment variable $FFTW_EXA_DIR.