I read in several OpenMP tutorials that you should not generate more tasks than there are threads. For example: "Do not start more tasks than there are available threads, which means available in the enclosing parallel region."
Assume that we want to traverse a binary tree, that the subtrees of a node can be traversed in parallel, and that our machine has four cores. Following the advice above, we generate two tasks at the root, one for the left and one for the right subtree. Within both tasks, we generate two nested tasks, again one for each subtree. Now, we have four tasks, so we do not split them further.
However, if the four subtrees are not of the same size, some cores will have to wait. Would it not be better for load balancing to continue splitting somewhat further and generate, say, 16 tasks? Even if we have only four cores?
Is it generally a good advice to generate not more tasks then there are threads or is this nonsense?