The test directory has several programs that illustrate how to use fftMPI. They can also be used to benchmark its performance.
These are simple, compact codes (about 150 lines each) which illustrate how to setup a distributed FFT grid and invoke fftMPI to perform a 3d FFT. They invoke a forward and inverse FFT and compare the initial/final grid points to verify correctness:
These are more complex codes to perform 3d FFTs. They take a variety of command-line arguments to exercise all the options that fftMPI supports. They show how to call all the fftMPI methods:
There are also test2d* files which invoke 2d FFTs. There is no 2d analog of the simple codes.
You can build all the simple and test programs (apps) from the test directory, by typing:
The resulting executables are
The standard Makefile uses mpicxx for compiling and linking the C++ and C programs, and mpifort for the Fortran 90 programs, using whatever C++ and Fortran compilers they wrap. If your MPI installation does not include Fortran support, then you will not have an mpifort and the Fortran test programs will not build.
There are also a few provided Makefile.machine files that work on different supercomputers. You can use one of them or create your own edited file and invoke it as
% make -f Makefile.machine
By default, the Makefile assumes it will link to a shared version of the fftMPI library, which already incldues all the 1d FFT package functions needed to perform FFTs. And the test apps allocate grid arrays to compute double-precision FFTs (one complex datum = 2 64-bit floating point values). And if using an Intel compiler the test apps are built using the TBB (thread building blocks) memory allocator.
As with the src/Makefile for fftMPI, discussed on the compile doc page, these three make variables will change those default settings. You can add one or more of them to any make command:
Here are example make commands using these variables:
% make help # see syntax for all options % make p=single # single precision, p=double is default % make fft=fftw tbb=no # use the FFTW3 lib for 1d FFTs # options: fftw, fftw3, fftw2, mkl, kiss (default) % make test2d p=single # build just the C++ test2d app % make test3d_f90 fft=mkl # build just the Fortran test3d app
IMPORTANT NOTE: You must use the same value for the "p" variable that was used when building the fftMPI library in the src directory. This insures the single- or double-precision data types used in the test apps for the FFT grid data match what the library uses.
IMPORTANT NOTE: You only need to set the fft variable if you are linking to a static version of the fftMPI library. In this case, setting the fft variable will insure the link command for each test app needs to includes the appropriate 1d FFT package library files.
These libraries are as follows:
If the build cannot find these library files in the directories specified by your LD_LIBRARY_PATH environment variable an error will result.
If the appropriate library file is not found, you will need to add a setting for the its directory to FFT_PATH in the Makefile, something like -L/home/me/pathforMKL/lib.
You only need to set the tbb variable to no if you get a compile-time error about being able to find the Intel TBB (thread building block) header file.
The Makefile has two variables FFT_INC and FFT_PATH which point to the fftMPI src dir. This is so the test apps can find the fftMPI header files and library files created when you compiled fftMPI. If you use fftMPI from your own program, built in another location, you will need to either install fftMPI in a standard place (e.g. under /usr/local) as discussed on the compile doc page, or you will need settings in your Makefile to point to the fftMPI src directory.