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?

New Contributor I
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.

0 Kudos
1 Reply
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.