<?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 Does compiler optimization affect Openmp performance? in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Does-compiler-optimization-affect-Openmp-performance/m-p/947230#M5113</link>
    <description>&lt;DIV&gt;Hai,&lt;BR /&gt;I am working with parallelising QCD codes to effectively use both the processors of a node.I found that, with few codes, -g option or -O0 (Supress all optmization) was very efficient (85%-100% gain in performance ie execution time), but the moment , i compile with -O2 otion and run, its only 15%-20% improvement in execution time. And again, this happens only with few programs and i hav other programs that prove to be good with both _o0 and -O2 level of optimization .&lt;/DIV&gt;
&lt;DIV&gt;1. In some programs, One more observation with the above situation was, the scaling down factor in execution time of serial code from -O0 to -O2 was more tha openmp code , eq&lt;BR /&gt;serail : -g option 5 unit of time, -O2 option 2.6 unit of time&lt;BR /&gt;Openmp : -g option 2.5unit of time ,-O2 option 2 units of time.&lt;/DIV&gt;
&lt;DIV&gt;So, openmp is still better than serial, -g is better than -O2 , but the improvement factor is less with -O2 option&lt;/DIV&gt;
&lt;DIV&gt;2. I also have few programs that perform worse with -O2 option&lt;/DIV&gt;
&lt;DIV&gt;Can somebody please explain the cause of such behaviour and a possible soln? Does the problem arise due to the code structure or architectural features like cache , bus bandwidth etc?&lt;/DIV&gt;</description>
    <pubDate>Mon, 26 Jul 2004 02:05:47 GMT</pubDate>
    <dc:creator>madhavikrishnan</dc:creator>
    <dc:date>2004-07-26T02:05:47Z</dc:date>
    <item>
      <title>Does compiler optimization affect Openmp performance?</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Does-compiler-optimization-affect-Openmp-performance/m-p/947230#M5113</link>
      <description>&lt;DIV&gt;Hai,&lt;BR /&gt;I am working with parallelising QCD codes to effectively use both the processors of a node.I found that, with few codes, -g option or -O0 (Supress all optmization) was very efficient (85%-100% gain in performance ie execution time), but the moment , i compile with -O2 otion and run, its only 15%-20% improvement in execution time. And again, this happens only with few programs and i hav other programs that prove to be good with both _o0 and -O2 level of optimization .&lt;/DIV&gt;
