Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ahelwer
New Contributor I
66 Views

TBB and nested parallelism with other thread libraries

Given a tbb flow graph of tasks, in which one graph node uses either boost threads or OpenMP to execute some operation in parallel, will the threads used in that node and the threads used by the tbb scheduler stomp on each other with context switches?
0 Kudos
3 Replies
jimdempseyatthecove
Black Belt
66 Views

This can be an implimentation issue. Generally speaking TBB thread pool will be seperate from OpenMP thread pool and seperate from Boost threads. As such, oversubscription will (may) occure. You can start each thread pool with undersubscription.

*** Caution. TheOpenMP thread pool usually assumes the process main thread initiated the OpenMP thread pool .AND. is the root thread on all subsequent entries into OpenMP parallel regions.

Jim Dempsey
TimP
Black Belt
66 Views

The cilk+ implementation is intended to cooperate with TBB in scheduling threads.
If working with OpenMP, not only is there no protection agains over-subscription, but the OpenMP affinity (KMP_AFFINITY for Intel OpenMP) would probably have to be left at default (none) as it will not track conflicts in core scheduling between TBB and OpenMP. You would depend on the OS scheduler to spread the work across available cores, but it would have no idea of any scheduling preferences from your application.
RafSchietekat
Black Belt
66 Views

"If working with OpenMP, not only is there no protection agains over-subscription, but the OpenMP affinity (KMP_AFFINITY for Intel OpenMP) would probably have to be left at default (none) as it will not track conflicts in core scheduling between TBB and OpenMP."
I would think that Intel OpenMP uses the RML to play nice with TBB?
Reply