Skip to content

vkFFT support

Compare
Choose a tag to compare
@f4exb f4exb released this 20 Aug 21:48
· 1222 commits to master since this release

vkFFT support

Thanks to PR #1779 from @srcejon this implements #1166 by adding support for running FFT on GPU using the VkFFT library, with either Vulkan or CUDA backend,

To allow easier performance comparisons, the FFTEngine and FFTFactory class have been updated to support multiple simultaneous FFTEngines, so a user can switch between FFTW, Kiss and VkFFT at run-time via a GUI option (Preferences > FFT). Also, different bits of SDRangel can request different FFTEngines. So FFTW could be used generally, but a specific plugin could request VkFFT if it thinks it will benefit from it.

Also a simple profiler has been added, that displays average execution time in a dialog (View > Profile Data...). Profiling is enabled via the cmake -DENABLE_PROFILER=ON option. It is disabled by default, and when disabled, there should be no performance impact as the profiling code is not included in the executable. It can also be used to easily profile other parts of SDRangel - here showing GL spectrum draw time, as well as FFT. To profille some code, you just need to stick the PROFILE_START() and PROFILE_STOP("name") macros around the code.

image

Whether VkFFT uses Vulkan or CUDA is a cmake option, -DVKFFT_BACKEND=0 for Vulkan and -DVKFFT_BACKEND=1 for CUDA. The code should compile without VkFFT if neither the Vulkan or CUDA SDKs are available.

On Windows, VkFFT is automatically downloaded as an external project. If external project is off, then it can be downloaded with:

cd /opt/build
git clone https://github.com/DTolm/VkFFT.git
cd VkFFT
git checkout v1.3.1

It's a header only library, so doesn't need to be built.

Either the Vulkan or CUDA SDKs need to be installed to compile it:

Linux Vulkan Setup

cd /opt/install
mkdir -p vulkansdk
cd vulkansdk
wget https://vulkan.lunarg.com/sdk/download/1.3.250.1/linux/vulkansdk-linux-x86_64-1.3.250.1.tar.gz
tar xf vulkansdk-linux-x86_64-1.3.250.1.tar.gz
source /opt/install/vulkansdk/1.3.250.1/setup-env.sh
...
cmake -DVKFFT_INCLUDE_DIR=/opt/build/VkFFT/vkFFT/ -DVKFFT_BACKEND=0 ..

Linux CUDA setup

Install CUDA toolkit from https://developer.nvidia.com/cuda-downloads
export PATH=/usr/local/cuda/bin:$PATH
...
cmake -DVKFFT_INCLUDE_DIR=/opt/build/VkFFT/vkFFT/ -DVKFFT_BACKEND=1 ..

Windows Vulkan Setup

Install Vulkan SDK (With optional 64-bit Debug libraries) from https://vulkan.lunarg.com/sdk/home#windows
Copy include\glslang\Include\glslang_c_interface. and include\glslang\Include\glslang_c_shader_types.h from Linux SDK as they are missing (See https://vulkan.lunarg.com/issue/view/63d158a85df11200d569b2ab)
set VULKAN_SDK=C:\VulkanSDK\1.3.250.1  (or where ever you installed it)
cmake -DVKFFT_BACKEND=0 ..

Windows CUDA Setup

Install CUDA toolkit from https://developer.nvidia.com/cuda-downloads (This creates CUDA_PATH environment variable)
cmake -DVKFFT_BACKEND=1 ..

Unfortunately, in many cases, using the GPU (via either Vulkan or CUDA) is much slower than using FFTW, due to the overhead of getting the data from the CPU to the GPU. It may be more beneficial on embedded SoCs that have unified memory and relatively slower CPUs, but this has not been tried. So there's no reason to try to enable this in the release builds now, but it's the first step towards GPU support.

Other changes and fixes

  • Rotator Controller: Add additional gamepad calibration and functionality. PR #1761from @srcejon
  • Use QFileInfo to get file extension. Fixes #1760. PR #1762 from @srcejon
  • Add UI scale factor setting for high DPI screens. PR #1763 from @srcejon
  • Support Map plugin for Qt 6.5. Some Qt 6.6 fixes. PR #1764 from @srcejon
  • Map plugin: Fix beacon frequency. PR #1765 from @dforsi
  • PlutoSDR MIMO: fix variable names. PR #1770 from @catkira
  • Rotator controller: use precision to determine step size. PR #1775 from @lrowen

Binary artifacts

For more details on artifacts and their contents please read the quick start in the Wiki.
Note that Ubuntu .deb package is for 22.04. Please note that SSE 4.2 is required.