Understanding Gnuradio Web: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
(Created page with "== <span class="c3">What is gnuradio-web</span> == <span class="c4"></span> <span class="c19">It moves the whole workspace to the browser and enables you to run gnuradio </span><span class="c6">out of the box.</span> <span class="c4">In the expected view, you could do everything on gnuradio same on gnuradio-web, like define your own SDR.</span> <span class="c4">But currently, the gnuradio-web is still working in the process. there is still a lack of function with gnu...")
 
(This wiki intend to grab the how gnuradio-web work and how to accelerate current gnuradio-web)
 
Line 28: Line 28:
<span class="c10">We compile the dependency package to python and then collect the CPython to wasm type. Finally, we will call the main method in grc/main.py.</span><span class="c2">[https://www.google.com/url?q=https://github.com/marcnewlin/gnuradio-web/blob/update-to-current-grc-qt/grc-dev/gnuradio/grc/main.py&sa=D&source=editors&ust=1663260466127022&usg=AOvVaw1ke9YlDBokj_WkGgstg10U gnuradio-web/main.py at update-to-current-grc-qt · marcnewlin/gnuradio-web (github.com)]</span>
<span class="c10">We compile the dependency package to python and then collect the CPython to wasm type. Finally, we will call the main method in grc/main.py.</span><span class="c2">[https://www.google.com/url?q=https://github.com/marcnewlin/gnuradio-web/blob/update-to-current-grc-qt/grc-dev/gnuradio/grc/main.py&sa=D&source=editors&ust=1663260466127022&usg=AOvVaw1ke9YlDBokj_WkGgstg10U gnuradio-web/main.py at update-to-current-grc-qt · marcnewlin/gnuradio-web (github.com)]</span>
[[File:Understanding_Gnuradio_Web_Flow.png]]
[[File:Understanding_Gnuradio_Web_Flow.png]]
== <span class="c3"></span> ==
 


== <span class="c3">How to acceleration gnuradio-web</span> ==
== <span class="c3">How to acceleration gnuradio-web</span> ==
Line 39: Line 39:
* <span>The basic view is to add another compilation flag in the whole compile process to avoid extra size costs. Like (-Oz -Os) </span><span class="c2">[https://www.google.com/url?q=https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html&sa=D&source=editors&ust=1663260466128277&usg=AOvVaw0UMxI2rLAckoCRcEWZEvf0 Optimize Options (Using the GNU Compiler Collection (GCC))]</span><span class="c4"> </span>
* <span>The basic view is to add another compilation flag in the whole compile process to avoid extra size costs. Like (-Oz -Os) </span><span class="c2">[https://www.google.com/url?q=https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html&sa=D&source=editors&ust=1663260466128277&usg=AOvVaw0UMxI2rLAckoCRcEWZEvf0 Optimize Options (Using the GNU Compiler Collection (GCC))]</span><span class="c4"> </span>


* <span>Also, considering we can strip the specific symbol if we do it correctly. </span><span class="c2">[https://www.google.com/url?q=https://github.com/luoxuhai/pcl.js/blob/master/.devcontainer/Dockerfile%23L56&sa=D&source=editors&ust=1663260466128638&usg=AOvVaw0Srmo2uJvLjqg1M4PB1xWP pcl.js/Dockerfile at master · luoxuhai/pcl.js (github.com)]</span><span class="c4"><br />
* <span>Also, considering we can strip the specific symbol if we do it correctly. For example to try things like: </span><span class="c2">[https://www.google.com/url?q=https://github.com/luoxuhai/pcl.js/blob/master/.devcontainer/Dockerfile%23L56&sa=D&source=editors&ust=1663260466128638&usg=AOvVaw0Srmo2uJvLjqg1M4PB1xWP pcl.js/Dockerfile at master · luoxuhai/pcl.js (github.com)]</span><span class="c4"><br />
</span>
</span>



Latest revision as of 15:55, 15 September 2022

What is gnuradio-web

It moves the whole workspace to the browser and enables you to run gnuradio out of the box.

In the expected view, you could do everything on gnuradio same on gnuradio-web, like define your own SDR.

But currently, the gnuradio-web is still working in the process. there is still a lack of function with gnuradio. (For example building in local or docker will take huge time for downloading the specific file)

There is also no support for USB SDR hardware, but this can be added in the future by integrating uhd.js (https://github.com/marcnewlin/uhd.js).

For basic usage, just access the deployed page( https://marcnewlin.github.io/gnuradio-web/ ) and load the wasm file it may take a cup of coffee time if your network is not well, then you can use gnuradio-web like gnuradio-companion.


Understanding Gnuradio Web Demo.jpg

How does gnuradio-web work

The key is we cannot run the python function in a pure HTML file currently.

The core is WebAssembly(also called wasm in the following). The browser and other wasm runtime support running wasm files. It looks like a JS file in the browser but is more complex and effective. (Static type and minor size). Therefore the trivial view is we run python over a wasm type python interpreter over a browser.

In order to support GNU Radio, it was necessary to compile all of the native dependencies to wasm, and then statically link everything into the wasm CPython interpreter. This results in a time-consuming build process, but it will likely become simpler when CPython officially supports wasm as a build target (https://pythondev.readthedocs.io/wasm.html).

We compile the dependency package to python and then collect the CPython to wasm type. Finally, we will call the main method in grc/main.py.gnuradio-web/main.py at update-to-current-grc-qt · marcnewlin/gnuradio-web (github.com) Understanding Gnuradio Web Flow.png


How to acceleration gnuradio-web

Even though the wasm has so many advantages, we still need to load 70MB~100MB before using it, and running the flow-graph will takes a little stall time. So, there have 2 main methods.

  1.  Minor the loading package size to reduce the time.

  1.  Accelerate the running through the simd or other tools.

  1. The main difficulty with any optimization effort will be the time it takes to rebuild the project. Any reductions to compile-time (or complexity) will make it easier to iterate on and profile new code.