I am optimizing some code with OpenMP. If NO_VALUE
is met in a loop, I would like it to break. However, compiler tells me this is not allowed with openMP. How could I handle this?
#pragma omp parallel
{
#pragma omp for reduction(+:functionEvaluation) schedule(dynamic) nowait
for (int j=m_colStart;j<m_colEnd+1;j++)
{
double d = command_->execute().toDouble();
if(d==NO_VALUE)
{
functionEvaluation = NO_VALUE;
break;
}
else
{
functionEvaluation += d;
}
delete command_;
}
}
How could I work around? thanks!