<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: do -if -exit whith openmp in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/do-if-exit-whith-openmp/m-p/1558162#M170205</link>
    <description>&lt;P&gt;In your initial coding (post 1 of thread), the convergence test was made outside of the parallel region.&lt;/P&gt;&lt;P&gt;Due to the call to update(...) is within the outer most loop .AND. precedes the parallel region containing the inner two loops, placing the convergence test &lt;EM&gt;&lt;STRONG&gt;following&lt;/STRONG&gt; &lt;/EM&gt;the parallel region is the correct place for the test.&lt;/P&gt;&lt;P&gt;Placing the convergence test inside the inner two loops would be incorrect because the value of diffall would be incomplete until the last iteration of both of the inner two loops (and which the exit of the parallel region is imminent.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My only comment is that you evaluate the expected extremes of the input arrays to assure that the convergence test is constructed properly. iow scaling the serr by hs(i) may or may not be sufficient. The appropriate value may depend upon the values within wu and v1 as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;** Is it correct for us to presume the arrays will have indices of 0 and nx+1/nz+1?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jim Dempsey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Dec 2023 14:50:36 GMT</pubDate>
    <dc:creator>jimdempseyatthecove</dc:creator>
    <dc:date>2023-12-28T14:50:36Z</dc:date>
    <item>
      <title>do -if -exit whith openmp</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/do-if-exit-whith-openmp/m-p/1557697#M170173</link>
      <description>&lt;P&gt;hello&lt;/P&gt;&lt;P&gt;I want to use openmp to parallelize the code, but I dont konw how to do it with the if-exit code.&lt;/P&gt;&lt;P&gt;My environmrnt is VS2010, and the code is as follows：&lt;/P&gt;&lt;P&gt;!------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;do&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;!$omp do reduction(+:diffall) private(i,j,hs_w,serr,hs_e)&amp;nbsp; &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;do j=1,nz&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;do i=1,nx&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hs_w = (hs(i-1)+hs(i))*0.5d0&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hs_e = (hs(i)+hs(i+1))*0.5d0&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;serr =&amp;nbsp; 1.d0/hs(i)*( (-hs_w*wu(i-1,j)+hs_e*wu(i,j))*dxx+(-v1(i,j-1)+v1(i,j))*dyy )&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; diffall =&amp;nbsp; diffall +dabs(serr)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;end do&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;end do&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;!$omp end do&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;if( diffall&amp;lt;1e-5 ) exit&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;end do&lt;/DIV&gt;&lt;DIV&gt;!------------------------------------------------------------------------------------------&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks in advance&lt;/DIV&gt;</description>
      <pubDate>Wed, 27 Dec 2023 05:39:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/do-if-exit-whith-openmp/m-p/1557697#M170173</guid>
      <dc:creator>gefei</dc:creator>
      <dc:date>2023-12-27T05:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: do -if -exit whith openmp</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/do-if-exit-whith-openmp/m-p/1557839#M170184</link>
      <description>&lt;P&gt;Your code doesn't seem to make sense. Is something missing?&lt;/P&gt;&lt;P&gt;First, diffall is the accumulation of the absolute values of serr, meaning, with the exception of serr=0.0, diffall will be ever increasing. Hence, should the first test of (diffall &amp;lt; 1e-5) fail, all subsequent iterations of your outer loop will fail, and the code will lock in the loops.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now then (supposition on my part), IIF (if and only if) you intend to perform an array search for a combinational instance on indices i and j that produce an (serr &amp;lt; 1.0e-5), and you desire to early exit the parallel region, then please say so.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2023 14:50:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/do-if-exit-whith-openmp/m-p/1557839#M170184</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2023-12-27T14:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: do -if -exit whith openmp</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/do-if-exit-whith-openmp/m-p/1558020#M170200</link>
      <description>&lt;P&gt;Very Thanks to you&lt;/P&gt;&lt;P&gt;The following serial code is hoped to transformed into a parallel version with the openmp：&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;!------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;other code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do&amp;nbsp;&lt;/P&gt;&lt;P&gt;！update hs, wu v1 at a given rule&lt;/P&gt;&lt;P&gt;call update( hs wu v1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;！calculat the abs sum of divergence of dudx and dvdy&lt;/P&gt;&lt;P&gt;serr = 0.0d0&lt;/P&gt;&lt;P&gt;do j=1,nz&lt;BR /&gt;do i=1,nx&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hs_w = (hs(i-1)+hs(i))*0.5d0&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hs_e = (hs(i)+hs(i+1))*0.5d0&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;serr =&amp;nbsp; 1.d0/hs(i)*( (-hs_w*wu(i-1,j)+hs_e*wu(i,j))*dxx+(-v1(i,j-1)+v1(i,j))*dyy )&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; diffall =&amp;nbsp; diffall +dabs(serr)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;end do&lt;BR /&gt;end do&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;！if divergency is small enough, exit the do loop and do the following code , if not，continue to do loop&amp;nbsp; &amp;nbsp;&lt;BR /&gt;if( diffall&amp;lt;1e-5 ) exit&lt;/P&gt;&lt;P&gt;end do&lt;/P&gt;&lt;P&gt;other code&lt;/P&gt;&lt;P&gt;!------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;diffall is defined in a function, which is carried out before the !$OMP paraller&lt;BR /&gt;but have no idea how to parallel the if-exit in the openmp&lt;/P&gt;&lt;P&gt;In your kindness reply "&amp;nbsp;Now then (supposition on my part), IIF (if and only if) you intend to perform an array search for a combinational instance on indices i and j that produce an (serr &amp;lt; 1.0e-5), and you desire to early exit the parallel region, then please say so.&amp;nbsp;" I think that is what I want to deal with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2023 00:46:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/do-if-exit-whith-openmp/m-p/1558020#M170200</guid>
      <dc:creator>gefei</dc:creator>
      <dc:date>2023-12-28T00:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: do -if -exit whith openmp</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/do-if-exit-whith-openmp/m-p/1558162#M170205</link>
      <description>&lt;P&gt;In your initial coding (post 1 of thread), the convergence test was made outside of the parallel region.&lt;/P&gt;&lt;P&gt;Due to the call to update(...) is within the outer most loop .AND. precedes the parallel region containing the inner two loops, placing the convergence test &lt;EM&gt;&lt;STRONG&gt;following&lt;/STRONG&gt; &lt;/EM&gt;the parallel region is the correct place for the test.&lt;/P&gt;&lt;P&gt;Placing the convergence test inside the inner two loops would be incorrect because the value of diffall would be incomplete until the last iteration of both of the inner two loops (and which the exit of the parallel region is imminent.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My only comment is that you evaluate the expected extremes of the input arrays to assure that the convergence test is constructed properly. iow scaling the serr by hs(i) may or may not be sufficient. The appropriate value may depend upon the values within wu and v1 as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;** Is it correct for us to presume the arrays will have indices of 0 and nx+1/nz+1?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jim Dempsey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2023 14:50:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/do-if-exit-whith-openmp/m-p/1558162#M170205</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2023-12-28T14:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: do -if -exit whith openmp</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/do-if-exit-whith-openmp/m-p/1558298#M170206</link>
      <description>&lt;P&gt;Jim:&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;serr =  1.d0/hs(i)*( (-hs_w*wu(i-1,j)+hs_e*wu(i,j))*dxx+(-v1(i,j-1)+v1(i,j))*dyy )  &lt;/LI-CODE&gt;&lt;P&gt;Setting aside the main discussion points, this type of equation is subject to error with the assumed order of calculation, the first division and multiplication would be easy to confuse and give completely different results, as well as the *dyy inside brackets and the *dxx not.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RPN with Lisp is so much better.&amp;nbsp; Bring back the HP Calculator.&amp;nbsp;&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2023 22:25:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/do-if-exit-whith-openmp/m-p/1558298#M170206</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2023-12-28T22:25:44Z</dc:date>
    </item>
  </channel>
</rss>

