<?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 On Intel processors IA32 and in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Are-OMP-ATOMIC-directives-necessary-in-an-OMP-CRITICAL-region/m-p/1104894#M127686</link>
    <description>&lt;P&gt;On Intel processors IA32 and Intel64 (but not necessarily IA64 and not necessarily&amp;nbsp;some other processors) the above atomics may be unnecessary. A cleaner solution would be to use FLUSH&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;THIS_THREAD = OMP_GET_THREAD_NUM()

!$OMP CRITICAL
!$OMP FLUSH(FAILED_THREAD)
LOCAL_FAILED_THREAD = FAILED_THREAD
IF (LOCAL_FAILED_THREAD==-1) THEN
&amp;nbsp;&amp;nbsp;&amp;nbsp; LOCAL_FAILED_THREAD = THIS_THREAD
&amp;nbsp;&amp;nbsp;&amp;nbsp; FAILED_THREAD = LOCAL_FAILED_THREAD
!$OMP FLUSH(FAILED_THREAD)
END IF
!$OMP END CRITICAL


IF (THIS_THREAD==LOCAL_FAILED_THREAD) THEN
! Do some work here.
END IF
&lt;/PRE&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
    <pubDate>Thu, 06 Oct 2016 21:13:58 GMT</pubDate>
    <dc:creator>jimdempseyatthecove</dc:creator>
    <dc:date>2016-10-06T21:13:58Z</dc:date>
    <item>
      <title>Are !$OMP ATOMIC directives necessary in an !$OMP CRITICAL region?</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Are-OMP-ATOMIC-directives-necessary-in-an-OMP-CRITICAL-region/m-p/1104893#M127685</link>
      <description>&lt;P&gt;The following code snippet is located inside a !$OMP PARALLEL region. THIS_THREAD and LOCAL_FAILED_THREAD are private variables, FAILED_THREAD is a shared variable.&lt;/P&gt;

&lt;P&gt;I am wondering if it is truly necessary to use the !$OMP ATOMIC directives inside the !$OMP CRITICAL region. The intent here is to guarantee memory consistency between what each local thread thinks FAILED_THREAD is; but maybe the mere fact that the access (read or write) to FAILED_THREAD is inside the !$OMP CRITICAL region is sufficient in itself to guarantee this?&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;    THIS_THREAD = OMP_GET_THREAD_NUM()

    !$OMP CRITICAL
    !$OMP ATOMIC READ
    LOCAL_FAILED_THREAD = FAILED_THREAD
    !$OMP END ATOMIC
    IF (LOCAL_FAILED_THREAD==-1) THEN
        LOCAL_FAILED_THREAD = THIS_THREAD
        !$OMP ATOMIC WRITE
        FAILED_THREAD = LOCAL_FAILED_THREAD
        !$OMP END ATOMIC
    END IF
    !$OMP END CRITICAL


    IF (THIS_THREAD==LOCAL_FAILED_THREAD) THEN
    ! Do some work here.
    END IF&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 20:01:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Are-OMP-ATOMIC-directives-necessary-in-an-OMP-CRITICAL-region/m-p/1104893#M127685</guid>
      <dc:creator>OP1</dc:creator>
      <dc:date>2016-10-06T20:01:02Z</dc:date>
    </item>
    <item>
      <title>On Intel processors IA32 and</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Are-OMP-ATOMIC-directives-necessary-in-an-OMP-CRITICAL-region/m-p/1104894#M127686</link>
      <description>&lt;P&gt;On Intel processors IA32 and Intel64 (but not necessarily IA64 and not necessarily&amp;nbsp;some other processors) the above atomics may be unnecessary. A cleaner solution would be to use FLUSH&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;THIS_THREAD = OMP_GET_THREAD_NUM()

!$OMP CRITICAL
!$OMP FLUSH(FAILED_THREAD)
LOCAL_FAILED_THREAD = FAILED_THREAD
IF (LOCAL_FAILED_THREAD==-1) THEN
&amp;nbsp;&amp;nbsp;&amp;nbsp; LOCAL_FAILED_THREAD = THIS_THREAD
&amp;nbsp;&amp;nbsp;&amp;nbsp; FAILED_THREAD = LOCAL_FAILED_THREAD
!$OMP FLUSH(FAILED_THREAD)
END IF
!$OMP END CRITICAL


IF (THIS_THREAD==LOCAL_FAILED_THREAD) THEN
! Do some work here.
END IF
&lt;/PRE&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 21:13:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Are-OMP-ATOMIC-directives-necessary-in-an-OMP-CRITICAL-region/m-p/1104894#M127686</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2016-10-06T21:13:58Z</dc:date>
    </item>
    <item>
      <title>Note, the code provided is</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Are-OMP-ATOMIC-directives-necessary-in-an-OMP-CRITICAL-region/m-p/1104895#M127687</link>
      <description>&lt;P&gt;Note, the code provided is indicative that FAILED_THREAD is read elsewhere. Where it is read may require !$OMP FLUSH(FAILED_THREAD) as well.&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 21:17:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Are-OMP-ATOMIC-directives-necessary-in-an-OMP-CRITICAL-region/m-p/1104895#M127687</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2016-10-06T21:17:55Z</dc:date>
    </item>
    <item>
      <title>Flush is implied at a number</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Are-OMP-ATOMIC-directives-necessary-in-an-OMP-CRITICAL-region/m-p/1104896#M127688</link>
      <description>&lt;P&gt;Flush is implied at a number of locations, including the entry and exit of a critical region (OpenMP 4.5 p168).&lt;/P&gt;

&lt;P&gt;If all reads and writes of&amp;nbsp;&lt;CODE class="plain"&gt;FAILED_THREAD&lt;/CODE&gt; are within that critical construct then &lt;CODE class="plain"&gt;ATOMIC&lt;/CODE&gt; is not required.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 21:40:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Are-OMP-ATOMIC-directives-necessary-in-an-OMP-CRITICAL-region/m-p/1104896#M127688</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2016-10-06T21:40:41Z</dc:date>
    </item>
    <item>
      <title>Thanks to all for the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Are-OMP-ATOMIC-directives-necessary-in-an-OMP-CRITICAL-region/m-p/1104897#M127689</link>
      <description>&lt;P&gt;Thanks to all for the clarification!&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 22:21:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Are-OMP-ATOMIC-directives-necessary-in-an-OMP-CRITICAL-region/m-p/1104897#M127689</guid>
      <dc:creator>OP1</dc:creator>
      <dc:date>2016-10-06T22:21:49Z</dc:date>
    </item>
    <item>
      <title>&gt;&gt;Flush is implied at a</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Are-OMP-ATOMIC-directives-necessary-in-an-OMP-CRITICAL-region/m-p/1104898#M127690</link>
      <description>&lt;P&gt;&amp;gt;&amp;gt;&lt;EM&gt;Flush is implied at a number of locations, including the entry and exit of a critical region (OpenMP 4.5 p168).&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Depending on the rest of the code, it may or may not require more immediate notification than that at the end of the parallel region. This is a design consideration.&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2016 12:10:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Are-OMP-ATOMIC-directives-necessary-in-an-OMP-CRITICAL-region/m-p/1104898#M127690</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2016-10-07T12:10:24Z</dc:date>
    </item>
  </channel>
</rss>