&lt;DIV&gt;1. In some programs, One more observation with the above situation was, the scaling down factor in execution time of serial code from -O0 to -O2 was more tha openmp code , eq&lt;BR /&gt;serail : -g option 5 unit of time, -O2 option 2.6 unit of time&lt;BR /&gt;Openmp : -g option 2.5unit of time ,-O2 option 2 units of time.&lt;/DIV&gt;
&lt;DIV&gt;So, openmp is still better than serial, -g is better than -O2 , but the improvement factor is less with -O2 option&lt;/DIV&gt;
&lt;DIV&gt;2. I also have few programs that perform worse with -O2 option&lt;/DIV&gt;
&lt;DIV&gt;Can somebody please explain the cause of such behaviour and a possible soln? Does the problem arise due to the code structure or architectural features like cache , bus bandwidth etc?&lt;/DIV&gt;</description>
      <pubDate>Mon, 26 Jul 2004 02:05:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Does-compiler-optimization-affect-Openmp-performance/m-p/947230#M5113</guid>
      <dc:creator>madhavikrishnan</dc:creator>
      <dc:date>2004-07-26T02:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Does compiler optimization affect Openmp performance?</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Does-compiler-optimization-affect-Openmp-performance/m-p/947231#M5114</link>
      <description>&lt;DIV&gt;Yes, it often happens that performance improvements from OpenMP parallelism and from compiler optimizations don't add up.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;If you are parallelizing the same loop which you are asking the compiler to optimize, you shorten the loops worked on by each CPU. For example, if you split a loop of length 100 in 2, you leave a loop length of 50 for each CPU. If the optimization is done by taking it in groups of 8, that optimization becomes less effective.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;The parts of your program which can't parallelize with OpenMP also are likely not to benefit from other optimizations, so you have a kind of Amdahl's law effect, with a part of your program not responding to either way of improving performance.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;If you have nested loops, combining OpenMP parallelization of the outer loop with optimization of the inner loop is much more effective if the inner loop has stride 1, while the outer loop retains enough iterations for effective threading. If your OpenMP performance happens to be limited by need to pass data between the caches of the 2 processors, you will approach a performance ceiling which can be raised only by improving the data access behavior.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;As you suggest, if a single optimized thread of your program uses 50% or more of the memory bus capacity, and 2 CPUs share the same resources, parallel scaling suffers. There also you could have a performance ceiling.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;On Intel Xeon style processors, if you have these memory problems, you should be giving attention first to having the threads write to distinct memory regions (no false sharing). Then to using the Write Combine buffers efficiently. Northwood is optimized for at most 4 open data streams to write to separatecache linesin a loop, Prescott for 6. If you are using HT, you share these buffers between 3 logical processors. It is very difficult to optimize WCB except with stride 1 arrays, similar to requirements for SSE vectorization.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;More than I should have said without better clues about your application and platform.&lt;/DIV&gt;</description>
      <pubDate>Mon, 26 Jul 2004 04:59:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Does-compiler-optimization-affect-Openmp-performance/m-p/947231#M5114</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2004-07-26T04:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Does compiler optimization affect Openmp performance?</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Does-compiler-optimization-affect-Openmp-performance/m-p/947232#M5115</link>
      <description>&lt;DIV&gt;Tim,&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;gt; Northwood is optimized for at most 4 open data streams to write to&lt;/DIV&gt;
&lt;DIV&gt;&amp;gt; separatecache linesin a loop, Prescott for 6.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;I've been wondering about this for some time... how do you tell what processor you really have ? Where I was previously wondering this was in regards to -xN and -xP (which -fast default has changed, IIRC, going from 8.0 to 8.1 of the C Compiler).&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Thanks,&lt;/DIV&gt;
&lt;DIV&gt;-rajeev-&lt;/DIV&gt;
&lt;DIV&gt;Rajeev Rohatgi&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 18 Sep 2004 01:29:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Does-compiler-optimization-affect-Openmp-performance/m-p/947232#M5115</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2004-09-18T01:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Does compiler optimization affect Openmp performance?</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Does-compiler-optimization-affect-Openmp-performance/m-p/947233#M5116</link>
      <description>Rajeev,&lt;BR /&gt;&lt;BR /&gt;If you don't have a Prescott CPU, a -xP build from an Intel compiler would refuse to run.   I hope that if -fast defaults to -xP, it would do so only when compiling on a Prescott CPU.  The first Prescott CPUs became available on the market less than 2 months ago.  Among the easier ways to distinguish them is by L2 cache size, Northwood having 512kB and Prescott having at least 1MB.  Statistics in /proc/cpuinfo should give you such information.&lt;BR /&gt;&lt;BR /&gt;Tim</description>
      <pubDate>Sat, 18 Sep 2004 05:08:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Does-compiler-optimization-affect-Openmp-performance/m-p/947233#M5116</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2004-09-18T05:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Does compiler optimization affect Openmp performance?</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Does-compiler-optimization-affect-Openmp-performance/m-p/947234#M5117</link>
      <description>&lt;DIV&gt;Thanks Tim ! Northwood it is.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;-rajeev-&lt;/DIV&gt;
&lt;DIV&gt;Rajeev Rohatgi&lt;/DIV&gt;</description>
      <pubDate>Sat, 18 Sep 2004 05:16:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Does-compiler-optimization-affect-Openmp-performance/m-p/947234#M5117</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2004-09-18T05:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Does compiler optimization affect Openmp performance?</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Does-compiler-optimization-affect-Openmp-performance/m-p/947235#M5118</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Hi Eric,&lt;/DIV&gt;
