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

Can a flow graph be build through multiple classes?




I am still a bachelor student, and I am doing my internship at this moment. I started learning TBB for my project. And I just love TBB, the ease of use compared to the manual thread handling.

But now I am wondering if it is possible with TBB Flow Graph to split up the code to build the graph through multiple classes. To make predefined graph structures that would repeat them self often. Ex. three serial function nodes, processing different objects, calculations, etc ...

Then its just an abstract class you inherent, override the three functions and place the different code in there and declare a typedef for what is going through.

Then those parts in the main graph can be build with a factory pattern or something. This would also make it possible to alter what parts of the structure is required to run during runtime depending on user settings.

I have been looking on google for something similar or an example. Even browsed through some projects(GitHub) and hope to find something. But without any findings. So if this is possible could you be so kind to help me on my way or give a basic example.

Extra - Why it would be useful as well:
For my project it would also create the opportunity for another developer that doesn't know the TBB flow graph to add new pieces of code to it.

Just inherent the super class use the three functions to divide his/her specific code.

Then the only thing needed to do is to add the new class to the factory and no more worries using threads(tasks), or breaking something else.


Thanks for reading and kind regards.

Dylan D.

0 Kudos
0 Replies