Showing results for 
Search instead for 
Did you mean: 
New Contributor I

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

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
Black Belt

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?