How do the Scheduler and the flowgraph work?

I have a basic question regarding GNURadio scheduler and how the
flowgraph
works. I am using gr_sync_block but my question are valid for gr_block

From the online tutorial about how to write a block I read:

87 for (int i = 0; i < noutput_items; i++){
88 out[i] = in[i] * in[i];
89 }

I could print noutput_items and it is a huge number in order of
thousands.
So my question is why should I create this loop? and how does it work? I
have read somewhere in this discution board that not using this loop
will
increase the calclation overhead but no clue why. Does my block outputs
the
items “bunch by bunch” or item by item.

Another question here: I saw few programs which dont return
noutput_items
from work or general_work so it seems that I dont have to always return
it.
How can I determine the value I shoud return.

Cheers,

Sam

View this message in context:
http://old.nabble.com/How-do-the-Scheduler-and-the-flowgraph-work--tp29171158p29171158.html
Sent from the GnuRadio mailing list archive at Nabble.com.

This loop does all your work. Without it your block is useless. :slight_smile:

To know how the scheduler chooses the value of items that are passed
into
the work() function I suggest you look into scheduler’s code. It’s a
fairly
easy to understand C++ code and most of your answers will be answered.

According to my knowledge the work() function always returns the number
of
items consumed by your block each time the work() function is called.
When
you return from work() you are basically informing the scheduler how
many
items were consumed so that the scheduler doesn’t discard the unused
input
data. Believe me I once did the same mistake of not returning and had a
troubling time knowing why my block wasn’t working as it was supposed to
be.

On Thu, Jul 15, 2010 at 6:02 AM, Sammour [email protected] wrote:

I could print noutput_items and it is a huge number in order of thousands.

Sam

The scheduler passes chunks of data items between processing blocks.
The noutput_items is the number of items the scheduler tells you that
you can produce. You want to produce as many items at one time as the
scheduler tells you that you can. The scheduler knows how to handle
this to maximize throughput.

When we write a block that doesn’t return noutput_items, it’s usually
due to some boundary condition; making sure that the items in the
input and output buffers keep some kind of alignment. This is where
things get complicated and you need to do a lot of analysis, thinking,
and work to figure it out.

Tom

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs