Fosphor » History » Revision 57

« Previous | Revision 57/66 (diff) | Next »
ahuemer, 02/19/2016 10:50 PM
Specify build dependencies

= gr-fosphor

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.

=== GLFW3

Install dependencies

sudo apt-get install cmake xorg-dev libglu1-mesa-dev

Build GLFW

git clone
cd glfw
mkdir build
cd build
cmake ../ -DBUILD_SHARED_LIBS=true
sudo make install
sudo ldconfig

=== OpenCL

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.

==== NVidia OpenCL

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.

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

==== 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]

===== Installation instructions

Download the latest OpenCL runtime from [].

In November 2015 it was opencl_runtime_14.2_x64_4.5.0.8.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
$ tar xf opencl_runtime_14.2_x64_4.5.0.8.tgz
$ cd pset_opencl_runtime_14.1_x64_4.5.0.8/rpm
$ alien --to-tgz opencl-1.2-base-pset-
$ tar xf opencl-1.2-base-
$ sudo mv /opt/intel /opt
$ rm -rf opt
$ alien --to-tgz opencl-1.2-intel-cpu-
$ tar xf opencl-1.2-intel-cpu-
$ sudo mkdir -p /etc/OpenCL/vendors
$ sudo mv opt/intel/opencl-1.2- /etc/OpenCL/vendors/
$ sudo mv opt/intel/opencl-1.2-* /opt/intel/opencl-1.2-
$ 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.

==== pocl


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.

==== FreeOCL


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.

=== gr-fosphor

Build gr-fosphor

Build dependencies: gnuradio-dev, opencl-headers, libboost-system-dev, libboost-thread-dev.

git clone git://
cd gr-fosphor
mkdir build
cd build
cmake ..
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-

Fosphor is known to build successfully on Linux, OSX and Windows.

==== Known issues

  • 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/}}} )
  • 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/ osmocom_fft -F}}} (path may vary). C++ flowgraphs are not affected.
Screenshots = Short video examples

<iframe width="960" height="720" src="" frameborder="0" allowfullscreen></iframe>

=== osmocom_fft in fosphor mode

Those are when enabling the integrated 'fosphor' mode of osmocom_fft through the -F command line option


== Bandwidth figures

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

Then execute it by providing a prerecorded complex float file (a couple of 100MB should be fine) in gnuradio format.

./main some.cfile

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.

'''CPU''' '''GPU''' '''Msps'''
? NVidia Titan WANTED
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
? NVidia GT330M ~22
? NVidia 8600GT ~15
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
Files (2)
fosphor.png View fosphor.png 433 KB laforge, 02/21/2016 10:08 AM
fosphor2.png View fosphor2.png 480 KB laforge, 02/21/2016 10:08 AM

Updated by ahuemer about 8 years ago · 57 revisions

Add picture from clipboard (Maximum size: 48.8 MB)