Understanding Gnuradio Web

From GNU Radio
Jump to navigation Jump to search

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.