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

Setting Depth Manually - Any Issues?

AJ13
New Contributor I
220 Views
Are there any issues I should be aware of when manually setting the depth of tasks? This will be useful for some of the research I am doing.

In particular, I might set task depths such that there are gaps. For instance, I might have tasks at depth 10, 10000, 100023, and other strange numbers.

Thanks.
0 Kudos
1 Reply
Alexey-Kukanov
Employee
220 Views
If you spawn a task_list, all tasks in the list must have the same depth.
In current implementation, task pool has an array of list of tasks with the same depth. The array can grow dynamically on demand, but never shrinks. So if you need a task of depth 100023 just once, think whether you really need it :)
If a task spawns children and waits for those, it won't execute tasks with smaller depth during the wait. Thus children should better have the depth not smaller than that of parent waiting for their completion, otherwise you might end up with adeadlock.
0 Kudos
Reply