<?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 Cache Coherency in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Cache-Coherency/m-p/899196#M4131</link>
    <description>&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;Hello&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;Given a cache line is 16 bytes wide (depending on processor)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;Given in a multi-processor system (separate caches)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;A shared variable cannot reliably be modified using&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Arial"&gt;&lt;SPAN style="mso-tab-count: 1"&gt; &lt;/SPAN&gt;add dword ptr [edx], eax&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;without potentially producing the incorrect result.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;A means to correct for this problem is to use the LOCK prefix&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Arial"&gt;&lt;SPAN style="mso-tab-count: 1"&gt; &lt;/SPAN&gt;LOCK add dword ptr [edx], eax&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;This is easy to comprehend. (I know cmpxchg is typically used)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;Consider&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;long Count1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;long Count2;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;Where Count1 is exclusively used by one thread, and Count2 is exclusively used by a different thread.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;The question is:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;If Count1 and Count2 lie within the same 16 byte paragraph. Would the LOCK be required even though each 4-byte variable is exclusively used by only one thread?&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;If the LOCK is required then c
onsider using OpenMP on an array of real(4)'s. Depending on memory placement of the array and how OpenMP divides up the work into stripes of the array you could potentialy have interactions at the ends of each stripe. Is this a concerne?&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;Jim&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 11 Nov 2006 05:53:11 GMT</pubDate>
    <dc:creator>jimdempseyatthecove</dc:creator>
    <dc:date>2006-11-11T05:53:11Z</dc:date>
    <item>
      <title>Cache Coherency</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Cache-Coherency/m-p/899196#M4131</link>
      <description>&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;Hello&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;Given a cache line is 16 bytes wide (depending on processor)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;Given in a multi-processor system (separate caches)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;A shared variable cannot reliably be modified using&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Arial"&gt;&lt;SPAN style="mso-tab-count: 1"&gt; &lt;/SPAN&gt;add dword ptr [edx], eax&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;without potentially producing the incorrect result.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;A means to correct for this problem is to use the LOCK prefix&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Arial"&gt;&lt;SPAN style="mso-tab-count: 1"&gt; &lt;/SPAN&gt;LOCK add dword ptr [edx], eax&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;This is easy to comprehend. (I know cmpxchg is typically used)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;Consider&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;long Count1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;long Count2;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;Where Count1 is exclusively used by one thread, and Count2 is exclusively used by a different thread.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;The question is:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;If Count1 and Count2 lie within the same 16 byte paragraph. Would the LOCK be required even though each 4-byte variable is exclusively used by only one thread?&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Arial" size="2"&gt;If the LOCK is required then c
onsider using OpenMP on an array of real(4)'s. Depending on memory placement of the array and how OpenMP divides up the work into stripes of the array you could potentialy have interactions at the ends of each stripe. Is this a concerne?&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;Jim&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;P&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2006 05:53:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Cache-Coherency/m-p/899196#M4131</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2006-11-11T05:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Cache Coherency</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Cache-Coherency/m-p/899197#M4132</link>
      <description>&lt;P&gt;It will work fine, but be very slow, after each write, the &lt;FONT face="Arial" size="2"&gt;cache &lt;/FONT&gt;line will be invalidated on the other core. That is called false sharing.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2006 01:11:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Cache-Coherency/m-p/899197#M4132</guid>
      <dc:creator>Daniel_S_9</dc:creator>
      <dc:date>2006-11-15T01:11:00Z</dc:date>
    </item>
  </channel>
</rss>

