These fftMPI methods create and destroy an instance of the FFT3d or FFT2d class. The code examples are for 3d FFTs. Just replace "3d" by "2d" for 2d FFTs.
Multiple instances can be instantiated by the calling program, e.g. if you need to define FFTs with different input or output layouts of data across processors or to run on different subsets of processors. The MPI communicator argument for the constructor defines the set of processors which share the FFT data and perform the parallel FFT.
API:
FFT3d(MPI_Comm comm, int precision); // constructor ~FFT3d(); // destructor
The comm argument in the constructor is an MPI communicator. The precision argument is 1 for single-precision (two 32-bit floating point numbers = 1 complex datum), and 2 for double-precision (two 64-bit floating point numbers = 1 complex datum). The precision is checked by the fftMPI library to insure it was compiled with a matching precision. See the compile doc page for how to compile fftMPI for single versus double precision.
C++:
MPI_Comm world = MPI_COMM_WORLD; int precision = 2;
FFT3d *fft = new FFT3d(world,precision); delete fft;
C:
MPI_Comm world = MPI_COMM_WORLD; int precision = 2; void *fft;
fft3d_create(world,precision,&fft); fft3d_destroy(fft);
Fortran:
integer world,precision type(c_ptr) :: fft
world = MPI_COMM_WORLD precision = 2
call fft3d_create(world,precision,fft) call fft3d_destroy(fft)
Python:
from mpi4py import MPI
world = MPI.COMM_WORLD precision = 2
fft = FFT3dMPI(world,precision) del fft