[petsc-users] Usage of parallel FFT for doing batch 1d-FFTs over the columns of a dense 2d-matrix

Roland Richter roland.richter at ntnu.no
Fri Dec 4 04:32:19 CST 2020


I am currently working on a problem which requires a large amount of
transformations of a field E(r, t) from time space to Fourier space E(r,
w) and back. The field is described in a 2d-matrix, with the r-dimension
along the columns and the t-dimension along the rows.

For the transformation from time to frequency space and back I therefore
have to apply a 1d-FFT operation over each row of my matrix. For my
earlier attempts I used armadillo as matrix library and FFTW for doing
the transformations. Here I could use fftw_plan_many_dft to do all FFTs
at the same time. Unfortunately, armadillo does not support MPI, and
therefore I had to switch to PETSc for larger matrices.

Based on the examples (such as example 143) PETSc has a way of doing
FFTs internally by creating an FFT object (using MatCreateFFT).
Unfortunately, I can not see how I could use that object to conduct the
operation described above without having to iterate over each row in my
original matrix (i.e. doing it sequential, not in parallel).

Ideally I could distribute the FFTs such over my nodes that each node
takes several rows of the original matrix and applies the FFT to each of
them. As example, for a matrix with a size of 4x4 and two nodes node 0
would take row 0 and 1, while node 1 takes row 2 and 3, to avoid
unnecessary memory transfer between the nodes while conducting the FFTs.
Is that something PETSc can do, too?




More information about the petsc-users mailing list