Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Suggestions how to work with FIFO buffer at node's input

Michael_S_
Beginner
288 Views
A question on tbb:flow. What is the right strategy to use internal FIFO buffer at the input of the function_node? Imagine a pipeline source_node -> function_node -> function_node -> ..... By default function_node has an infinite buffer in front of it. I am affraid that source_node may overproduce data and the data will consume to much RAM, before everything is processed. What is the right way to control this issue? I've tried to set all function_node-s as "rejecting". This caused loosing some of the messages. Is it an intentional behavior if node rejects messages or I should seek a bug in my code?
0 Kudos
2 Replies
ronag89
Beginner
288 Views

You should probably use a limiter_node as described here: https://software.intel.com/en-us/blogs/2011/09/14/how-to-make-a-pipeline-with-an-intel-threading-building-blocks-flow-graph

The Flow Graph "Rejecting" strategy seems to be inherently flawed. When using TBB Flow Graph, from what I can see, you should always use queueing nodes with unlimited concurrency, otherwise you can get weird behaviour.

0 Kudos
Michael_S_
Beginner
288 Views
Thank you for your answer! I think I got the idea. The TBB manual says that function_node.try_get() always returns false. "A function_node does not contain buffering of its output. Therefore it always rejects try_get calls." That's why nobody should reject messages after function_node.
0 Kudos
Reply