I plan to start off a fixed finite number of operations. Each of these operations will have a lot of computational work and opportunity nested parallelism in things such as for loops and such. I like TBB because it handles the nested parallelism automatically - I can start up 2, 4, 8 . . . operations and the nested parallelism can then invoke the remainder of the threads in the tbb thread pool for work in a parallel for. I am considering two methods to invoke the operations - one is to use a TBB thread for each operation - (https://software.intel.com/en-us/node/506322), the other is to create a TBB task for each operation (https://software.intel.com/en-us/node/506100). Which would be better suited? I may have a parallel reduction in the middle of the operations which should be across ALL tbb threads (not just a subgroup). Which is easier to implement? What else should I be considering - or what factors would affect the decision that I did not list here?
Thanks for discussion of values of one option over the other?
Link Copied
Hi David,
The are several ideas that should be always considered when choosing thread based versus task based approach.
I hope this ideas are reasonable for your algorithm. Feel free to share the details of the algorithm that I can suggest better approach for you.
Regards, Alex
For more complete information about compiler optimizations, see our Optimization Notice.