Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFT wisdom enhancement #1024

Closed
srcejon opened this issue Oct 28, 2021 · 7 comments
Closed

FFT wisdom enhancement #1024

srcejon opened this issue Oct 28, 2021 · 7 comments
Assignees
Milestone

Comments

@srcejon
Copy link
Collaborator

srcejon commented Oct 28, 2021

Currently it seems:

  • an FFT wisdom file can only be specified from the command line
  • the wisdom file is only generated as part of the docker flow
  • fftwf-wisdom isn't included with the Windows installer
  • having a wisdom file can save ~1 second of start time or ~5-10 seconds when switching to a large FFT size (or much more on a slower machine)

So, I thought we could possibly:

  • Set MainParser::m_fftwfWindowFileName to a default value in QStandardPaths::AppDataLocation, that is opened if the file exists, but ignored otherwise. Can be overridden by the existing command line option.
  • Add fftwf-wisdom.exe in sdrangel-windows-libs and then include it in the installer
  • To make it a little more accessible for beginners, add a menu item in the GUI (Preferences>FFT perhaps) that pops open a dialog, that allows a user to specify FFT sizes and start fftwf-wisdom which will create the file in the appropriate place.
  • Or perhaps alternatively, on startup, if the default file doesn't exist (or is several months old), we could just run fftwf-wisdom automatically to create it.
@f4exb
Copy link
Owner

f4exb commented Oct 29, 2021

It is a must on Raspberry-Pi and more like a comfort on a desktop or laptop with enough juice to run SDRangel anyway. However this does not look too difficult apart from the packaging part of fftwf-wisdom.exe so why not making things a little easier. To locate fftwf-wisdom.exe or fftwf-wisdom (Linux) one could rely on the standard paths with QStandardPaths::findExecutable static method.

@srcejon
Copy link
Collaborator Author

srcejon commented Oct 29, 2021

To clarify, I was only suggesting including fftwf-wisdom.exe on Windows (because Windows users aren't likely to have it installed - whereas Linux users probably will if following the Linux install procedures).

I think all we need probably to do is put a copy of the .exe next to the .dll in sdrangel-windows-libraries\fftw-3 then add a rule in cpack/CMakeLists.txt to include it in the installer that copies it next to the dll?

@f4exb f4exb self-assigned this Nov 1, 2021
@f4exb
Copy link
Owner

f4exb commented Nov 4, 2021

Problem: in Windows QStandardPaths::locate segfaults if the file is not present (at; https://github.com/f4exb/sdrangel/blob/master/sdrgui/mainwindow.cpp#L193)

Also missing reset to nullptr after https://github.com/f4exb/sdrangel/blob/master/sdrgui/mainwindow.cpp#L1830

@srcejon
Copy link
Collaborator Author

srcejon commented Nov 4, 2021

Just running it here in a debug build. It seems QStandardPaths::locate returns "", with the exception coming a little after in the call to preAllocateFFTs:

image

@srcejon
Copy link
Collaborator Author

srcejon commented Nov 4, 2021

I get similar on Linux:

Thread 1 "sdrangel" received signal SIGSEGV, Segmentation fault.
0x00007ffff7682edf in std::pair<std::_Rb_tree_iterator<std::pair<unsigned int const, std::vector<FFTFactory::AllocatedEngine, std::allocatorFFTFactory::AllocatedEngine > > >, bool> std::_Rb_tree<unsigned int, std::pair<unsigned int const, std::vector<FFTFactory::AllocatedEngine, std::allocatorFFTFactory::AllocatedEngine > >, std::_Select1st<std::pair<unsigned int const, std::vector<FFTFactory::AllocatedEngine, std::allocatorFFTFactory::AllocatedEngine > > >, std::less, std::allocator<std::pair<unsigned int const, std::vector<FFTFactory::AllocatedEngine, std::allocatorFFTFactory::AllocatedEngine > > > >::_M_emplace_unique<std::pair<unsigned int, std::vector<FFTFactory::AllocatedEngine, std::allocatorFFTFactory::AllocatedEngine > > >(std::pair<unsigned int, std::vector<FFTFactory::AllocatedEngine, std::allocatorFFTFactory::AllocatedEngine > >&&) [clone .constprop.0] () from /opt/install/sdrangel/lib/sdrangel/libsdrbase.so
(gdb) info stack
#0 0x00007ffff7682edf in std::pair<std::_Rb_tree_iterator<std::pair<unsigned int const, std::vector<FFTFactory::AllocatedEngine, std::allocatorFFTFactory::AllocatedEngine > > >, bool> std::_Rb_tree<unsigned int, std::pair<unsigned int const, std::vector<FFTFactory::AllocatedEngine, std::allocatorFFTFactory::AllocatedEngine > >, std::_Select1st<std::pair<unsigned int const, std::vector<FFTFactory::AllocatedEngine, std::allocatorFFTFactory::AllocatedEngine > > >, std::less, std::allocator<std::pair<unsigned int const, std::vector<FFTFactory::AllocatedEngine, std::allocatorFFTFactory::AllocatedEngine > > > >::_M_emplace_unique<std::pair<unsigned int, std::vector<FFTFactory::AllocatedEngine, std::allocatorFFTFactory::AllocatedEngine > > >(std::pair<unsigned int, std::vector<FFTFactory::AllocatedEngine, std::allocatorFFTFactory::AllocatedEngine > >&&) [clone .constprop.0] ()
at /opt/install/sdrangel/lib/sdrangel/libsdrbase.so
#1 0x00007ffff759b727 in FFTFactory::preallocate(unsigned int, unsigned int, unsigned int, unsigned int) () at /opt/install/sdrangel/lib/sdrangel/libsdrbase.so
#2 0x00007ffff7e5a20e in MainWindow::MainWindow(qtwebapp::LoggerWithFile*, MainParser const&, QWidget*) () at /opt/install/sdrangel/lib/sdrangel/libsdrgui.so
#3 0x0000555555557084 in runQtApplication(int, char**, qtwebapp::LoggerWithFile*) ()
#4 0x00005555555566cb in main ()

@f4exb
Copy link
Owner

f4exb commented Nov 4, 2021

OK I think I've got it. It does not happen where I would expect. Apparently one needs to call m_dspEngine->createFFTFactory has to be called anyway whether the string is empty or not. The empty string case is handled in FFTWEngine and createFFTFactory does create the factory that is referenced later.

@f4exb f4exb added this to the v6.17.3 milestone Nov 4, 2021
@f4exb
Copy link
Owner

f4exb commented Nov 7, 2021

Implemented in v6.17.3

@f4exb f4exb closed this as completed Nov 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants