Development/MKL: Difference between revisions
(→FFTW) |
(→FFTW) |
||
Line 50: | Line 50: | ||
* Compile serial program: |
* Compile serial program: |
||
<code>gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3 -lm</code> |
<code> gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3 -lm </code> |
||
* Compile program with support for 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 |
<code> gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3_threads -lfftw3 -lpthread -lm </code> |
||
* Compile program with support for OpenMP threads: |
* 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 |
<code> gcc example.c -o example -fopenmp -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3_omp -lfftw3 -lm </code> |
||
* Compile program with support for MPI: |
* Compile program with support for MPI: |
||
mpicc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3_mpi -lfftw3 -lm |
<code> mpicc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3_mpi -lfftw3 -lm </code> |
||
* Run program with MPI support: |
* Run program with MPI support: |
||
mpirun -n <ncpu> ./example |
<code> mpirun -n <ncpu> ./example </code> |
||
(Replace <ncpu> by number of processor cores.) |
(Replace <ncpu> by number of processor cores.) |
||
Line 81: | Line 81: | ||
* Compile program with static fftw library versions (example for POSIX threads support): |
* 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 |
<code> gcc example.c -o example -I$FFTW_INC_DIR $FFTW_LIB_DIR/{libfftw3_threads.a,libfftw3.a} -lpthread -lm </code> |
||
or: |
or: |
||
gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -Wl,-Bstatic -lfftw3 -lfftw3_threads \ |
<code> gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -Wl,-Bstatic -lfftw3 -lfftw3_threads \ |
||
-Wl,-Bdynamic -lpthread -lm |
-Wl,-Bdynamic -lpthread -lm <code> |
||
Environment variables $FFTW_INC_DIR, $FFTW_LIB_DIR etc. are available after |
Environment variables $FFTW_INC_DIR, $FFTW_LIB_DIR etc. are available after |
Revision as of 23:43, 8 November 2013
Introduction
Modules Environment
Applications
MATLAB/Simulink
Octave
R
Programming
Compilers
GCC
Intel
Debugging
Numerical Libraries
FFTW
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).
This package provides three versions of the fftw3 library depending on precision: libfft3, libfftw3f and libfftw3l for double, single and long-double precision libraries.
Online Documentation: http://www.fftw.org/fftw3_doc/
Local documentation:
See 'info fftw3', 'man fftw-wisdom' and 'man fftw-wisdom-to-conf'. See also documentation folder pointed to by shell variable $FFTW_DOC_DIR
Hints for compiling and linking:
Load the fftw module, and, if needed, the corresponding openmpi module.
After having loaded the appropriate module(s), you can use several environment variables to compile and link your application.
- Compile serial program:
gcc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3 -lm
- 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
- 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
- Compile program with support for MPI:
mpicc example.c -o example -I$FFTW_INC_DIR -L$FFTW_LIB_DIR -lfftw3_mpi -lfftw3 -lm
- 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.
- 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.
GNU Scientific Library (GSL)
Math Kernel Library (MKL)
MPI
OpenMP