<?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 Perhaps this is daft for in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952601#M92583</link>
    <description>&lt;P&gt;Perhaps this is daft for other reasons, but [I think] you get the effect of restrict if the pointer things are passed as arguments to a procedure with non-target, non-pointer dummy arguments that does the assignment.&lt;/P&gt;
&lt;P&gt;That is, an approach would be to run around and do all the fancy pointer assignments in a top level procedure, and then pass the allocated things to worker procedures that do all the real work with non-pointers.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Oct 2013 21:35:01 GMT</pubDate>
    <dc:creator>IanH</dc:creator>
    <dc:date>2013-10-10T21:35:01Z</dc:date>
    <item>
      <title>Restrict equivalent in fortran</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952594#M92576</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;
&lt;P&gt;I'm have rewritten a lot of our code from fortran 77 stype to fortran 2003. I'm making quite a lot of use the the array assignment with the "Array1(1:n) = Array2(1:n)" notation but appreantly it is using the stack create a temporary which causes stack overflows on bigger test cases. The compiler fails to see that no temporary array is needed for this simple statement probably because Array1 and Array2 are pointers. Basically I need to tell the compiler there two pointers are non-overlapping (like restrict does in C). Is this possible in fortran?&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;P.S. I use pointers everyware instead of allocateble because I need to be fully compatible with some legacy code and I need keep track of the memory consumption using special allocator object keeps a list of allocations and deallocated on the destructor of the allocator object (final subroutine).&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 14:20:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952594#M92576</guid>
      <dc:creator>gert_massa</dc:creator>
      <dc:date>2013-10-10T14:20:26Z</dc:date>
    </item>
    <item>
      <title>There is nothing exactly like</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952595#M92577</link>
      <description>&lt;P&gt;There is nothing exactly like "restrict" but the compiler does support the option /Qansi-alias (the name really comes from the C side) that can allow some additional optimization on pointers. I am not sure if it will help here.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 14:36:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952595#M92577</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2013-10-10T14:36:11Z</dc:date>
    </item>
    <item>
      <title>/Qansi-alias is enabled by</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952596#M92578</link>
      <description>&lt;P&gt;/Qansi-alias is enabled by default. So basically I have it replace all these array assignment by do loops?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 14:48:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952596#M92578</guid>
      <dc:creator>gert_massa</dc:creator>
      <dc:date>2013-10-10T14:48:22Z</dc:date>
    </item>
    <item>
      <title>I see that the documentation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952597#M92579</link>
      <description>&lt;P&gt;I see that the documentation says it is the default, but I don't think that's true. But I did an experiment and it did not seem to help in this case. Too bad you can't use allocatable.&lt;/P&gt;
&lt;P&gt;But try this - add the CONTIGUOUS attribute to the POINTER declaration - that improves the code in my testing.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 15:31:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952597#M92579</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2013-10-10T15:31:50Z</dc:date>
    </item>
    <item>
      <title>Steve,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952598#M92580</link>
      <description>&lt;P&gt;Steve,&lt;/P&gt;
&lt;P&gt;CONTIGUOUS would not preclude overlapping regions, thus may affect optimizations, although a runtime test could fix this.&lt;/P&gt;
&lt;P&gt;Any thoughts of adding a !DIR$ to declare following statement or loop has no aliasing issues?&lt;/P&gt;
&lt;P&gt;!DIR$ CONTIGOUS NOALIAS&lt;BR /&gt;Array1(1:n) = Array2(1:n) ! arrays are pointers&lt;/P&gt;
&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 16:24:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952598#M92580</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2013-10-10T16:24:00Z</dc:date>
    </item>
    <item>
      <title>When you add CONTIGUOUS, we</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952599#M92581</link>
      <description>&lt;P&gt;When you add CONTIGUOUS, we call a "fast_memcpy" routine to do the assignment rather than element-by-element. This can check for overlap and do the move in the necessary direction. I am not 100% certain it avoids the tenp but it might. Is it possible to remove the (1:N) in the subscript? If you're moving the whole array, you don't need that.&lt;/P&gt;
