<?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 Optimizing a nested loop using ipp in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Optimizing-a-nested-loop-using-ipp/m-p/1159101#M7903</link>
    <description>&lt;P&gt;I have an application with a 3 dim nested loop where the innermost loop is performing: output&lt;J&gt;&lt;K&gt; += in&lt;I&gt;&lt;K&gt; * scalar&lt;I&gt;&lt;J&gt;&lt;K&gt;, where i≈1000, j≈200, k≈4000 and the data type is a complex float (8 bytes).&amp;nbsp; I'm running in Linux on an Intel CPU with 40 cores (20 w/ ht).&amp;nbsp; The application can be configured to distribute the work in the i dimension across multiple threads.&amp;nbsp;&lt;/K&gt;&lt;/J&gt;&lt;/I&gt;&lt;/K&gt;&lt;/I&gt;&lt;/K&gt;&lt;/J&gt;&lt;/P&gt;&lt;P&gt;Without using IPP the total calculation completes in: ~11.6sec for 1thread and ~0.48sec for 40 threads for a speedup of ~24x.&amp;nbsp; This shows an acceptable speedup but the total time is too long. &amp;nbsp;&lt;/P&gt;&lt;P&gt;With IPP, using&amp;nbsp;ippsAddProduct_32fc() with length of k for each call, the total calculation completes in ~1.16sec for 1 thread and ~0.27sec for 40 threads for a speedup of only ~4x.&amp;nbsp; This total time is much lower, but the speedup is nowhere near what I'd like.&lt;/P&gt;&lt;P&gt;Can anyone please explain the lack of speedup and/or suggest ways to improve the speedup when using multiple threads with IPP.&lt;/P&gt;</description>
    <pubDate>Mon, 09 Sep 2019 15:40:16 GMT</pubDate>
    <dc:creator>Bombey__Jasper</dc:creator>
    <dc:date>2019-09-09T15:40:16Z</dc:date>
    <item>
      <title>Optimizing a nested loop using ipp</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Optimizing-a-nested-loop-using-ipp/m-p/1159101#M7903</link>
      <description>&lt;P&gt;I have an application with a 3 dim nested loop where the innermost loop is performing: output&lt;J&gt;&lt;K&gt; += in&lt;I&gt;&lt;K&gt; * scalar&lt;I&gt;&lt;J&gt;&lt;K&gt;, where i≈1000, j≈200, k≈4000 and the data type is a complex float (8 bytes).&amp;nbsp; I'm running in Linux on an Intel CPU with 40 cores (20 w/ ht).&amp;nbsp; The application can be configured to distribute the work in the i dimension across multiple threads.&amp;nbsp;&lt;/K&gt;&lt;/J&gt;&lt;/I&gt;&lt;/K&gt;&lt;/I&gt;&lt;/K&gt;&lt;/J&gt;&lt;/P&gt;&lt;P&gt;Without using IPP the total calculation completes in: ~11.6sec for 1thread and ~0.48sec for 40 threads for a speedup of ~24x.&amp;nbsp; This shows an acceptable speedup but the total time is too long. &amp;nbsp;&lt;/P&gt;&lt;P&gt;With IPP, using&amp;nbsp;ippsAddProduct_32fc() with length of k for each call, the total calculation completes in ~1.16sec for 1 thread and ~0.27sec for 40 threads for a speedup of only ~4x.&amp;nbsp; This total time is much lower, but the speedup is nowhere near what I'd like.&lt;/P&gt;&lt;P&gt;Can anyone please explain the lack of speedup and/or suggest ways to improve the speedup when using multiple threads with IPP.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 15:40:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Optimizing-a-nested-loop-using-ipp/m-p/1159101#M7903</guid>
      <dc:creator>Bombey__Jasper</dc:creator>
      <dc:date>2019-09-09T15:40:16Z</dc:date>
    </item>
    <item>
      <title>You may be experiencing a</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Optimizing-a-nested-loop-using-ipp/m-p/1159102#M7904</link>
      <description>&lt;P&gt;You may be experiencing a memory bandwidth limitation. Run VTune to get the numbers.&lt;/P&gt;&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 17:14:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Optimizing-a-nested-loop-using-ipp/m-p/1159102#M7904</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2019-09-10T17:14:55Z</dc:date>
    </item>
    <item>
      <title>I don't have much experience</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Optimizing-a-nested-loop-using-ipp/m-p/1159103#M7905</link>
      <description>&lt;P&gt;I don't have much experience with VTune, but I ran it for various thread counts and here's the results:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Threads: 1, Time: 1.2sec, DRAMBound: 0%, ipp call LLC Miss Count: 98%&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Threads: 2, Time: 0.6sec, DRAMBound: 0%, ipp call LLC Miss Count: 97%&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Threads: 4, Time: 0.43sec, DRAMBound: 4.3%, ipp call LLC Miss Count: 98.6%&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Threads: 8, Time: 0.28sec, DRAMBound: 81%, ipp call LLC Miss Count: 98%&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Thread: 10, Time: 0.26sec, DRAMBound: 92%, ipp call LLC Miss Count: 98%&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Thread: 20, Time: 0.26sec, DRAMBound: 75%, ipp call LLC Miss Count: 98%&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Thread: 40, Time: 0.23sec, DRAMBound: 90%, ipp call LLC Miss Count: 96%&lt;/P&gt;&lt;P&gt;Looks like once 4 or more threads are used it starts to become DRAMBound and the speedup doesn't scale optimally.&amp;nbsp; Is there any way to optimize the nested loop (change index ordering/change array sizes) to utilize less memory (or utilize the memory more efficiently) across many threads? &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 02:05:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Optimizing-a-nested-loop-using-ipp/m-p/1159103#M7905</guid>
      <dc:creator>Bombey__Jasper</dc:creator>
      <dc:date>2019-09-12T02:05:10Z</dc:date>
    </item>
    <item>
      <title>Look at the vectorization</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Optimizing-a-nested-loop-using-ipp/m-p/1159104#M7906</link>
      <description>&lt;P&gt;Look at the vectorization reports to see how well (bad) the program is vectorized. I usually use VTune, and examine the disassembly code of the hot spots. If they are not vectorized then figure out why and fix it. Most often poor vectorization is due to inefficient data organization.&lt;/P&gt;&lt;P&gt;The compile also has vectorization reports.&lt;/P&gt;&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2019 11:41:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Optimizing-a-nested-loop-using-ipp/m-p/1159104#M7906</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2019-09-13T11:41:33Z</dc:date>
    </item>
    <item>
      <title>Looking at assembly code in</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Optimizing-a-nested-loop-using-ipp/m-p/1159105#M7907</link>
      <description>&lt;P&gt;Looking at assembly code in VTune as you recommended it seems the problem areas are vectorized, I think, but I'm not certain since I'm not too familiar with assembly code.&amp;nbsp; Here are the instructions that were highlighted in red:&lt;/P&gt;&lt;P&gt;vmovshdupy (%rsi), %ymm3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CPI: 4.8&lt;/P&gt;&lt;P&gt;vmovsldupy (%rsi), %mm4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CPI: 6.2&lt;/P&gt;&lt;P&gt;vaddpsy&amp;nbsp; 0x20(%rdx), %ymm9, %ymm11 &amp;nbsp; &amp;nbsp; CPI: 6.576&lt;/P&gt;&lt;P&gt;If they are already vectorized is there anyway to improve the CPI, and thus the overall performance?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 21:03:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Optimizing-a-nested-loop-using-ipp/m-p/1159105#M7907</guid>
      <dc:creator>Bombey__Jasper</dc:creator>
      <dc:date>2019-09-19T21:03:00Z</dc:date>
    </item>
    <item>
      <title>Complex code often runs</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Optimizing-a-nested-loop-using-ipp/m-p/1159106#M7908</link>
      <description>&lt;P&gt;Complex code often runs significantly faster if it is stored as separate real and imaginary vectors and the complex arithmetic is inserted manually.&amp;nbsp; The SIMD vector approach works a lot better with data that is contiguous in memory.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 21:43:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Optimizing-a-nested-loop-using-ipp/m-p/1159106#M7908</guid>
      <dc:creator>McCalpinJohn</dc:creator>
      <dc:date>2019-09-19T21:43:05Z</dc:date>
    </item>
    <item>
      <title>&gt;&gt; it seems the problem areas</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Optimizing-a-nested-loop-using-ipp/m-p/1159107#M7909</link>
      <description>&lt;P&gt;&amp;gt;&amp;gt;&amp;nbsp;&lt;EM&gt;it seems the problem areas are vectorized&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;There is vectorizaton, then there is vectorization. Not all are equal.&lt;/P&gt;&lt;P&gt;The instructions you listed indicates you are compiling for SSE3 instruction set on system with AVX capability. I cannot explain why the VTune report is listing the %mm4 register (MMX instruction portion of %xmm4, %ymm4, or %zmm4), it is likely because that instruction is not supported in the disassembly of the op code as an AVX instruction.&lt;/P&gt;&lt;P&gt;As John stated, when you have arrays of complex numbers, it is much more computationally efficient to split the "array" into two parts (two arrays). Then perform a little more programming to perform the operations.&lt;/P&gt;&lt;P&gt;Jim Dempsey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 16:00:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Optimizing-a-nested-loop-using-ipp/m-p/1159107#M7909</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2019-09-20T16:00:57Z</dc:date>
    </item>
  </channel>
</rss>