&lt;DIV&gt;The compiler prints a message when it parallelizes OpenMP code. You should be seeing the following messages when you compile your code with the -Qopenmp (Windows) or -openmp (Linux) options:&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New"&gt;code.c(6) : (col. 1) remark: OpenMP DEFINED REGION WAS PARALLELIZED.&lt;BR /&gt;code.c(9) : (col. 1) remark: OpenMP DEFINED LOOP WAS PARALLELIZED.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Do you seethese messages when optimization is disabled but not when optimization is enabled?&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Best regards,&lt;/DIV&gt;
&lt;DIV&gt;Henry&lt;/DIV&gt;</description>
      <pubDate>Wed, 03 Nov 2004 04:39:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Does-compiler-optimization-affect-Openmp-performance/m-p/947235#M5118</guid>
      <dc:creator>Henry_G_Intel</dc:creator>
      <dc:date>2004-11-03T04:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: Does compiler optimization affect Openmp performance?</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Does-compiler-optimization-affect-Openmp-performance/m-p/947236#M5119</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Eric -&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;This is always a tricky issue when it comes up. In the past, I've seen things like this happen. I suspect that the problem might be within the compiler and is caused by some configuration that is unique to your code. It may be the number of statements before or after the loop, the arrangement of statements, the number of blank lines between the pragmas, or some other weird little "corner" situation. This makes creation of a separate test case for demonstration purposes nearly impossible. &lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;To create such a case, may I suggest starting with the orignal code and removing chunks around the loop (likely the code before the loop). You can set up a sort of binary chop to attempt to narrow down the source of the problem. Since this is part of a larger application, there may be consequences for doing this, though, so you may not be able to perform this kind of investigation without drastic changes to other parts of the app to get a stable enough run while trying to find the problem in the loop. If it happens on the first run through this part of the code, simply exit once you've seen whether or not the problem remains.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;If you can try the more recent release of the compiler and the problem is resolved, then you needn't worry about it. If the problem remains, you're back to square one. &lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;If you have uncovered a compiler problem, you should be able to submit the subroutine to Intel Premier Support (modifying the variable names and removing comments in order to disguise the code). The support people should be able to compile the code fragment you give them and compare the generated code to see if there is some adverse interaction between optimizations and OpenMP parallelization triggered from your source.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Good luck with this.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;--clay&lt;/DIV&gt;</description>
      <pubDate>Wed, 03 Nov 2004 07:51:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Does-compiler-optimization-affect-Openmp-performance/m-p/947236#M5119</guid>
      <dc:creator>ClayB</dc:creator>
      <dc:date>2004-11-03T07:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Does compiler optimization affect Openmp performance?</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Does-compiler-optimization-affect-Openmp-performance/m-p/947237#M5120</link>
      <description>&lt;DIV&gt;Hi Eric,&lt;/DIV&gt;
&lt;DIV&gt;Here's a shot in the dark based on an OpenMP bug in an early version of the Intel C++ compiler. Try moving the loop counter declaration out of the for-loop construct. Instead of&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" color="#3333ff"&gt;for (int i = 0; i &amp;lt; N; i++) {...}&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;use&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" color="#3333ff"&gt;#pragma omp parallel&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" color="#3333ff"&gt;{&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" color="#3333ff"&gt; int i;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" color="#3333ff"&gt;#pragma omp for&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" color="#3333ff"&gt; for (i = 0; i &amp;lt; N; i++) {...}&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" color="#3333ff"&gt;}&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Just a hunch.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Henry&lt;/DIV&gt;</description>
      <pubDate>Thu, 04 Nov 2004 05:47:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Does-compiler-optimization-affect-Openmp-performance/m-p/947237#M5120</guid>
      <dc:creator>Henry_G_Intel</dc:creator>
      <dc:date>2004-11-04T05:47:13Z</dc:date>
    </item>
  </channel>
</rss>

