Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

More than one task_scheduler_init object.

wittmannma
Beginner
705 Views
The TBB Reference Manual states that you can have more than one active task_scheduler_init object per thread. The question is now how can they be used. In parallel_for for example there's no possiblility to specify which task_scheduler_init object should be used.

Markus

0 Kudos
2 Replies
Alexey-Kukanov
Employee
705 Views

The possibility to have several active task_scheduler_init objects is mostly useful for modular programs, when a function might not know whether TBB has been initialized by the calling thread. So it can just create a task_scheduler_init object and let TBB decide about initialization. If there is another such object created before in the thread, the second one will just increment a reference counter.

Let me ask you, why have you asked about having more than one task_scheduler_init active? If you think you would make some use out of it, what would it be?

0 Kudos
schorscherl
Beginner
705 Views
On systems with non-uniform memory access characteristics (e.g. ccNUMA) it would make sense to have thread teams running separately in each locality domain so that access locality constraints can be implemented. That way, thread teams could still load balance across the cores in a socket but only access local memory. Of course, data layout, pinning etc. have to be taken into account as well, but that can be handled as soon as we have solved the problem of separating thread teams. Parallel constructs like parallel_for would have to be modified as well, of course.
0 Kudos
Reply