0

Currently I use Intels TBB to parallelize some work using tbb::parallel_for. It seems that the amount of threads and the point in time when they are started is controlled by TBB in the background. Looking through the User Guide and Reference Documentation I could not find any hint on whether there are any control options or modules. I would like to be able to modify the amount of threads and, if possible, decide when the thread pool is created.

Edit: Why it is nice to control the thread count: The program is designed to run on our cluster system and on those of our users. Since processing time is not always available exlusively to one user it is a nice feature

Question: Can you explain why you need more control over when the threads start? Answer: Multithreading via TBB is used in many places and since some people fear "overhead" I have been tasked to figure out a way to start the threads only once.

ThE_-_BliZZarD
  • 722
  • 2
  • 12
  • 26

1 Answers1

0

This might help - I've never actually used TBB but this answer seem to be what you are asking.

"When you create the scheduler, you can specify the number of threads as

tbb::task_scheduler_init init(nthread);

else you can use

tbb::task_scheduler_init init(tbb::task_scheduler_init::automatic);

In this case, tbb scheduler creates as many threads as your CPU cores."

Community
  • 1
  • 1
Andrew Williamson
  • 8,299
  • 3
  • 34
  • 62