Does Threaded Buliding Blocks provide an environment variable to control the number of threads spawned? I presume a sensible name for such an environment variable woud be TBB_NUM_THREADS, similar to OMP_NUM_THREADS, and have not seen any reference to this in the documentation. I know that in general it is best to let TBB set the number of threads, and that they can be set explicitly by an early call to task_scheduler_init, but I think that providing an optional environment variable that sets the number of threads if present would be useful to many users.
As an example, a software library that I use has chosen to use threaded building blocks behind the scenes. This has worked well overall, but is leading to some problems on large SMP machines. On these machines users request a small number of CPUS from the scheduler but unless the number of threads is actively controlled TBB tries to initialize N_CPUS + 1 threads which in one case is 156 threads. The resulting program is inefficient and ignores the resorces allocated by the scheduler.
If TBB_NUM_THREADS is not available in the TBB itself, I have to implement similar functionality in code that I want to run on an SMP machine. A Google search on TBB_NUM_THREADS suggests that this is an approach others have taken already. Are there plans to provide an environment variable like this in future releases?