hackrf icon indicating copy to clipboard operation
hackrf copied to clipboard

hackrf_sweep: add fftw wisdom support

Open gozu42 opened this issue 3 years ago • 1 comments

(mainly a tracking issue to keep my thoughts/code and potential feedback on this in one place, not sure i can tag it enhancement myself)

currently hackrf_sweep uses fttw plans generated at startup, in MEASURE mode. this leads to serious delays for some binwidth on some platforms (raspi). for an example binwidth of 10kHz (fftsize 2004) the delay is ~33sec on a raspi, on a pc the same only takes 200ms.

fftw has a "wisdom" mechanism that allows saving fft plans to disk. it handles "does this wisdom work for the requested fft config" on its own, so the same wisdom file could be used even when changing binwidth.

while at it, i would like to expose the different planner flags (estimate, measure, patient, exhaustive) as a commandline option. and also add an option that prints the current plan. (fftw provides a mechanism for that)

the fftw wisdom api is a bit awkward, so the only way i see is to first try to plan with the WISDOM_ONLY flag, which returns NULL if no matching plan is found in wisdom, and in that case plan again without WISDOM_ONLY and write the now-new wisdom out to the given file.

a commandline way to study the planner performance outside of hackrf_sweep is: time fftwf-wisdom -m cof2004

gozu42 avatar Mar 23 '21 22:03 gozu42

trying to summarize the discussion we just had about this on discord.

  • a commandline option to set a wisdom file name like "-W wfn"
  • the wfn default to something in platform-specific tempdir
  • defaulting to tempdir means users are less likely to end up with an outdated/bogus wisdom file
  • it also means after each reboot (or other clearing of tempdir) the first sweep will be "slow" again
  • handle errors during save+load gracefully (there is just too much that can go wrong in all kinds of weirds way, just print an oops and move on, but dont fail hard)

gozu42 avatar Jan 27 '22 16:01 gozu42