More than one task_scheduler_init object.

More than one task_scheduler_init object.

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 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.
Portrait de 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?

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.

Connectez-vous pour laisser un commentaire.