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

Infinite graphs for streaming image processing

tobifisch
Beginner
582 Views

Hello oneTBB community,

I am new to oneTBB and was wondering about the following. I have an image processing "pipeline" with the following simplified processing chain:

       |           |           |           |
       V           V           V           V    
...  Input       Input       Input       Input   ...
   /   |   \   /   |   \   /   |   \   /   |   \   
       |     X     |     X     |     X     |     
   \   |   /   \   |   /   \   |   /   \   |   /   
    V  V  V     V  V  V     V  V  V     V  V  V     
...  Output      Output      Output      Output

 Basically, each output image depends on three successive input images. Or to put it the other way around, each input gets fed to three outputs. The input data is an endless image stream from a camera. So the "task graph" of the above pipeline is infinite.

I tried reading into oneTBB docs, and also proTBB (book about flow graphs), but got overwhelmed and confused. I would be happy to get some pointers on which concept from oneTBB could be used to implement the pipeline above. In reality, the Input and Output stages perform internal processing, however that can be easily absorbed into a finite acyclic graph each.

Best,
Tobias

0 Kudos
1 Solution
Aleksei_F_Intel
Employee
497 Views

Hi Tobias,

Sorry for a delayed response. 

For you particular use case consider having a maltifunction node with three outputs each of each gets connected to the corresponding input port of the tag matching join node. The multifunction node's body has internal, perhaps, atomic counter (make sure you don't have data races, especially if unlimited concurrency specified during multifunction node construction) that signifies the output port to send a message to.

Tags of the join node designate the index of the three successive input images so that tag zero means it is one of the three images from the first algorithm iteration, tag one - --//-- from the second algorithm iteration and so on. Connect as a successor of the join node some processing node (e.g. function node) so that it gets a tuple of three images that all correspond to one common tag.

You can also put an input node(s) at the beginning of the graph that would generate images and feed them to the multifunction node.

You may also apply one of the flow graph resource consumption tricks (e.g. introduce token-based scheme by adding buffer node with your own tokens).

Regards,

Aleksei

View solution in original post

4 Replies
Mariya_P_Intel
Moderator
555 Views

Hi Tobias,

Your question was addressed to TBB developers and will be handled in a timely manner.

Have a nice day ahead!

Mariya


Aleksei_F_Intel
Employee
498 Views

Hi Tobias,

Sorry for a delayed response. 

For you particular use case consider having a maltifunction node with three outputs each of each gets connected to the corresponding input port of the tag matching join node. The multifunction node's body has internal, perhaps, atomic counter (make sure you don't have data races, especially if unlimited concurrency specified during multifunction node construction) that signifies the output port to send a message to.

Tags of the join node designate the index of the three successive input images so that tag zero means it is one of the three images from the first algorithm iteration, tag one - --//-- from the second algorithm iteration and so on. Connect as a successor of the join node some processing node (e.g. function node) so that it gets a tuple of three images that all correspond to one common tag.

You can also put an input node(s) at the beginning of the graph that would generate images and feed them to the multifunction node.

You may also apply one of the flow graph resource consumption tricks (e.g. introduce token-based scheme by adding buffer node with your own tokens).

Regards,

Aleksei

Mariya_P_Intel
Moderator
479 Views

Hi Tobias,

Did Aleksei's recommendation help you?

If yes, I would mark this forum topic as solved.

Thanks, Mariya


Mariya_P_Intel
Moderator
465 Views

Hi Tobias,

We haven’t heard back from you. This thread won't be monitored anymore. For further issues and queries, please start a new thread.

Thanks, Mariya

Reply