I am currently working on a problem that involves calculating the Fourier Transform of a 2-dimensional Matrix using FFTW in conjunction with MPI.
According to the first section of this page of the FFTW documentation, computing the FT of a matrix requires a lot of communication among the launched processes when it is parallelized. For example, in the case of a matrix such as
1,2,3
4,5,6
7,8,9
the FFT of which we decided to compute with three processes, each process gets a chunk of this matrix so that the data is stored in the local memory of each process as P_0 [1,2,3], P_1 [4,5,6], P_3 [7,8,9].
After computing the initial Fourier Transform, a transposition is calculated which requires the communication of the computed data among the three processes as following:
P_0 -> P_1: 2
P_0 -> P_2: 3
P_1 -> P_0: 4
P_1 -> P_2: 6
P_2 -> P_0: 7
P_2 -> P_1: 8
Since this incurs a large overhead, the second section of the abovementioned FFTW documentation page suggests to calculate the transpose directly in the fourier space to drastically reduce the amount of cross-process communication required.
I am still unsure as to why exactly the calculation of a transpose is necessary in the first place, and how the data calculated from the different chunks of the matrix is merged in the end. Why is it enough to set the FFTW_MPI_TRANSPOSED_OUT and FFTW_MPI_TRANSPOSED_IN flags to not require cross process communication anymore, even though before the processes needed so much more data from all the other processes?