Batching multiple 2D FFT's from within a 4D array using planMany() from FFTW/cuFFT

56 Views Asked by At

I have a 4D array of dimensions (N, 128, 128, 4) and I want to perform a 2D FFT for the two middle dimensions. My question: is it possible to do this with the xxxPlanMany() function from FFTW/cuFFT/hipFFT as a single call?

As a simpler example, if I have 3D an array of size (128, 128, 4), I can construct an FFT plan in the following way using HIP (whether this is FFTW/cuFFT/hipFFT doesn't matter, these all share the same interface):

hipfftHandle plan {};
int rank[] {128, 128};
hipfftPlanMany(
    &plan, 2, rank,
    rank, 4, 1,
    rank, 4, 1,
    HIPFFT_Z2Z, 4
);

This will perform 4, 2D transformations of size 128 x 128. However, for the larger 4D array of size (N, 128, 128, 4), I would need to call this plan N times if I were to use this plan.

Is there a way to construct a plan which does the full 4 * N FFTs without looping?

0

There are 0 best solutions below