Interoperability with OpenMP

Interoperability with OpenMP

In the TBB Manual there's an example for using TBB in an OpenMP parallel region. What could be the reason for doing this?

Also interesting to know would be how many threads will be created by the code snippet below. Will there be a total number of (Number of OpenMP Threads) x (Number of TBB Threads) threads? Will there be in each OpenMP thread an exclusive team of TBB threads?

void OpenMP_Calls_TBB( int n ) {
#pragma omp parallel
task_scheduler_init init;
#pragma omp for
for( int i=0; i ...can use class task or
Intel Threading Building Blocks algorithms here ...

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

There is probably no reason to mix TBB and OpenMP in a code developed from scratch (though, who knows); but there could also be some legacy code that might already use OpenMP while trying to use TBB as well. Or, it could happen in a multimodular program that an OpenMP parallel region call a TBBfied function; or vice versa.

In the example above, the system will be oversubscribed by a factor of 2; i.e. there will be (Number of OpenMP Threads)+(Number of TBB threads) active. Note sum there, not multiplication, because there is only one pool of TBB threads, no matter how many external threads use TBB.

The mutual awareness and some sort of handshaking between TBB and Intel's implementation of OpenMP is being elaborated; but no particular promise can be done at the moment.

Leave a Comment

Please sign in to add a comment. Not a member? Join today