GNU Radio block for RTSA-like spectrum visualization using OpenCL and OpenGL acceleration.
The block has been used successfully on Linux, OSX and Windows.
Warning: Mixed prefix install is not supported. You need to install gr-fosphor in the same prefix as your GNU Radio install. If you used build-gnuradio this will be /usr/local and this is what's used in the instructions below. If you use a packaged version of GNU Radio, it's most likely /usr and the best way is then to make a package for gr-fosphor for your distribution.
OS specific notes
- For OSX you probably just want to use the gr-fosphor port in macports
- For Windows you can't use the Visual C++ compiler due to some C99 constructs used in the code that it doesn't support (I mean, it's only been 15 years, you can't expect microsoft to support that bleeding edge stuff). You can use ICC or compile the C part manually using clang. It has been done, so it's possible albeit not trivial.
sudo apt-get install cmake xorg-dev libglu1-mesa-dev
git clone https://github.com/glfw/glfw cd glfw mkdir build cd build cmake ../ -DBUILD_SHARED_LIBS=true make sudo make install sudo ldconfig
To run fosphor, you need an OpenCL implementation. This can be either a GPU implementation (which will often be the faster option), or a CPU implementation. If available, fosphor will also make use of the CL/GL sharing extension allowing to transfer data efficiently between the OpenCL compute kernels and the OpenGL rendering.
All the implementations listed below have been successfully used with fosphor.
The NVidia implementation is provided by the binary drivers and support CL/GL sharing very well. Unfortunately the 'nouveau' open-source drivers don't provide OpenCL yet.
- install NVidia drivers
sudo apt-get install nvidia-opencl-dev opencl-headers
For modern version of the distribution / drivers, you might also need :
sudo apt-get install nvidia-modprobe
AMD GPU OpenCL
- install AMD drivers (13.4, 13.11 beta6, 13.12, 14.10 and 14.12 drivers are known to work on linux)
- install AMD APP SDK
Intel GPU OpenCL
- fosphor has been confirmed to work with Iris graphics on OSX.
- It also has been used on linux using the beignet opencl
- It doesn't support CL/GL sharing though, even if you're using the Intel GPU for display
- Performance was disappointing on linux though, there seem to be an unidentified bottleneck.
Intel CPU OpenCL
Intel offers a CPU OpenCL implementation. You need a CPU capable of at least SSE 4.2 to be able to use it. This implementation has been confirmed working with fosphor and is the highest performance of all the CPU OpenCL implementation.
See this page
Download the latest OpenCL runtime from intel.com.
In November 2015 it was opencl_runtime_14.2_x64_184.108.40.206.tgz.
That archive contains a rpm subdirectory with several .rpm files.
Extract the content of the following files, e.g. by first converting them to a .tgz with alien(1) to be able to then use tar(1).
Then selectively install parts of the content of those archives in your system.
$ mkdir $HOME/tmp $ cd $HOME/tmp $ wget http://registrationcenter.intel.com/irc_nas/4181/opencl_runtime_14.2_x64_220.127.116.11.tgz $ tar xf opencl_runtime_14.2_x64_18.104.22.168.tgz $ cd pset_opencl_runtime_14.1_x64_22.214.171.124/rpm $ alien --to-tgz opencl-1.2-base-pset-126.96.36.199-1.noarch.rpm $ tar xf opencl-1.2-base-188.8.131.52.tgz $ sudo mv /opt/intel /opt $ rm -rf opt $ alien --to-tgz opencl-1.2-intel-cpu-184.108.40.206-1.x86_64.rpm $ tar xf opencl-1.2-intel-cpu-220.127.116.11.tgz $ sudo mkdir -p /etc/OpenCL/vendors $ sudo mv opt/intel/opencl-1.2-18.104.22.168/etc/intel64.icd /etc/OpenCL/vendors/ $ sudo mv opt/intel/opencl-1.2-22.214.171.124/lib64/* /opt/intel/opencl-1.2-126.96.36.199/lib64/ $ rm -rf opt
AMD CPU OpenCL
AMD also has a CPU OpenCL implementation see this page for details. It's not quite as fast as the Intel one, but it doesn't require SSE 4.2 which allows it to be used on older processors.
This is a free-software OpenCL CPU implementation. It's not where as performant as the Intel/AMD ones, but it's opensource and supported on any platform.
Note that at the time of writing, you need the git version to use fosphor with it due to a very recently fixed memory leak that fosphor triggers.
This is another free-software OpenCL CPU implementation that's also been verified to work with fosphor. It uses whatever C++ compiler is installed on the system as the code generation backend.
Again, at the time of writing, you need the latest SVN version to use fosphor with it due to some recently fixed bugs that fosphor triggers.
Build dependencies: gnuradio-dev, opencl-headers, libboost-system-dev, libboost-thread-dev.
git clone git://git.osmocom.org/gr-fosphor cd gr-fosphor mkdir build cd build cmake .. make sudo make install sudo ldconfig
Build benchmark tool
Build dependencies: libglfw3-dev.
cd gr-fosphor/lib/fosphor make LDFLAGS=-L/opt/intel/opencl-1.2-188.8.131.52/lib64
Fosphor is known to build successfully on Linux, OSX and Windows.
- Some version of ubuntu (like 13.10) have screwed up OpenCL dev files setup and it might be required to manually specify a path to the actual OpenCL library during the cmake step ( like -DOPENCL_LIBRARY=/usr/lib/nvidia-304/libOpenCL.so )
- When running python flowgraphs on machines with AMD graphics (fglrx driver) and UHD enabled in gr-osmosdr you may experience the following error [!] CL Error (-1001, fosphor/cl.c:268): Unable to fetch platform IDs. This is due to TLS sections in both, AMD OpenCL library and UHD library interfering with each other. A workaround is available through preloading the AMD OpenCL library LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libamdocl64.so osmocom_fft -F (path may vary). C++ flowgraphs are not affected.
Short video examples
osmocom_fft in fosphor mode
Those are when enabling the integrated 'fosphor' mode of osmocom_fft through the -F command line option
There's a benchmark program available which allows to estimate the maximal bandwidth that can be processed with a specific GPU.
To build it:
cd gr-fosphor/lib/fosphor make
Then execute it by providing a prerecorded complex float file (a couple of 100MB should be fine) in gnuradio format.
Try to leave the window to its default size if possible and watch out for the Msps numbers printed out to the console.
Submit your numbers & help us to create a GPU survey. We are especially interested in the top end and mobile graphics figures.
|i7-4770K 3.5 GHz||NVidia GeForce GTX 760||~228|
|?||AMD Radeon HD 7970 (Tahiti)||~220|
|i5-3570K 3.4 GHz||AMD Radeon HD 7870 (Tahiti)||~220|
|i7-3770K 3.4 GHz||Nvidia GTX 660||~202|
|i7-3770K 3.4 Ghz||Nvidia GTX 760||~191|
|i7-4770K 3.5 GHz||Nvidia GTX 650 Ti Boost||~188|
|i5-2500 3.3 GHz||NVidia GTX 460 SE||~129|
|i5-3570K 3.4GHz||AMD Radeon HD 7870 (Pitcairn)||~112|
|i5-2500 3.3GHz||NVidia GTX 550 Ti||~110|
|i5-2500k 3.8GHz||AMD Radeon HD 6850||~100|
|?||NVidia GTX 550 Ti||~97|
|QC Xeon 2 GHz||Nvidia GeForce 560 Ti||~73|
|C2D 2.66 GHz||NVidia GeForce GT 640 (GK107)||~67|
|i5 2.4 GHz||Intel Iris Pro 5100||~65|
|i7-3610QM||NVidia GeForce GT 640M LE||~63|
|i7-950 3.06 GHz||NVidia GT9800||~61|
|i5-2500K 4.2 GHz||AMD Radeon HD 6570||~58|
|C2D 3.00GHz||NVidia GeForce 9800 GT||~47|
|i5-2520M 2.5 GHz||NVidia GF119M||~46|
|C2D 2.4GHz||NVidia 9600M GT||~31|
|i5-3320M||Intel CPU OpenCL||~24|
|C2D 2.2GHz||NVidia NVS 140M||~14|
|AMD E350 Fusion APU||AMD Radeon 6310||~12|
|C2Q Q9650 3.00GHz||GeForce 9300 GE||~11|
|Atom 330||NVidia ION||~10|