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

tbb::pipeline how to specify queue size between specific pipeline stage?

New Contributor I
Using tbb::pipeline, is it possible to set the queue size between specific pipeline stage?


If I had 3 stages, and I wanted the the queue size between stage 1 and 2 to only have 1-depth it possible?
0 Kudos
1 Reply
Valued Contributor III
How about integrating both into one, and spawning the previous stage 1 from the previous stage 2?

(Added) I should explain... Flow control is currently supported only in the form of maximum number of tokens in flight throughout the pipeline (argument to pipeline::run()), so maybe setting that to 2 will work for you (if the rest of the pipeline does not suffer). Flow control on individual input buffers is not supported. In this case, it would mean that stage 1 must not be entered while stage 2's input buffer is not empty to receive the result, which is also directly implemented if "stage 2" spawns "stage 1" as an additional child, goes about its business, and then waits for the child to finish. You can probably recycle the child task between uses. Would this work for you?
0 Kudos