Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Foster_Brereton
Beginner
71 Views

Dynamic splitting/joining with flow graph?

I have been looking over the flow::graph documentation and see the split_node can be used to divide inputs across one or more subsequent nodes. All the split_node documentation seems to imply the number of split out edges must be specified at compile-time (via a tuple). Is there a variant of the split_node that is available for when the number of out edges is not known at compile time? In other words, is it possible to perform a split to N subsequent nodes determined at runtime? (As you can imagine, a corresponding dynamic join would also be necessary.)
0 Kudos
3 Replies
Alexei_K_Intel
Employee
71 Views

The number of ports in each node in flow graph is a compile-time information because each port may have its own type. How is it possible to create a dynamic array of elements of different types? C++ does not support dynamic tuples. Therefore, I can suppose that you have a dynamic array of elements of the same type. Why do you need many subsequent nodes in this case? Why not to create a function_node and call parallel_for over the array? Sorry if the questions are irrelevant. Could you provide more information about your algorithm?

Foster_Brereton
Beginner
71 Views

Thanks for your reply, Alex. I am looking at using the flow library for a tiled-image processing pipeline. Based on the size of the image there will be N tiles to process, which I would like to do in parallel. Your suggestion to use a function_node that calls parallel_for seems like the right direction, although each of those passes through the for loop themselves would be (sub)graphs needing execution. In our specific case each iteration would have the same types, so something like a dynamic tuple would be overkill.
Alexei_K_Intel
Employee
71 Views

It seems that you do not need a parallel_for. Intel TBB flow graph supports data flow approach. You can create many tiles and put them to function_node with "unlimited" concurrency and the tiles will be processed in parallel.

Reply