Development/FFTW: Difference between revisions

From bwHPC Wiki
Jump to navigation Jump to search
mNo edit summary
m (S Richling moved page FFTW to Development/FFTW: Umzug in Development-Bereich)
 
(116 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Softwarepage|numlib/mkl}}

{| width=600px class="wikitable"
{| width=600px class="wikitable"
|-
|-
Line 4: Line 6:
|-
|-
| module load
| module load
| numlib/fftw
| numlib/mkl
|-
| Availability
| [[bwUniCluster]]
|-
|-
| License
| License
| Commercial. See [https://software.intel.com/en-us/articles/end-user-license-agreement EULA].
| [http://www.fftw.org/faq/section1.html#isfftwfree GPL] | [http://www.fftw.org/fftw3_doc/License-and-Copyright.html License and Copyright]
|-
|-
|Citing
|Citing
| n/a
| [https://github.com/FFTW/fftw3/blob/master/AUTHORS Authors]
|-
|-
| Links
| Links
| [http://www.fftw.org/ FFTW Homepage] | [http://www.fftw.org/#documentation Documentation]
| [https://software.intel.com/en-us/intel-mkl Intel MKL Homepage] | [http://www.fftw.org/ FFTW Homepage]
|-
|-
| Graphical Interface
| Graphical Interface
| No
| No
|}
|}
<br>
<br>
= Description =
= 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>
<br>
[http://www.fftw.org/ More infos about FFTW]
<br>
<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>

= 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 Specific Environments|$FFTW_DOC_DIR]].
== FFTW included in MKL Library ==
Sometimes, FFTW is not available on your cluster. You can use the MKL library
instead and include the FFTW functions, too.
<br>
Excerpt from 'module help numlib/mkl'.
<pre>
Static FFTW2/3 C/Fortran interfaces can be found in dir
${MKL_HOME}/interfaces/
Examples:
Link to FFTW3 Fortran interface with GNU compiler and ilp64 support:
${MKL_HOME}/interfaces/fftw3xf/libfftw3xf_intel64_double_i8_gnu47.a
Link to FFTW3 Fortran interface with Intel compiler and lp64 support:
${MKL_HOME}/interfaces/fftw3xf/libfftw3xf_intel64_double_i4_intel150.a
The Intel FFTW interfaces requires the Intel MKL library (e.g. it does
not work with ACML library). Usually it is not a problem to use a
different compiler version, e.g. to use _gnu41.a with gnu 4.3 compiler.
See dir ${MKL_HOME}/interfaces/ for other interfaces (fftw2/3 Fortran/C).
Compiler option for include files: -I${MKL_INC_DIR}/fftw
</pre>
<br>
= Versions and Availability =
A list of versions currently available on all bwHPC-C5-Clusters can be obtained from the
<br>
<big>

[https://cis-hpc.uni-konstanz.de/prod.cis/ Cluster Information System CIS]


The '''Fastest Fourier Transform in the West (FFTW)''' is a software library for computing discrete Fourier transforms 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). FFTW was developed by Matteo Frigo and Steven G. Johnson at the Massachusetts Institute of Technology.
</big>
{{#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'.
<pre>
$ module avail chem/gamess
------------------------ /opt/bwhpc/common/modulefiles -------------------------
chem/gamess/12052014
</pre>
<br>


The '''Intel Math Kernel Library (Intel MKL)''' offers FFTW2 (for version 2.x) and FFTW3 (for version 3.x) interfaces to the Intel MKL Fast Fourier Transform and Trigonometric Transform functionality. These interfaces enable applications using FFTW to gain performance with Intel MKL without changing the application source code. Therefore, it is highly recommended to use Intel MKL instead of a separate FFTW installation.
= Loading the Module =
Load the fftw module, and, if needed, the corresponding openmpi and compiler module.
You can load the default version of 'FFTW'' with the command ''''module load numlib/fftw''''.
<pre>
$ module load numlib/fftw
Loading module dependency 'compiler/intel/13.1'.
</pre>
The module will try to load modules it needs to function (e.g. compiler, mpi, numlibs).
<br>
If loading the module fails, check if you have already loaded one of those modules with<br>
the command 'module list'.
If you wish to load a specific (older) version (if available), you can do so using e.g.
''''module load numlib/fftw'''/'version' to load the version you desires.
<pre>
$ module avail numlib/fftw
------------------------ /opt/bwhpc/common/modulefiles -------------------------
numlib/fftw/3.3.3-impi-4.1.1-gnu-4.4
numlib/fftw/3.3.3-impi-4.1.1-intel-13.1(default)
$
$ module load numlib/fftw/3.3.3-impi-4.1.1-gnu-4.4
$ module list
Currently Loaded Modulefiles:
1) numlib/fftw/3.3.3-impi-4.1.1-gnu-4.4
</pre>
<font color=red>Beware!</font>&nbsp;Compiler, MPI-module and numerical library must fit!
<br>
<br>
= Hints for compiling and linking =
== FFTW Specific Environments ==
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 = (empty)
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>


= FAQ =
== Compile a Serial Program ==
<pre>
$ gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3 -lm
</pre>
=== with POSIX Threads ===
Compile program with support for POSIX threads.
<pre>
$ gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3_threads -lfftw3 -lpthread -lm
</pre>


[[File:comparison.png|right|border|300px|Copyright: KIZ (Ulm University)]]
== Compile program with support for OpenMP threads ==
<pre>
$ gcc example.c -o example -fopenmp -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3_omp -lfftw3 -lm
</pre>


'''Q:''' Why is there no FFTW module on the cluster?
== Compile program with support for MPI ==
<pre>
$ mpicc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3_mpi -lfftw3 -lm
</pre>


'''A:''' MKL exhibits better performance than FFTS libraries (see Figure on the right). Therefore, we recommend to use MKL and do not offer a separate FFTW installation.
=== Run program with MPI support ===
<pre>
$ mpirun -n <ncpu> ./example
</pre>


'''Q:''' Why does my code complain about <span style="background:#edeae2;margin:2px;padding:1px;border:1px dotted #808080"> argument of type "long double *" is incompatible with parameter of type "double *" </span>?
(Replace <ncpu> by number of processor cores.)


'''A:''' The interfaces do not support long double precision because Intel MKL FFT functions operate only on single- and double-precision floating point data types. For the very rare case that you need extended data types, please submit a support ticket at https://www.bwhpc.de/supportportal.
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.


= Useful links =
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.


* [https://software.intel.com/content/www/us/en/develop/articles/intel-math-kernel-library-documentation.html Documentation (english)]
== Compile program with static fftw library versions ==
* [https://de.wikipedia.org/wiki/Math_Kernel_Library Wikipedia article (german)]
Example for POSIX threads support
* [https://en.wikipedia.org/wiki/Math_Kernel_Library Wikipedia article (english)]
<pre>
$ gcc example.c -o example -I$FFTW_INC_DIR $FFTW_LIB_DIR/{libfftw3_threads.a,libfftw3.a} -lpthread -lm
</pre>
or:
<pre>
$ gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -Wl,-Bstatic -lfftw3 -lfftw3_threads \
-Wl,-Bdynamic -lpthread -lm
</pre>
[[#FFTW Specific Environments|Environment variables $FFTW_INC_DIR, $FFTW_LIB_DIR]] etc. are available after loading the module.
<br>
== Sample Code ==
Sample code for various test cases is provided in folder pointed to by environment
variable [[#FFTW Specific Environments|$FFTW_EXA_DIR]].
<pre>
$ module list
Currently Loaded Modulefiles:
1) compiler/intel/13.1
2) numlib/fftw/3.3.3-impi-4.1.1-intel-13.1(default)
$ ls -F $FFTW_EXA_DIR
ex_mpi_2d.c ex_serial_1d.c fftw3f-test.c
ex_ompthreads_2d.c ex_serial_2d.c fftw3l-test.c
ex_pthreads_2d.c ex_serial_3d.c fftw3-test.c
$ echo $FFTW_EXA_DIR
/opt/bwhpc/common/numlib/fftw/3.3.3-impi-4.1.1-intel-13.1/examples
</pre>
<br><br>
[[Category:Numerical_libraries]][[Category:bwUniCluster]]

Latest revision as of 00:04, 15 March 2023

The main documentation is available via module help numlib/mkl on the cluster. Most software modules for applications provide working example batch scripts.


Description Content
module load numlib/mkl
License Commercial. See EULA.
Citing n/a
Links Intel MKL Homepage | FFTW Homepage
Graphical Interface No


Description

The Fastest Fourier Transform in the West (FFTW) is a software library for computing discrete Fourier transforms 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). FFTW was developed by Matteo Frigo and Steven G. Johnson at the Massachusetts Institute of Technology.

The Intel Math Kernel Library (Intel MKL) offers FFTW2 (for version 2.x) and FFTW3 (for version 3.x) interfaces to the Intel MKL Fast Fourier Transform and Trigonometric Transform functionality. These interfaces enable applications using FFTW to gain performance with Intel MKL without changing the application source code. Therefore, it is highly recommended to use Intel MKL instead of a separate FFTW installation.

FAQ

Copyright: KIZ (Ulm University)

Q: Why is there no FFTW module on the cluster?

A: MKL exhibits better performance than FFTS libraries (see Figure on the right). Therefore, we recommend to use MKL and do not offer a separate FFTW installation.

Q: Why does my code complain about argument of type "long double *" is incompatible with parameter of type "double *" ?

A: The interfaces do not support long double precision because Intel MKL FFT functions operate only on single- and double-precision floating point data types. For the very rare case that you need extended data types, please submit a support ticket at https://www.bwhpc.de/supportportal.

Useful links