Development/FFTW: Difference between revisions

From bwHPC Wiki
Jump to navigation Jump to search
m (S Richling moved page FFTW to Development/FFTW: Umzug in Development-Bereich)
 
(135 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Softwarepage|numlib/mkl}}
'''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
complex data (as well as of even/odd data, i.e. the discrete cosine/sine
transforms or DCT/DST).


{| width=600px class="wikitable"
This package provides three versions of the fftw3
|-
library depending on precision: libfft3, libfftw3f and libfftw3l for double,
! Description !! Content
single and long-double precision libraries.
|-
| module load
| numlib/mkl
|-
| License
| Commercial. See [https://software.intel.com/en-us/articles/end-user-license-agreement EULA].
|-
|Citing
| n/a
|-
| Links
| [https://software.intel.com/en-us/intel-mkl Intel MKL Homepage] | [http://www.fftw.org/ FFTW Homepage]
|-
| Graphical Interface
| No
|}
<br>
= 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.
'''Online Documentation:''' http://www.fftw.org/fftw3_doc/


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.
'''Local documentation:'''


= FAQ =
See 'info fftw3', 'man fftw-wisdom' and 'man fftw-wisdom-to-conf'.
See also documentation folder pointed to by shell variable $FFTW_DOC_DIR


[[File:comparison.png|right|border|300px|Copyright: KIZ (Ulm University)]]
'''Hints for compiling and linking:'''


'''Q:''' Why is there no FFTW module on the cluster?
Load the fftw module, and, if needed, the corresponding openmpi module.


'''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.
After having loaded the appropriate module(s), you can use several
environment variables to compile and link your application.


'''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>?
* Compile serial program:


'''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.
<pre>
$ gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3 -lm
</pre>


= Useful links =
* Compile program with support for POSIX threads:


* [https://software.intel.com/content/www/us/en/develop/articles/intel-math-kernel-library-documentation.html Documentation (english)]
<pre>
* [https://de.wikipedia.org/wiki/Math_Kernel_Library Wikipedia article (german)]
$ gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3_threads -lfftw3 -lpthread -lm
* [https://en.wikipedia.org/wiki/Math_Kernel_Library Wikipedia article (english)]
</pre>

* 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>

* 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>

* Run program with MPI support:

<pre>
$ mpirun -n <ncpu> ./example
</pre>

(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.

* Compile program with static fftw library versions (example for POSIX threads support):

<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>

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.

[[Category:Numerical_libraries]]

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