<?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 Why is code slower with when allocate is used vs. static arrays in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Why-is-code-slower-with-when-allocate-is-used-vs-static-arrays/m-p/745286#M3481</link>
    <description>Is the program correct? The !$OMP PARALLEL is opened but not closed... and I don't undertstand the static array declaration, shouldn't it read:&lt;BR /&gt;&lt;BR /&gt;real :: a(0:262145,100),b(0:262145,100) ?&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 02 Apr 2010 09:25:24 GMT</pubDate>
    <dc:creator>rreis</dc:creator>
    <dc:date>2010-04-02T09:25:24Z</dc:date>
    <item>
      <title>Why is code slower with when allocate is used vs. static arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Why-is-code-slower-with-when-allocate-is-used-vs-static-arrays/m-p/745285#M3480</link>
      <description>I have talked to a few F90 experts but have not found a good answer to my problem.. Why is the code below run twice as slow when the arrays are dynamically allocated vs. statically? I tried a few compiler options (-fno-alias, -static) and tried&lt;BR /&gt;using VECTOR NONTEMPORAL but nothing helps. &lt;BR /&gt;&lt;BR /&gt;In this case on a 2.8GHz Nehalem (not shared), the performance difference is 2x.&lt;BR /&gt;&lt;BR /&gt;Is using allocatable arrays such as this (typical use in numerical models) just slower? If so, why?&lt;BR /&gt;&lt;BR /&gt;I compiled the code with ifort -O3 -xSSE4.2 -fno-alias -fpp relax.f -o relax, and added -DDYNAMIC to enable&lt;BR /&gt;allocatable memory. The compiler version is 11.1.038.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Craig&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;program relax&lt;BR /&gt;&lt;BR /&gt; integer :: mbyte=262144&lt;BR /&gt; integer :: nb=100&lt;BR /&gt;&lt;BR /&gt;#if defined(DYNAMIC)&lt;BR /&gt; real,allocatable :: a(:,:),b(:,:)&lt;BR /&gt; allocate(a(0:mbyte+1,nb))&lt;BR /&gt; allocate(b(0:mbyte+1,nb))&lt;BR /&gt;#else &lt;BR /&gt; real :: a(0,262145),b(0,262145)&lt;BR /&gt;#endif&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt; a=100&lt;BR /&gt; b=100&lt;BR /&gt;&lt;BR /&gt; do iter=1,100&lt;BR /&gt;!$OMP parallel do&lt;BR /&gt; do n=1,nb&lt;BR /&gt; do k=1,mbyte&lt;BR /&gt; b(k,n)=(a(k+1,n)+a(k-1,n))/2.&lt;BR /&gt; end do&lt;BR /&gt; end do&lt;BR /&gt;!$OMP parallel do&lt;BR /&gt; do n=1,nb&lt;BR /&gt; do k=1,mbyte&lt;BR /&gt; a(k,n)=b(k,n)&lt;BR /&gt; end do&lt;BR /&gt; end do&lt;BR /&gt; call sub(a)&lt;BR /&gt; print *,iter&lt;BR /&gt; end do&lt;BR /&gt; stop&lt;BR /&gt; end&lt;BR /&gt; subroutine sub()&lt;BR /&gt; return&lt;BR /&gt; end&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Apr 2010 21:55:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Why-is-code-slower-with-when-allocate-is-used-vs-static-arrays/m-p/745285#M3480</guid>
      <dc:creator>crtierney42</dc:creator>
      <dc:date>2010-04-01T21:55:38Z</dc:date>
    </item>
    <item>
      <title>Why is code slower with when allocate is used vs. static arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Why-is-code-slower-with-when-allocate-is-used-vs-static-arrays/m-p/745286#M3481</link>
      <description>Is the program correct? The !$OMP PARALLEL is opened but not closed... and I don't undertstand the static array declaration, shouldn't it read:&lt;BR /&gt;&lt;BR /&gt;real :: a(0:262145,100),b(0:262145,100) ?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 02 Apr 2010 09:25:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Why-is-code-slower-with-when-allocate-is-used-vs-static-arrays/m-p/745286#M3481</guid>
      <dc:creator>rreis</dc:creator>
      <dc:date>2010-04-02T09:25:24Z</dc:date>
    </item>
    <item>
      <title>Why is code slower with when allocate is used vs. static arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Why-is-code-slower-with-when-allocate-is-used-vs-static-arrays/m-p/745287#M3482</link>
      <description>Why the static version and dynamic allocated version arrays have different data size and shape? &lt;BR /&gt;&lt;BR /&gt;The allocatable version has shape of (262145,100). The static version has shape of (0,262145) and its data size is 0. Obviously there will be out-of-bound error for the static version in following loops. If compiled with runtime check enabled by "-C" option there will be a runtime error:&lt;BR /&gt;&lt;BR /&gt;forrtl: severe (408): fort: (2): Subscript #1 of the array A has value 2 which is greater than the upper bound of 0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 02 Apr 2010 09:25:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Why-is-code-slower-with-when-allocate-is-used-vs-static-arrays/m-p/745287#M3482</guid>
      <dc:creator>Xiaoping_D_Intel</dc:creator>
      <dc:date>2010-04-02T09:25:45Z</dc:date>
    </item>
    <item>
      <title>Why is code slower with when allocate is used vs. static arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Why-is-code-slower-with-when-allocate-is-used-vs-static-arrays/m-p/745288#M3483</link>
      <description>Ahhh, I wrote bad code. It was a sanity check that went bad. Yes the code had bugs. After fixing them,&lt;BR /&gt;the two cases run pretty much the same.&lt;BR /&gt;&lt;BR /&gt;Sorry for the post.&lt;BR /&gt;&lt;BR /&gt;Craig&lt;BR /&gt;</description>
      <pubDate>Fri, 02 Apr 2010 18:55:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Why-is-code-slower-with-when-allocate-is-used-vs-static-arrays/m-p/745288#M3483</guid>
      <dc:creator>crtierney42</dc:creator>
      <dc:date>2010-04-02T18:55:56Z</dc:date>
    </item>
  </channel>
</rss>

