Skip to content
This repository has been archived by the owner on Jul 19, 2022. It is now read-only.

Release v0.2.0

Compare
Choose a tag to compare
@mormj mormj released this 09 Dec 20:31
· 249 commits to main since this release

It is time to make another newsched release, this time with some more exciting features:

GRC Integration

Since all the information for the block interfaces is in the block .yml file, it only makes sense to now start reaping the benefits and getting things like the GRC bindings for free. One of the benefits of this is that we can include in the generation a selectable domain - see the following example where blocks can be switched from the CUDA to the CPU domain, given that these domain definitions are installed in tree

image

Python Blocks

There are now two ways to make python blocks within newsched. Inside the work function, things are slightly different because we are not passing in numpy arrays, but instead block_work_io objects. There are convenience functions that can be used to get numpy arrays from this, and due to the custom buffer interface, also can get other representations such as cupy or pytorch with other convenience functions.

Arbitrary python blocks

This is the method that most resembles current GNU Radio - a python block inherits from e.g. gr.sync_block and implements the work function which is called from the scheduler through pybind11 embedding. Notice that instead of io_signature, we instantiate ports with the port API. See qa_python_block.py for an example

class add_2_f32_1_f32(gr.sync_block):
    def __init__(self, dims=[1]):
        gr.sync_block.__init__(
            self,
            name="add 2 f32")

        self.add_port(gr.port_f("in1", gr.INPUT, dims))
        self.add_port(gr.port_f("in2", gr.INPUT, dims))
        self.add_port(gr.port_f("out", gr.OUTPUT, dims))

    def work(self, inputs, outputs):
        noutput_items = outputs[0].n_items
        
        outputs[0].produce(noutput_items)

        inbuf1 = self.get_input_array(inputs, 0)
        inbuf2 = self.get_input_array(inputs, 1)
        outbuf1 = self.get_output_array(outputs, 0)

        outbuf1[:] = inbuf1 + inbuf2

        return gr.work_return_t.WORK_OK

In the case of a CUDA processing block, we could also use some convenience methods found in gateway_cupy.py to get the array zero-copied from the CUDA device memory

In-tree python blocks

Using the block yml for code generation, we can have all the benefits of the underlying block structure such as block parameters accessible from python. Note that not all the block parameter functionality is accessible through python yet, but this is the intent of making python blocks this way. This also allows a yml file to define multiply python implementations for a single block. For example, you might have a numpy and cupy implementation. GRC integration for this is not yet complete. See blocklib/math/add/ or blocklib/math/multiply_const for examples.

The usage here would be

from gnuradio import math
blk = math.numpy.add_ff

and the structure in-tree would have the py block under a directory named after the implementation
image

In the yml, the implementation would be added with a lang specified:

implementations:
-   id: cpu
-   id: cuda
-   id: numpy
    lang: python

Still a few more kinks to figure out to make this seamless

Soapy Blocks

Since the gr-soapy blocks have multiple GRC definitions for the single base source block, this required a bit different approach in how grc files are generated without duplicating the entire implementation. Right now, there is a monster yml file that has different information for the grc outputs.

QT GUI Blocks

QT blocks have been cleaned up to work in with the latest GRC generation

image

Here is the full changelog:

meson build

  • Add .gitignore explicitly where autogeneration is expected rather than a global filter

runtime

  • Allow for itemsize of 0 by default to be connected to anything
    • This allows a, e.g., copy block to be connected with no templating or setting of the item size
    • Blocks will take on the itemsize of the first connected block it finds
  • More generic factory interface using yaml string for scheduler
  • Additional logic to flush the scheduler in the sequence of events when a block starts the DONE process
  • Blocks now have a default param_update message port that using a pmtf::map can change any parameter that is exposed
  • Further removal of Boost::format
  • Python Block interface
    • Two methods to create python blocks
      • Through the "gateway" wrapping, arbitrarily create a python block
      • Through the block yml with python lang implementation
        • This gives access to more inherited block features, tighter coupling
  • Add default cmd message port to all blocks
  • Generic factory interface using yaml string configuration
  • Prefix path loading relative path to lib to give correct gr::prefix()
  • Moved implementation out of block.hh

qtgui

  • Update fft and filter blocks to allow for function qtgui

grc

  • Update domain property of a port to be evaluated parameter
  • Selectable domains automatically generated from block yml
    • Automatic in grc file generation to have enum of specified implementations as domains
  • Supports optional tags on ports
  • Port ID from the yml is rendered into the grc file
  • Port in recent changes from gnuradio

blocks

  • Fixed bug in throttle that was causing flowgraph to hang

soapy

  • Restructure the code generation to allow multiple GRC files from a single block yaml
  • Generate a .grc block for RTL-SDR and HackRF

Scheduler-NBT

  • Update the logic to "kick" the scheduler when input has been blocked