- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Guys, I have a tbb::concurrent_unsorted_set loaded with path's to files (100.000+ files), and I'd like to set a optimum no of threads to create via tbb::task_scheduler_init, so there isn't oversubscription present while processing those files. Do I have to do it anyway? Will tbb do it better for me? In any case I'd like to know the optimum no of threads to spawnby me or by tbb (I need to display this info in a window) . Is there a way to do it?
Thank you.
Thank you.
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you do it right, the optimum number of threads should be set automatically - that is, one thread for every core on the system. The key is to use the TBB task scheduler in the way it was designed, and just spawn a TBB task for processing any given file. The scheduler will map those tasks dynamically onto available threads, resulting in zero oversubscription - if no thread is available to run the task, it is put onto a work queue. The tutorial makes for a good introduction to the inner workings of the task scheduler.
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you do it right, the optimum number of threads should be set automatically - that is, one thread for every core on the system. The key is to use the TBB task scheduler in the way it was designed, and just spawn a TBB task for processing any given file. The scheduler will map those tasks dynamically onto available threads, resulting in zero oversubscription - if no thread is available to run the task, it is put onto a work queue. The tutorial makes for a good introduction to the inner workings of the task scheduler.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That depends on the program design. Normally you shouldn't be doing any I/O inside TBB code, but if you want to do that anyway, and need to deploy more threads than normal to counter undersubscription, your penalty is to tune the program yourself (because the outcome is unpredictable).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for your answer. You mention some tutorial, could you please give me a link to it so that I could download it?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please take a look at a very good article regarding oversubscription of threads:
http://blogs.msdn.com/b/visualizeparallel/archive/2009/12/01/oversubscription-a-classic-parallel-performance-problem.aspx
Best regards,
Sergey
http://blogs.msdn.com/b/visualizeparallel/archive/2009/12/01/oversubscription-a-classic-parallel-performance-problem.aspx
Best regards,
Sergey
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