Community
cancel
Showing results for 
Search instead for 
Did you mean: 
akhal
Beginner
112 Views

Barrier synchronization in tbb threads

Hej

I am new to intel TBB. I am trying to parallelize a looping structure with parallel_for. Structure of code is like:

for i=0:size
{
for j=i+1:size
------do something------

for j=i+1:size
for k=i+1:size
---do something---
}

>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<
for i=0:size
{
parallel_for(i+1:size) with looping

parallel_for(i+1:size) with nested looping
}

But this has drastically slowed down my speedup even much below than serial execution:( I rather need a parallelized structure of the form:

parallel_for(i,size)
{
for j=i+1:size
------do something------

/*------SYNCHRONIZATION-BARRIER------------*/

for j=i+1:size
for k=i+1:size
---do something---
}

i-e synchronization barrier of MPI kind that the second looping structure only begins when first looping has finished, so I guess i will get some speedup.... I have no idea if intel tbb has this kind of barrier, I looked through synchronization structures but they only talk about mutexes for shared variable accesses... Need urgent help with this, and thanks so much in advance....
0 Kudos
1 Reply
RafSchietekat
Black Belt
112 Views

Reply