- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm creating
task_scheduler_init init(9);
and then
task_group group;
It always creates exactly 16 threads, regardless of the number I use in the init. Do task groups not use task_scheduler_init?
Thanks,
David
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was instantiating a thread observer before, but I put it after and I'm still getting 16 threads created and used.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page