More than one task_scheduler_init object.

More than one task_scheduler_init object.

wittmannma的头像

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

3 帖子 / 0 new
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项
Alexey Kukanov (Intel)的头像

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?

schorscherl的头像

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.

登陆并发表评论。