Synchronisation construct inside pragma for

Posted by Sayan Ghosh on Stack Overflow See other posts from Stack Overflow or by Sayan Ghosh
Published on 2010-05-24T20:12:28Z Indexed on 2010/05/25 14:21 UTC
Read the original article Hit count: 293

Filed under:
|

Hi,

I have a program block like:

    for (iIndex1=0; iIndex1 < iSize; iIndex1++)
    {
        for (iIndex2=iIndex1+1; iIndex2 < iSize; iIndex2++)
        {   
            iCount++;
            fDist =(*this)[iIndex1].distance( (*this)[iIndex2] );
            m_oPDF.addPairDistance( fDist );

            if ((bShowProgress) && (iCount % 1000000 == 0))
                xyz_exception::ui()->progress( iCount, (size()-1)*((size()-1))/2 );

        }
    }
} 
}

I have tried parallelising the inner and outer loop and by putting iCount in a critical region. What would be the best approach to parallelise this? If I wrap iCount with omp single or omp atomic then the code gives an error and I figured out that would be invalid inside omp for. I guess I am adding many extraneous stuffs to paralellise this. Need some advice...

Thanks,

Sayan

© Stack Overflow or respective owner

Related posts about synchronization

Related posts about openmp