0

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?

Cris Luengo
  • 55,762
  • 10
  • 62
  • 120
Torrance
  • 450
  • 4
  • 11
  • Is it worth the hassle to figure this out, rather than just loop over the array? You can plan for a single 2D transform, then apply it to each of the sub-arrays using [`fftw_execute_dft`](https://www.fftw.org/fftw3_doc/New_002darray-Execute-Functions.html). Just watch out for the alignment, if sub-arrays are not aligned in the same way, you need to tell the planner to not assume alignment, as described in the linked page. – Cris Luengo Jul 05 '23 at 16:24
  • @CrisLuengo It *may* be worth the hassle. When using a GPU backend for the ffts, the overhead of repeated calls to the GPU may be proportionally high for large N, especially since these are typically small 2D transformations. (Without being able to benchmark this, I can't know for sure.) – Torrance Jul 06 '23 at 01:12
  • FFTW's guru interface allows it. – smitsyn Jul 12 '23 at 15:47

0 Answers0