Project

General

Profile

Fosphor » History » Version 60

laforge, 02/21/2016 10:08 AM

1 59 laforge
h1. gr-fosphor
2 1 sylvain
3 58 ahuemer
GNU Radio block for RTSA-like spectrum visualization using [[OpenCL]] and [[OpenGL]] acceleration.
4 1 sylvain
5 1 sylvain
http://git.osmocom.org/gr-fosphor/
6 1 sylvain
7 51 sylvain
The block has been used successfully on Linux, OSX and Windows.
8 51 sylvain
9 59 laforge
h2.  Building
10 21 horiz0n
11 40 sylvain
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.
12 1 sylvain
13 59 laforge
h3. OS specific notes
14 51 sylvain
15 58 ahuemer
- For OSX you probably just want to use the gr-fosphor "port in macports":https://trac.macports.org/browser/trunk/dports/science/gr-fosphor/Portfile
16 52 sylvain
- 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.
17 51 sylvain
18 59 laforge
h3. GLFW3
19 21 horiz0n
20 21 horiz0n
Install dependencies
21 21 horiz0n
22 58 ahuemer
<pre>
23 24 horiz0n
sudo apt-get install cmake xorg-dev libglu1-mesa-dev
24 58 ahuemer
</pre>
25 24 horiz0n
26 21 horiz0n
Build GLFW
27 21 horiz0n
28 58 ahuemer
<pre>
29 21 horiz0n
git clone https://github.com/glfw/glfw
30 21 horiz0n
cd glfw
31 21 horiz0n
mkdir build
32 21 horiz0n
cd build
33 1 sylvain
cmake ../ -DBUILD_SHARED_LIBS=true
34 21 horiz0n
make
35 1 sylvain
sudo make install
36 1 sylvain
sudo ldconfig
37 58 ahuemer
</pre>
38 1 sylvain
39 59 laforge
h3. [[OpenCL]]
40 25 horiz0n
41 58 ahuemer
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.
42 1 sylvain
43 51 sylvain
All the implementations listed below have been successfully used with fosphor.
44 1 sylvain
45 59 laforge
h4. NVidia [[OpenCL]]
46 51 sylvain
47 58 ahuemer
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.
48 51 sylvain
49 58 ahuemer
* install "NVidia drivers":http://www.nvidia.com/object/unix.html
50 25 horiz0n
51 58 ahuemer
<pre>
52 1 sylvain
sudo apt-get install nvidia-opencl-dev opencl-headers
53 58 ahuemer
</pre>
54 1 sylvain
55 54 sylvain
For modern version of the distribution / drivers, you might also need :
56 54 sylvain
57 58 ahuemer
<pre>
58 54 sylvain
sudo apt-get install nvidia-modprobe
59 58 ahuemer
</pre>
60 54 sylvain
61 25 horiz0n
62 59 laforge
h4. AMD GPU [[OpenCL]]
63 51 sylvain
64 58 ahuemer
* install "AMD drivers":http://support.amd.com/en-us/download (13.4, 13.11 beta6, 13.12, 14.10 and 14.12 drivers are known to work on linux)
65 58 ahuemer
* install "AMD APP SDK":http://developer.amd.com/tools-and-sdks/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/
66 1 sylvain
67 1 sylvain
68 58 ahuemer
==== Intel GPU [[OpenCL]]
69 1 sylvain
70 58 ahuemer
* fosphor has been confirmed to work with Iris graphics on OSX.
71 58 ahuemer
* It also has been used on linux using the "beignet opencl":http://www.freedesktop.org/wiki/Software/Beignet/
72 58 ahuemer
** It doesn't support CL/GL sharing though, even if you're using the Intel GPU for display
73 58 ahuemer
** Performance was disappointing on linux though, there seem to be an unidentified bottleneck.
74 51 sylvain
75 51 sylvain
76 59 laforge
h4. Intel CPU [[OpenCL]]
77 51 sylvain
78 58 ahuemer
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.
79 51 sylvain
80 58 ahuemer
See "this page":https://software.intel.com/en-us/vcsource/tools/opencl-sdk
81 56 ahuemer
82 56 ahuemer
83 59 laforge
h5. Installation instructions
84 56 ahuemer
85 58 ahuemer
Download the latest [[OpenCL]] runtime from "intel.com":https://software.intel.com/en-us/articles/opencl-drivers.
86 56 ahuemer
87 56 ahuemer
In November 2015 it was opencl_runtime_14.2_x64_4.5.0.8.tgz.
88 56 ahuemer
89 56 ahuemer
That archive contains a rpm subdirectory with several .rpm files.
90 56 ahuemer
91 1 sylvain
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).
92 56 ahuemer
93 56 ahuemer
Then selectively install parts of the content of those archives in your system.
94 56 ahuemer
95 58 ahuemer
<pre>
96 56 ahuemer
$ mkdir $HOME/tmp
97 56 ahuemer
$ cd $HOME/tmp
98 56 ahuemer
$ wget http://registrationcenter.intel.com/irc_nas/4181/opencl_runtime_14.2_x64_4.5.0.8.tgz
99 56 ahuemer
$ tar xf opencl_runtime_14.2_x64_4.5.0.8.tgz
100 56 ahuemer
$ cd pset_opencl_runtime_14.1_x64_4.5.0.8/rpm
101 56 ahuemer
$ alien --to-tgz opencl-1.2-base-pset-4.5.0.8-1.noarch.rpm
102 56 ahuemer
$ tar xf opencl-1.2-base-4.5.0.8.tgz
103 1 sylvain
$ sudo mv /opt/intel /opt
104 56 ahuemer
$ rm -rf opt
105 56 ahuemer
$ alien --to-tgz opencl-1.2-intel-cpu-4.5.0.8-1.x86_64.rpm
106 56 ahuemer
$ tar xf opencl-1.2-intel-cpu-4.5.0.8.tgz
107 56 ahuemer
$ sudo mkdir -p /etc/OpenCL/vendors
108 56 ahuemer
$ sudo mv opt/intel/opencl-1.2-4.5.0.8/etc/intel64.icd /etc/OpenCL/vendors/
109 56 ahuemer
$ sudo mv opt/intel/opencl-1.2-4.5.0.8/lib64/* /opt/intel/opencl-1.2-4.5.0.8/lib64/
110 51 sylvain
$ rm -rf opt
111 58 ahuemer
</pre>
112 51 sylvain
113 59 laforge
h4. AMD CPU [[OpenCL]]
114 51 sylvain
115 58 ahuemer
AMD also has a CPU [[OpenCL]] implementation see "this page":http://developer.amd.com/tools-and-sdks/opencl-zone/ 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.
116 1 sylvain
117 51 sylvain
118 59 laforge
h4. pocl
119 51 sylvain
120 58 ahuemer
"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.
121 51 sylvain
122 51 sylvain
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.
123 1 sylvain
124 1 sylvain
125 59 laforge
h4. [[FreeOCL]]
126 51 sylvain
127 58 ahuemer
[http://code.google.com/p/freeocl/":http://portablecl.org/]
128 51 sylvain
129 58 ahuemer
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.
130 1 sylvain
131 1 sylvain
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.
132 51 sylvain
133 51 sylvain
134 59 laforge
h3. gr-fosphor
135 51 sylvain
136 25 horiz0n
Build gr-fosphor
137 25 horiz0n
138 57 ahuemer
Build dependencies: gnuradio-dev, opencl-headers, libboost-system-dev, libboost-thread-dev.
139 57 ahuemer
140 58 ahuemer
<pre>
141 21 horiz0n
git clone git://git.osmocom.org/gr-fosphor
142 21 horiz0n
cd gr-fosphor
143 21 horiz0n
mkdir build
144 37 sylvain
cd build
145 21 horiz0n
cmake ..
146 1 sylvain
make
147 21 horiz0n
sudo make install
148 1 sylvain
sudo ldconfig
149 58 ahuemer
</pre>
150 1 sylvain
151 1 sylvain
Build benchmark tool
152 1 sylvain
153 21 horiz0n
Build dependencies: libglfw3-dev.
154 57 ahuemer
155 58 ahuemer
<pre>
156 1 sylvain
cd gr-fosphor/lib/fosphor
157 1 sylvain
make LDFLAGS=-L/opt/intel/opencl-1.2-4.5.0.8/lib64
158 58 ahuemer
</pre>
159 1 sylvain
160 25 horiz0n
Fosphor is known to build successfully on Linux, OSX and Windows.
161 46 sylvain
162 59 laforge
h4. Known issues
163 1 sylvain
164 59 laforge
* 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@)
165 59 laforge
* 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.
166 1 sylvain
167 59 laforge
h2. Screenshots
168 2 sylvain
169 59 laforge
h3. Short video examples
170 1 sylvain
171 1 sylvain
http://www.youtube.com/watch?v=mjD-l3GAghU
172 15 sylvain
173 1 sylvain
<pre>
174 58 ahuemer
<code class="html">
175 58 ahuemer
<iframe width="960" height="720" src="http://www.youtube.com/embed/mjD-l3GAghU" frameborder="0" allowfullscreen></iframe>
176 1 sylvain
</code></pre>
177 58 ahuemer
178 59 laforge
h3. osmocom_fft in fosphor mode
179 15 sylvain
180 15 sylvain
Those are when enabling the integrated 'fosphor' mode of osmocom_fft through the -F command line option
181 1 sylvain
182 60 laforge
!fosphor.png!
183 51 sylvain
184 60 laforge
!fosphor2.png!
185 3 horiz0n
186 59 laforge
h2. Bandwidth figures
187 59 laforge
188 3 horiz0n
There's a benchmark program available which allows to estimate the maximal bandwidth that can be processed with a specific GPU.
189 3 horiz0n
190 3 horiz0n
To build it:
191 3 horiz0n
192 58 ahuemer
<pre>
193 3 horiz0n
cd gr-fosphor/lib/fosphor
194 3 horiz0n
make
195 58 ahuemer
</code></pre>
196 3 horiz0n
197 3 horiz0n
Then execute it by providing a prerecorded complex float file (a couple of 100MB should be fine) in gnuradio format.
198 3 horiz0n
199 58 ahuemer
<pre>
200 3 horiz0n
./main some.cfile
201 58 ahuemer
</code></pre>
202 3 horiz0n
203 14 horiz0n
Try to leave the window to its default size if possible and watch out for the Msps numbers printed out to the console.
204 14 horiz0n
205 14 horiz0n
Submit your numbers & help us to create a GPU survey. We are especially interested in the top end and mobile graphics figures.
206 3 horiz0n
207 59 laforge
|*CPU*|*GPU*|*Msps*||
208 59 laforge
|?|AMD R290(X)|WANTED||
209 59 laforge
|?|NVidia Titan|WANTED||
210 59 laforge
|i7-4770K 3.5 GHz|NVidia GeForce GTX 760|~228|
211 59 laforge
|?|AMD Radeon HD 7970 (Tahiti)|~220|
212 59 laforge
|i5-3570K 3.4 GHz|AMD Radeon HD 7870 (Tahiti)|~220|
213 59 laforge
|i7-3770K 3.4 GHz|Nvidia GTX 660|~202|
214 59 laforge
|i7-3770K 3.4 Ghz|Nvidia GTX 760|~191|
215 59 laforge
|i7-4770K 3.5 GHz|Nvidia GTX 650 Ti Boost|~188|
216 59 laforge
|i5-2500 3.3 GHz|NVidia GTX 460 SE|~129|
217 59 laforge
|i5-3570K 3.4GHz|AMD Radeon HD 7870 (Pitcairn)|~112|
218 59 laforge
|i5-2500 3.3GHz|NVidia GTX 550 Ti|~110|
219 59 laforge
|i5-2500k 3.8GHz|AMD Radeon HD 6850|~100|
220 59 laforge
|?|NVidia GTX 550 Ti|~97|
221 59 laforge
|QC Xeon 2 GHz|Nvidia GeForce 560 Ti|~73|
222 59 laforge
|C2D 2.66 GHz|NVidia GeForce GT 640 (GK107)|~67|
223 59 laforge
|i5 2.4 GHz|Intel Iris Pro 5100|~65|
224 59 laforge
|i7-3610QM|NVidia GeForce GT 640M LE|~63|
225 59 laforge
|i7-950 3.06 GHz|NVidia GT9800|~61|
226 59 laforge
|i5-2500K 4.2 GHz|AMD Radeon HD 6570|~58|
227 59 laforge
|C2D 3.00GHz|NVidia GeForce 9800 GT|~47|
228 59 laforge
|i5-2520M 2.5 GHz|NVidia GF119M|~46|
229 59 laforge
|C2D 2.4GHz|NVidia 9600M GT|~31|
230 59 laforge
|i5-3320M|Intel CPU [[OpenCL]]|~24|
231 59 laforge
|?|NVidia GT330M|~22|
232 59 laforge
|?|NVidia 8600GT|~15|
233 59 laforge
|C2D 2.2GHz|NVidia NVS 140M|~14|
234 59 laforge
|AMD E350 Fusion APU|AMD Radeon 6310|~12|
235 59 laforge
|C2Q Q9650 3.00GHz|!GeForce 9300 GE|~11|
236 59 laforge
|Atom 330|NVidia ION|~10|
Add picture from clipboard (Maximum size: 48.8 MB)