&lt;P&gt;I will pass on your suggestion for a NOALIAS attribute for pointers.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 16:56:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952599#M92581</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2013-10-10T16:56:08Z</dc:date>
    </item>
    <item>
      <title>What reason did vec-report or</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952600#M92582</link>
      <description>&lt;P&gt;What reason did vec-report or opt-report give for not vectorizing?&amp;nbsp; How did it compare with use of !dir$ simd (which prevents the compiler from substituting fast_memcpy)?&lt;/P&gt;
&lt;P&gt;simd implies ignoring possibility of overlap.&amp;nbsp; !dir$ ivdep is a less aggressive way to assert no overlap.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 20:58:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952600#M92582</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2013-10-10T20:58:36Z</dc:date>
    </item>
    <item>
      <title>Perhaps this is daft for</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952601#M92583</link>
      <description>&lt;P&gt;Perhaps this is daft for other reasons, but [I think] you get the effect of restrict if the pointer things are passed as arguments to a procedure with non-target, non-pointer dummy arguments that does the assignment.&lt;/P&gt;
&lt;P&gt;That is, an approach would be to run around and do all the fancy pointer assignments in a top level procedure, and then pass the allocated things to worker procedures that do all the real work with non-pointers.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 21:35:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952601#M92583</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2013-10-10T21:35:01Z</dc:date>
    </item>
    <item>
      <title>I can not remove the (1:N)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952602#M92584</link>
      <description>&lt;P&gt;I can not remove the (1:N) because the Array1 is bigger then Array2. Basically my code is increasing the size of my arrays. The CONTIGUOUS attribute nor the CONTIGUOUS NOALIAS directive do not seem to work in my case.&lt;/P&gt;
&lt;P&gt;vec-report:2 gives me the folowing output for this single line&lt;/P&gt;
&lt;P&gt;&amp;nbsp;remark: LOOP WAS VECTORIZED&lt;BR /&gt;&amp;nbsp;remark: loop was not vectorized: vectorization possible but seems inefficient&lt;BR /&gt;&amp;nbsp;remark: LOOP WAS VECTORIZED&lt;BR /&gt;&amp;nbsp;remark: loop was not vectorized: not inner loop&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2013 07:52:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952602#M92584</guid>
      <dc:creator>gert_massa</dc:creator>
      <dc:date>2013-10-11T07:52:56Z</dc:date>
    </item>
    <item>
      <title>Creating a subroutine</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952603#M92585</link>
      <description>&lt;P&gt;Creating a subroutine VectorCopy does solver my problem. I can even pass non contiguous subarray to the subroutine call without any problem. So no copy on the stack is done for a subroutine call I hope it won't create a copy on the heap instead. Is this correct?&lt;/P&gt;
