[Openmp-dev] OpenMP ordered clause for nested loops
Himanshu Shukla via Openmp-dev
openmp-dev at lists.llvm.org
Sun Mar 3 23:19:13 PST 2019
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 .
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20190304/93571eff/attachment.html>
More information about the Openmp-dev
mailing list