12-27-2012 04:18 AM
It always creates exactly 16 threads, regardless of the number I use in the init. Do task groups not use task_scheduler_init?
12-27-2012 06:41 AM
What do you mean by "creates 16 threads"? 1) Do you see they simultaneously participating in the work? 2) Or do you see that 16 threads can join the work during the whole processing? If (1) is true, please check whether another instance of task_scheduler_init already set the limit for this master thread (only the first specification matters) (2) is expected behavior in case if you have 16 HW threads on your machine.
12-27-2012 07:22 AM
1) It both creates the pool and actually uses them during execution. I also thought perhaps the pool was 16 but not all were used. I don't create another task_scheduler_init instance.
12-27-2012 07:37 AM
Also consider that any TBB scheduler-related call before an explicit task_scheduler_init is put on the application thread's stack will imply the default number of worker threads in that arena, as if there were an implicit task_scheduler_init that the explicit one could not override anymore. Could that be the case?
12-31-2012 10:49 PM
To be absolutely sure, try putting the task_scheduler_init instance right in main(), so that it is created before anything else and destroyed after anything else. If that works (most likely), try getting gradually back to where you were, to isolate and hopefully remedy the problem. If it doesn't (rather less likely), please provide more information about release version and whatnot, perhaps with a minimal reproducer.