<?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 Use ALLOCATABLE instead of in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-when-assigning-two-pointer-arrays-ifort-13-0-1/m-p/960037#M94455</link>
    <description>&lt;P&gt;Use ALLOCATABLE instead of POINTER unless you will be using pointer assignment. With ALLOCATABLE the compiler should not use a temp.&lt;/P&gt;</description>
    <pubDate>Sat, 18 Jan 2014 14:09:39 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2014-01-18T14:09:39Z</dc:date>
    <item>
      <title>Segfault when assigning two pointer arrays (ifort 13.0.1)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-when-assigning-two-pointer-arrays-ifort-13-0-1/m-p/960032#M94450</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;i get a segfault with ifort 13.0.1 when running the following program&lt;/P&gt;

&lt;P&gt;program tmp&lt;BR /&gt;
	&amp;nbsp; implicit none&lt;/P&gt;

&lt;P&gt;&amp;nbsp; integer, parameter:: n=5*10**6&lt;BR /&gt;
	&amp;nbsp; real, pointer:: a(:),b(:)&lt;/P&gt;

&lt;P&gt;&amp;nbsp; allocate(a(n))&lt;BR /&gt;
	&amp;nbsp; allocate(b(n))&lt;/P&gt;

&lt;P&gt;&amp;nbsp; a=b&lt;/P&gt;

&lt;P&gt;end program&lt;/P&gt;

&lt;P&gt;The cause seems to be the large size of the arrays. It does not happen for n=10**6.&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;

&lt;P&gt;Anton&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2014 16:11:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-when-assigning-two-pointer-arrays-ifort-13-0-1/m-p/960032#M94450</guid>
      <dc:creator>anton-d</dc:creator>
      <dc:date>2014-01-15T16:11:56Z</dc:date>
    </item>
    <item>
      <title>You very likely have reach</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-when-assigning-two-pointer-arrays-ifort-13-0-1/m-p/960033#M94451</link>
      <description>&lt;P&gt;You very likely have reach the limit of your stack size. Please set this to unlimited: ulimit -s unlimited.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2014 18:46:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-when-assigning-two-pointer-arrays-ifort-13-0-1/m-p/960033#M94451</guid>
      <dc:creator>Heinz_B_Intel</dc:creator>
      <dc:date>2014-01-15T18:46:17Z</dc:date>
    </item>
    <item>
      <title>Using "ulimit -s unlimited"</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-when-assigning-two-pointer-arrays-ifort-13-0-1/m-p/960034#M94452</link>
      <description>&lt;P&gt;Using "ulimit -s unlimited" solves the problem.&lt;/P&gt;

&lt;P&gt;Can this setting have unexpected drawbacks?&lt;/P&gt;

&lt;P&gt;And also, are pointer arrays allocated on the stack? I don't observe this problem with allocatable arrays. So they are allocated on the heap, correct?&lt;/P&gt;

&lt;P&gt;Many thanks&lt;/P&gt;

&lt;P&gt;Anton&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2014 08:38:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-when-assigning-two-pointer-arrays-ifort-13-0-1/m-p/960034#M94452</guid>
      <dc:creator>anton-d</dc:creator>
      <dc:date>2014-01-16T08:38:09Z</dc:date>
    </item>
    <item>
      <title>No, the issue is that a temp</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-when-assigning-two-pointer-arrays-ifort-13-0-1/m-p/960035#M94453</link>
      <description>&lt;P&gt;No, the issue is that a temp had to be created because we can't reliably know that the target of the two pointers do not overlap.&lt;/P&gt;

&lt;P&gt;With actual allocatables, we do know that they do not overlap, and so do not need the temp.&lt;/P&gt;

&lt;P&gt;By default, however, temps are put on the stack, although this can be changed using the -heap-arrays command line switch.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --Lorri&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2014 18:47:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-when-assigning-two-pointer-arrays-ifort-13-0-1/m-p/960035#M94453</guid>
      <dc:creator>Lorri_M_Intel</dc:creator>
      <dc:date>2014-01-16T18:47:49Z</dc:date>
    </item>
    <item>
      <title>Thanks for the explantion.</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-when-assigning-two-pointer-arrays-ifort-13-0-1/m-p/960036#M94454</link>
      <description>&lt;P&gt;Thanks for the explantion. For very large arrays the creation of a temp array could be undersirable. Is there a way to prevent this? For example using a loop instead of whole array asignment?&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;

&lt;P&gt;Anton&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2014 10:32:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-when-assigning-two-pointer-arrays-ifort-13-0-1/m-p/960036#M94454</guid>
      <dc:creator>anton-d</dc:creator>
      <dc:date>2014-01-17T10:32:21Z</dc:date>
    </item>
    <item>
      <title>Use ALLOCATABLE instead of</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-when-assigning-two-pointer-arrays-ifort-13-0-1/m-p/960037#M94455</link>
      <description>&lt;P&gt;Use ALLOCATABLE instead of POINTER unless you will be using pointer assignment. With ALLOCATABLE the compiler should not use a temp.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jan 2014 14:09:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-when-assigning-two-pointer-arrays-ifort-13-0-1/m-p/960037#M94455</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2014-01-18T14:09:39Z</dc:date>
    </item>
    <item>
      <title>Lorri, Steve,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-when-assigning-two-pointer-arrays-ifort-13-0-1/m-p/960038#M94456</link>
      <description>&lt;P&gt;Lorri, Steve,&lt;/P&gt;

&lt;P&gt;In this case (a=b where a and b are pointers and memory is stride 1), there is no reason for a temp to be created.&amp;nbsp;When both pointer's strides are 1 call memmove (which could call one of two flavors of __intel_fast_memcpy: front-to-back and back-to-front).&lt;/P&gt;

&lt;P&gt;When the pointers are not stride 1, you could fall back to making an extra copy, but I would rather see more work performed to see if the extra copy is absolutely required. IOW&amp;nbsp;only when overlap .AND. when overlap cannot be handled by choice of front-to-back or back-to-front. Such a case might be where you have an overlap and different strides.&lt;/P&gt;

&lt;P&gt;Your compiler optimization team goes to extremes to get the most efficient vectorization, this issue would be relatively trivial to resolve. Considering that the current method performs a memory R+W+R+W as opposed to R+W, it would appear to be "low hanging fruit" as an optimization candidate.&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2014 13:28:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-when-assigning-two-pointer-arrays-ifort-13-0-1/m-p/960038#M94456</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2014-01-20T13:28:57Z</dc:date>
    </item>
    <item>
      <title>Jim, in most cases use of</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-when-assigning-two-pointer-arrays-ifort-13-0-1/m-p/960039#M94457</link>
      <description>&lt;P&gt;Jim, in most cases use of ALLOCATABLE arrays is the better solution. The complex code needed to do the additional checking and various choices would tend to inhibit optimizations. Fortran 2008 adds the CONTIGUOUS attribute which could be used by the compiler to eliminate the temp. As it happens, the current version doesn't do that but a future version will. The programmer should choose the appropriate language syntax.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2014 14:45:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-when-assigning-two-pointer-arrays-ifort-13-0-1/m-p/960039#M94457</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2014-01-20T14:45:12Z</dc:date>
    </item>
  </channel>
</rss>

