Modify 'maxnorm' value insider critical section when using OpenMP with integer samples

This commit is contained in:
oparviai 2017-03-05 13:56:03 +00:00
parent 5d9bc2fdf3
commit 6f82bdebdb
2 changed files with 12 additions and 2 deletions

View File

@ -911,7 +911,12 @@ double TDStretch::calcCrossCorr(const short *mixingPos, const short *compare, do
if (lnorm > maxnorm)
{
maxnorm = lnorm;
// modify 'maxnorm' inside critical section to avoid multi-access conflict if in OpenMP mode
#pragma omp critical
if (lnorm > maxnorm)
{
maxnorm = lnorm;
}
}
// Normalize result by dividing by sqrt(norm) - this step is easiest
// done using floating point operation

View File

@ -125,7 +125,12 @@ double TDStretchMMX::calcCrossCorr(const short *pV1, const short *pV2, double &d
if (norm > (long)maxnorm)
{
maxnorm = norm;
// modify 'maxnorm' inside critical section to avoid multi-access conflict if in OpenMP mode
#pragma omp critical
if (norm > (long)maxnorm)
{
maxnorm = norm;
}
}
// Normalize result by dividing by sqrt(norm) - this step is easiest