I have the following the code:
int myArray[] = {0, 0, 0, 0, 0, 0};
double EV = 0;
for(short a1 = 1; a1 <= 6; ++a1)
{
++myArray[a1-1];
if(....)
{
--myArray[a1-1];
continue;
}
EV = myEVFunc();
if(EV...)
{
for(short a2 = 1; a2 <=6 ; ++a2)
{
++myArray[a2-1];
if(....)
{
--myArray[a2-1];
continue;
}
EV = myEVFunc();
if(EV...)
{
for(short a3 = 1; a3 <= 6; ++a3)
{
++myArray[a3-1];
if(....)
{
--myArray[a3-1];
continue;
}
EV = myEVFunc();
}
}
}
}
}
I am trying to use OpenMP to parallelize the loops. the code compiles fine when i place
#pragma omp parallel for in front of the outermost for loop. However it gives incorrect results. I suspect two issues the continue statements inside the loops and the fact that there are shared variables in the nested loops.
Is it possible to use OpenMP with this code snippet, if so can anyone please give me the correct syntax. Thanks in advance.