&lt;P&gt;call VectorCopy(Array1(1:n,1:m), Array2(1:n,1:m) ! with n &amp;lt; size(Array1,1)&lt;/P&gt;
&lt;P&gt;P.S. is it possible to override the intrinsic assignment operators by my functions?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2013 08:44:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952603#M92585</guid>
      <dc:creator>gert_massa</dc:creator>
      <dc:date>2013-10-11T08:44:44Z</dc:date>
    </item>
    <item>
      <title>Could you try something like</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952604#M92586</link>
      <description>&lt;P&gt;Could you try something like "Array1(1:n) = Array2(1:n)" becomes "call move_vector (Array1(1), Array2(1), n)" and&lt;/P&gt;
&lt;P&gt;[fortran]&amp;nbsp;&amp;nbsp; subroutine move_vector (a,b,n)&lt;BR /&gt;&amp;nbsp; integer n&lt;BR /&gt;&amp;nbsp; real*8 a(n), b(n)&lt;BR /&gt;&amp;nbsp; b = a&lt;BR /&gt;end subroutine move_vector&lt;BR /&gt;[/fortran]&lt;/P&gt;
&lt;P&gt;It is Fortran 77 style and should not use the stack. I'm not sure if the subroutine would be optimised.&lt;BR /&gt;I'm assuming A and B are typical contiguous arrays.&lt;BR /&gt;If Array1 and Array2 overlap in memory, then you could test the start address of A and B and use a reverse&amp;nbsp;DO loop if LOC(A)&amp;nbsp;&amp;lt; LOC(B)&lt;/P&gt;
&lt;P&gt;John&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2013 08:47:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952604#M92586</guid>
      <dc:creator>John_Campbell</dc:creator>
      <dc:date>2013-10-11T08:47:52Z</dc:date>
    </item>
    <item>
      <title>Gert,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952605#M92587</link>
      <description>&lt;P&gt;Gert,&lt;/P&gt;
&lt;P&gt;For statements like your equate, when a call to Intel's "fast_memcpy" is substituted, the compiler will not report that the code was vectorized.&lt;/P&gt;
&lt;P&gt;IOW do not assume lack of vectorization is lack of optimization.&lt;/P&gt;
&lt;P&gt;Jim Dempsey&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2013 12:50:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952605#M92587</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2013-10-11T12:50:43Z</dc:date>
    </item>
    <item>
      <title>Quote:John Campbell wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952606#M92588</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;John Campbell wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Could you try something like "Array1(1:n) = Array2(1:n)" becomes "call move_vector (Array1(1), Array2(1), n)" and&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; subroutine move_vector (a,b,n) &amp;nbsp; integer n &amp;nbsp; real*8 a(n), b(n) &amp;nbsp; b = a end subroutine move_vector&lt;/P&gt;
&lt;P&gt;It is Fortran 77 style and should not use the stack. I'm not sure if the subroutine would be optimised.&lt;BR /&gt;I'm assuming A and B are typical contiguous arrays.&lt;BR /&gt;If Array1 and Array2 overlap in memory, then you could test the start address of A and B and use a reverse&amp;nbsp;DO loop if LOC(A)&amp;nbsp;&amp;lt; LOC(B)&lt;/P&gt;
&lt;P&gt;John&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I'm missing part of your point, since whole-array assignment surely can't be called "Fortran 77 style."&amp;nbsp; Without a pointer declaration, Fortran does require that the arguments of a subroutine don't overlap.&amp;nbsp; ifort has an option to discard that provision of the standard (assume:dummy_aliases).&lt;/P&gt;
&lt;P&gt;ifort and gfortran don't support reversing loops for vectorization in presence of data overlap.&amp;nbsp; Oracle Fortran, and perhaps Open64, does (probably requiring some effort with c_loc, as you suggested). ifort treats LOC and c_loc as nearly interchangeable, but as you seem to refer to capabilities of other compilers, you should adhere to f2003.&amp;nbsp; memmove(), according to the C definition, is usually built so as to do that.&amp;nbsp; memmove() can be called from Fortran using iso_C_binding.&amp;nbsp; That won't get you the Intel library version (unless you call it by the Internal Intel name).&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2013 13:32:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952606#M92588</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2013-10-11T13:32:48Z</dc:date>
    </item>
    <item>
      <title>Tim,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952607#M92589</link>
      <description>&lt;P&gt;Tim,&lt;/P&gt;
&lt;P&gt;I thought the problem that was identified was that a temporary copy of the array sections were being placed on the stack, causing a stack overflow. The point of my suggestion was that:&lt;BR /&gt;1) the call move_vector (Array1(1), Array2(1), n) should not create a temporary&amp;nbsp;copy, while&lt;BR /&gt;2) the subroutine, using the F77 approach to transfer the array dimensions, should be sufficient to allow ifort to consider arrays a and b as sized arrays and utilise instructions suitable for efficient transfers.&lt;/P&gt;
&lt;P&gt;My comment about using LOC was in response to the original post reference to non-overlapping, as if this was not the case then a LOC test could also easily cover this possibility and make a more robust solution.&lt;/P&gt;
&lt;P&gt;In the past, I&amp;nbsp;have&amp;nbsp;found the creation of temporary copies of array sections to cause this problem and also slow down the execution, where I expected they would not be required.&lt;/P&gt;
&lt;P&gt;John&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2013 22:33:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Restrict-equivalent-in-fortran/m-p/952607#M92589</guid>
      <dc:creator>John_Campbell</dc:creator>
      <dc:date>2013-10-11T22:33:33Z</dc:date>
    </item>
  </channel>
</rss>

