penguinV
penguinV copied to clipboard
Add cache manager class for FFTExecutor
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:
- add an extra static function to enable/disable caching for this class:
static void enableCaching(); // enables internal caching allowing for faster FFT plan initialisation src/fft.cppmust contain an extra class within unnamed namespace calledFFTExecutorCacheManager.- This class contains a map:
std::map< std:pair< uint32_t, uint32_t >, FFTExecutor >(a pair of width and height versus FFTExecutor). - In
FFTExecutor::initializewe check an existence (if caching is on) ofFFTExecutorwith width and height. If exist, we set for currentFFTExecutoronly width and height without creating a plan. If no we create a plan (current logic) and put*thisintoFFTExecutorCacheManagerand destroy the plan in currentFFTExecutor directTransform,inverseTransformandcomplexMultiplicationfunctions must check the existence ofFFTExecutorinFFTExecutorCacheManager. If exist then we redirect to the same functions but withinFFTExecutorCacheManager. If doesn't exit, then we proceed with current logic.
@MatthewMcGonagle would you like to have a try for this issue since you are very familiar with FFT code?