Hi ,
I am trying to write an OpenMP code. When I execute this code, from the output it is clear that only outer dimension is parallelized.
#pragma omp parallel for schedule(static) ordered(1)
for (int j = 1; j < N; j++)
{
for (int i = 1; i < N; i++)
{
printf(“Iteration j=%d,i=%d, Thread %d\n”, j, i, omp_get_thread_num());
}
}
But when I execute the following code both the dimensions are parallelized. Why ? As per my understanding , the #pragma omp parallel for directive should only parallelize the outermost dimension and the inner dimension should run sequentially. Why is ordered clause parameter affecting it ?
#pragma omp parallel for schedule(static) ordered(1)
for (int j = 1; j < N; j++)
{
for (int i = 1; i < N; i++)
{
printf(“Iteration j=%d,i=%d, Thread %d\n”, j, i, omp_get_thread_num());
}
}
Please advise .