penguinV icon indicating copy to clipboard operation
penguinV copied to clipboard

Add cache manager class for FFTExecutor

Open ihhub opened this issue 7 years ago • 1 comments

It's a known problem that a creation of FFT plans takes a lot of time compare to actual FFT computations. We have FFTExecutor class which locates in src/fft.h and src/fft.cpp files. What we need:

  1. add an extra static function to enable/disable caching for this class: static void enableCaching(); // enables internal caching allowing for faster FFT plan initialisation
  2. src/fft.cpp must contain an extra class within unnamed namespace called FFTExecutorCacheManager.
  3. This class contains a map: std::map< std:pair< uint32_t, uint32_t >, FFTExecutor > (a pair of width and height versus FFTExecutor).
  4. In FFTExecutor::initialize we check an existence (if caching is on) of FFTExecutor with width and height. If exist, we set for current FFTExecutor only width and height without creating a plan. If no we create a plan (current logic) and put *this into FFTExecutorCacheManager and destroy the plan in current FFTExecutor
  5. directTransform, inverseTransform and complexMultiplication functions must check the existence of FFTExecutor in FFTExecutorCacheManager. If exist then we redirect to the same functions but within FFTExecutorCacheManager. If doesn't exit, then we proceed with current logic.

ihhub avatar Oct 31 '18 03:10 ihhub

@MatthewMcGonagle would you like to have a try for this issue since you are very familiar with FFT code?

ihhub avatar Dec 03 '18 09:12 ihhub