<div dir="ltr">Apologies for a small mistake above. The second code has 2 as parameter instead of 1.<br><br><div><i>#pragma omp parallel for schedule(static) ordered(2)</i></div><div><i> for (int j = 1; j < N; j++)</i></div><div><i> {</i></div><div><i>    for (int i = 1; i < N; i++)</i></div><div><i>    {</i></div><div><i>      printf("Iteration j=%d,i=%d, Thread %d\n", j, i, omp_get_thread_num());<br></i></div><div><i>    }<br>}</i></div><div><i> </i></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 4, 2019 at 12:49 PM Himanshu Shukla <<a href="mailto:cs15btech11042@iith.ac.in">cs15btech11042@iith.ac.in</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi ,<br><br>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. <br><br><div><i><br></i></div><div><i>#pragma omp parallel for schedule(static) ordered(1)</i></div><div><i> for (int j = 1; j < N; j++)</i></div><div><i> {</i></div><div><i>    for (int i = 1; i < N; i++)</i></div><div><i>    {</i></div><div><i>      printf("Iteration j=%d,i=%d, Thread %d\n", j, i, omp_get_thread_num());<br></i></div><div><i>    }<br></i></div><div><i> }</i></div><div><br></div><div>But when I execute the following code both the dimensions are parallelized. Why ? As per my understanding , the <b>#pragma omp parallel for </b>directive should only parallelize the outermost dimension and the inner dimension should run sequentially. Why is ordered clause parameter affecting it ?<br><br><div><i>#pragma omp parallel for schedule(static) ordered(1)</i></div><div><i> for (int j = 1; j < N; j++)</i></div><div><i> {</i></div><div><i>    for (int i = 1; i < N; i++)</i></div><div><i>    {</i></div><div><i>      printf("Iteration j=%d,i=%d, Thread %d\n", j, i, omp_get_thread_num());<br></i></div><div><i>    }<br></i></div><div><i> }<br><br></i></div></div><div>Please advise .</div></div>
</blockquote></div>