FFTW 3.3.8: Linking and Initializing MPI FFTW

Next: 2d MPI example, Previous: FFTW MPI Installation, Up: Distributed-memory FFTW with MPI [Contents][Index]

### 6.2 Linking and Initializing MPI FFTW

Programs using the MPI FFTW routines should be linked with `-lfftw3_mpi -lfftw3 -lm` on Unix in double precision, `-lfftw3f_mpi -lfftw3f -lm` in single precision, and so on (see Precision). You will also need to link with whatever library is responsible for MPI on your system; in most MPI implementations, there is a special compiler alias named `mpicc` to compile and link MPI code.

Before calling any FFTW routines except possibly `fftw_init_threads` (see Combining MPI and Threads), but after calling `MPI_Init`, you should call the function:

    void fftw_mpi_init(void);

If, at the end of your program, you want to get rid of all memory and other resources allocated internally by FFTW, for both the serial and MPI routines, you can call:

    void fftw_mpi_cleanup(void);

which is much like the `fftw_cleanup()` function except that it also gets rid of FFTW’s MPI-related data. You must not execute any previously created plans after calling this function.