TPB Scheduler - Block Scheduling Rate

Hey all -

I’m running some experiments, and would like to directly tune the rate
that the TPB scheduler is switching between blocks. I’ve dug around a
bit, and can’t seem to find the relevant portions of code; I’ve never
looked at this part of GNURadio before, and the gruel / boost mix is
slightly hard to follow.

Has anyone tried anything like this before, or can someone point me in
the direction of the relevant source file?

Thanks!

Cheers,
Ben

I’ve been down this path before Ben and I can tell you it’s a very dark
and lonely path, biggest advice is to use GDB my preference is to use
DDD. I personally found it easier to start tracing from the python
source file there’s a way where you can select the PID of your python
process from GDB. Anways, you’ll end up seeing a lot more BOOST and
SWIG information than you can ask for but I really think it’s the best
way to do it.

Also if you can document what you see in terms of function/file call
sequences it would be great ! i know that at least I would appreciate
it. good luck

al fayez

On 01/27/2011 03:57 PM, Ben H. wrote:

Thanks!

Cheers,
Ben


Thread scheduling is part of the operating-system Kernel, as far as I
know, Gnu Radio itself
isn’t responsible for that.


Principal Investigator
Shirleys Bay Radio Astronomy Consortium

As I understand it, there is code in the GNURadio scheduler stuff that
manages block scheduling, to some degree.

I’m aware of the kernel’s role in switching between the threads
themselves, but I was under the impression that block scheduling, was
at least in some part, influenced by GNU Radio.

If this is incorrect though, someone please correct me!

Cheers,
Ben

Michael -

I greatly appreciate the response, and yes, your post was helpful.

Hopefully I’ll come back with some good news before too long =)

Cheers,
Ben

On Jan 28, 2011, at 2:23 PM, Ben H. wrote:

As I understand it, there is code in the GNURadio scheduler stuff that
manages block scheduling, to some degree.

I’m aware of the kernel’s role in switching between the threads
themselves, but I was under the impression that block scheduling, was
at least in some part, influenced by GNU Radio.

If this is incorrect though, someone please correct me!

Yes, this is true, Ben. The OS handles the basics of thread execution,
but the TPB scheduler does handle “when” a block’s “general_work” method
is actually called. See gnuradio-core/src/lib/runtime, files
“gr_tpb_thread_body.cc” (which for the most part is a simple loop
calling the block executor and neighbor blocks when things change) and
“gr_block_executor.cc” (which is where the meat of what you’re looking
for it, I believe). For the latter, you can set ENABLE_LOGGING to 1,
which should give you an idea of what the “decision process” is.

I think the general idea goes roughly like this: When data in a given
buffer changes (whether through generated or consumed items), each block
that is associated with that buffer checks to see if there is “enough”
input data and output buffer space for a “reasonable sized” computation.
If not, then go back and wait for buffers to change; if so, then do the
computation (call “general_work”). You’ll need to look through the code
to determine what “enough” and “reasonable sized” mean – looking at the
debug log might help as well.

It’s been a long time since I’ve thought about these algorithms, so
hopefully the above is reasonably correct. And, I hope this helps! -
MLD