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

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

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

i.e.

If I had 3 stages, and I wanted the the queue size between stage 1 and 2 to only have 1-depth queue..is it possible?
0 Kudos
1 Reply
RafSchietekat
Valued Contributor III
387 Views
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
Reply