- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have an application where I currently have "bubbles" in the pipeline. I.e. if a condition is met the data object does not need to be processed further. Is there a better way to do this than passing bubbles through? Perhaps one where succeeding stages of the pipeline are not invoked without losing the structure provided by TBB's pipeline construct.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Currently, it's impossible.In thefuture, we plan to provide special API to support more complex control flow graphs than linear pipeline, and most likely it will be able to handle this case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Passing of bubbles might be a rather light overhead. This willdepend on the internal structure of how pipes are stitched together in TBB. The overhead could be measured using a test app. Example: pass N nodes of static data (no I/O) through pipe performing function representative of your application and measure the total time. Then pass the same N nodes and process every other node (NOOP for the other nodes). Compare the run times
TimeBubble = (TimeHalf - (TimeAll / 2)) / (N / 2)
Overhead = TimeBubble / (TimeAll / N)
The bubble passing may be a requirement when you also require the output data to be in the collation order of the input data. If collation is not a requirement then concievably you could return the bubble to the input side of the pipeline for immediate reuse.
Run the timing test, because this overhead may be smaller than you expect. Additionaly, the code and/or additional overhead to extract the bubble may exceed the time to pass the bubble.
While I have not examined the TBB code for this overhead, I do know the overhead on the QuickThread parallel_pipeline is on the order of 50 C++statements to pass a bubble from stage to stage. If you have a pipeline of a very few stages, the overhead is not worth going after in your hunt for places to optimize.
Jim Dempsey
TimeBubble = (TimeHalf - (TimeAll / 2)) / (N / 2)
Overhead = TimeBubble / (TimeAll / N)
The bubble passing may be a requirement when you also require the output data to be in the collation order of the input data. If collation is not a requirement then concievably you could return the bubble to the input side of the pipeline for immediate reuse.
Run the timing test, because this overhead may be smaller than you expect. Additionaly, the code and/or additional overhead to extract the bubble may exceed the time to pass the bubble.
While I have not examined the TBB code for this overhead, I do know the overhead on the QuickThread parallel_pipeline is on the order of 50 C++statements to pass a bubble from stage to stage. If you have a pipeline of a very few stages, the overhead is not worth going after in your hunt for places to optimize.
Jim Dempsey
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page