<?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 Stack vs heap in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Stack-vs-heap/m-p/1004162#M104352</link>
    <description>&lt;P&gt;Are there any performance issues in using the heap instead of the stack? Does software compiled with the option /heap_arrays0 run slower than code that uses the stack?&lt;/P&gt;

&lt;P&gt;ChrisG&lt;/P&gt;</description>
    <pubDate>Thu, 25 Sep 2014 08:13:57 GMT</pubDate>
    <dc:creator>Chris_G_2</dc:creator>
    <dc:date>2014-09-25T08:13:57Z</dc:date>
    <item>
      <title>Stack vs heap</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Stack-vs-heap/m-p/1004162#M104352</link>
      <description>&lt;P&gt;Are there any performance issues in using the heap instead of the stack? Does software compiled with the option /heap_arrays0 run slower than code that uses the stack?&lt;/P&gt;

&lt;P&gt;ChrisG&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2014 08:13:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Stack-vs-heap/m-p/1004162#M104352</guid>
      <dc:creator>Chris_G_2</dc:creator>
      <dc:date>2014-09-25T08:13:57Z</dc:date>
    </item>
    <item>
      <title>Some years ago, certain</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Stack-vs-heap/m-p/1004163#M104353</link>
      <description>&lt;P&gt;Some years ago, certain popular ifort benchmarks allocated an array of length 3 on heap, used it, and deallocated it, all within the inner loop. That produced a significant performance deficit. With subsequent improvement in ifort so as to perform the allocation outside the inner DO loops, it makes no measurable difference whether heap or stack allocation is used.&lt;/P&gt;

&lt;P&gt;If there is a performance problem with heap allocation, a profiler such as VTune will show significant time spent in the library functions which implement allocate and deallocate.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2014 10:49:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Stack-vs-heap/m-p/1004163#M104353</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2014-09-25T10:49:54Z</dc:date>
    </item>
    <item>
      <title>A lot depends on how often</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Stack-vs-heap/m-p/1004164#M104354</link>
      <description>&lt;P&gt;A lot depends on how often these temporary allocations need to be made. As Tim suggests, if you are doing it many times in a tight loop, the overhead can be measurable, but in most applications it is not. The more useful aspect is that enabling heap arrays can make the difference between the program running at all or not. That said, if you can manage to avoid making copies of arrays, which is one thing these temps are used for, that can improve performance. The copying is independent of how the memory is allocated.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2014 12:50:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Stack-vs-heap/m-p/1004164#M104354</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2014-09-25T12:50:42Z</dc:date>
    </item>
    <item>
      <title>Thanks for these replies.</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Stack-vs-heap/m-p/1004165#M104355</link>
      <description>&lt;P&gt;Thanks for these replies.&lt;/P&gt;

&lt;P&gt;The reason I posted this enquiry arose from a recent experience with the &lt;EM&gt;transpose&lt;/EM&gt; and &lt;EM&gt;matmul&lt;/EM&gt; intrinsic procedures. I am using (up to) 2000x2000 real*8 arrays which are allocated and deallocated in the usual way as needed. I found however that using the &lt;EM&gt;transpose&lt;/EM&gt; and &lt;EM&gt;matmul&lt;/EM&gt; functions was giving rise to a stack overflow with large arrays. If I re-compiled the program with the option &lt;EM&gt;/heap_arrays0 &lt;/EM&gt;the problem disappeared. This means, I presume, that everything is on the heap and not the stack, and I was wondering about performance issues.&lt;/P&gt;

&lt;P&gt;ChrisG&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2014 14:10:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Stack-vs-heap/m-p/1004165#M104355</guid>
      <dc:creator>Chris_G_2</dc:creator>
      <dc:date>2014-09-25T14:10:52Z</dc:date>
    </item>
    <item>
      <title>For such a large array the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Stack-vs-heap/m-p/1004166#M104356</link>
      <description>&lt;P&gt;For such a large array the allocate/deallocate time will be noise compared to the computation and memory traffic.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2014 14:17:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Stack-vs-heap/m-p/1004166#M104356</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2014-09-25T14:17:58Z</dc:date>
    </item>
  </channel>
</rss>

