wiki:fosphor

gr-fosphor

GNU Radio block for RTSA-like spectrum visualization using OpenCL and OpenGL acceleration.

http://git.osmocom.org/gr-fosphor/

The block has been used successfully on Linux, OSX and Windows.

Building

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 https://github.com/glfw/glfw
cd glfw
mkdir build
cd build
cmake ../ -DBUILD_SHARED_LIBS=true
make
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 intel.com.

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 http://registrationcenter.intel.com/irc_nas/4181/opencl_runtime_14.2_x64_4.5.0.8.tgz
$ 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-4.5.0.8-1.noarch.rpm
$ tar xf opencl-1.2-base-4.5.0.8.tgz
$ sudo mv /opt/intel /opt
$ rm -rf opt
$ alien --to-tgz opencl-1.2-intel-cpu-4.5.0.8-1.x86_64.rpm
$ tar xf opencl-1.2-intel-cpu-4.5.0.8.tgz
$ sudo mkdir -p /etc/OpenCL/vendors
$ sudo mv opt/intel/opencl-1.2-4.5.0.8/etc/intel64.icd /etc/OpenCL/vendors/
$ sudo mv opt/intel/opencl-1.2-4.5.0.8/lib64/* /opt/intel/opencl-1.2-4.5.0.8/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.

pocl

http://portablecl.org/

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

http://code.google.com/p/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://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-4.5.0.8/lib64

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/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.

Screenshots

Short video examples

http://www.youtube.com/watch?v=mjD-l3GAghU

osmocom_fft in fosphor mode

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

LTE carrier GSM900 band

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
make

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.

CPUGPUMsps
?AMD R290(X)WANTED
?NVidia TitanWANTED
i7-4770K 3.5 GHzNVidia GeForce GTX 760~228
?AMD Radeon HD 7970 (Tahiti)~220
i5-3570K 3.4 GHzAMD Radeon HD 7870 (Tahiti)~220
i7-3770K 3.4 GHzNvidia GTX 660~202
i7-3770K 3.4 GhzNvidia GTX 760~191
i7-4770K 3.5 GHzNvidia GTX 650 Ti Boost~188
i5-2500 3.3 GHzNVidia GTX 460 SE~129
i5-3570K 3.4GHzAMD Radeon HD 7870 (Pitcairn)~112
i5-2500 3.3GHzNVidia GTX 550 Ti~110
i5-2500k 3.8GHzAMD Radeon HD 6850~100
?NVidia GTX 550 Ti~97
QC Xeon 2 GHzNvidia GeForce 560 Ti~73
C2D 2.66 GHzNVidia GeForce GT 640 (GK107)~67
i5 2.4 GHzIntel Iris Pro 5100~65
i7-3610QMNVidia GeForce GT 640M LE~63
i7-950 3.06 GHzNVidia GT9800~61
i5-2500K 4.2 GHzAMD Radeon HD 6570~58
C2D 3.00GHzNVidia GeForce 9800 GT~47
i5-2520M 2.5 GHzNVidia GF119M~46
C2D 2.4GHzNVidia 9600M GT~31
i5-3320MIntel CPU OpenCL~24
?NVidia GT330M~22
?NVidia 8600GT~15
C2D 2.2GHzNVidia NVS 140M~14
AMD E350 Fusion APUAMD Radeon 6310~12
C2Q Q9650 3.00GHzGeForce 9300 GE~11
Atom 330NVidia ION~10
Last modified 8 months ago Last modified on Nov 28, 2015, 4:06:57 PM