nested loops with openmp

Hi,

I would like to set the diagonals of a matrix using openmp.

this a part of the plan:


for(int i=0; i<II; i++)
{
//calculate JJ
#pragma omp parallel for private(j)
for(j=0; j<JJ; j++)
{
for(k=0; k<JJ; k++)
{
for(l=0; l<JJ; l++)
{
//calculate A
for(m=0; m<JJ; m++)
{
if(j==l && k==m)
{
//calculate B
// calculate c=A-B
add C to matrix(diagonal, diagonal);
}
}
}
diagonal++;
}
}
}

How can you parallelise this with openmp? Would it be possible to parallelise only the inner loops?

Thanks
Topic archived. No new replies allowed.