<?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 Sorry, it was zcopy, but with in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-behaviour-when-passing-pointers-to-BLAS-subroutines/m-p/1157214#M141947</link>
    <description>&lt;P&gt;Sorry, it was zcopy, but with complex(8) not real(8).&lt;/P&gt;

&lt;P&gt;You are right about the abuse of this subroutines, but this is an extract of a code that is not mine.&amp;nbsp; I think the best option for me is just to rewrite part of the code instead of debugging the use of zcopy.&lt;/P&gt;

&lt;P&gt;I cannot simply write A = C&amp;nbsp; as they have differente sizes.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Mar 2018 10:02:44 GMT</pubDate>
    <dc:creator>raffaele_b_</dc:creator>
    <dc:date>2018-03-21T10:02:44Z</dc:date>
    <item>
      <title>ifort behaviour when passing pointers to BLAS subroutines</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-behaviour-when-passing-pointers-to-BLAS-subroutines/m-p/1157211#M141944</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;

&lt;P&gt;I am facing a problem with a code that is related to the status of a pointer after a call to the BLAS subroutine zcopy.&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;The very simple code is the following:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;program test
integer, parameter :: n = 10, m = 21 ! if m=11 the code works
real(8) :: A(n,m)
real(8), pointer :: C(:,:)
! initialize A
A = 0.0
A(1,2) = 4.5
allocate(C(1:m,1:n))
C = transpose(A)
! the call to zcopy should reassign A to its transpose.
call zcopy(n*m, C,1,A,1)
! deallocation here is not succesful
deallocate(C)
end program test&lt;/PRE&gt;

&lt;P&gt;The compiler 17.04 fails to deallocate C, complaining that it is not allocated. If I change m from 21 to 11, the programs doesn't fail and the deallocation is succesful.&amp;nbsp;&lt;SPAN style="font-size: 1em;"&gt;I have a linux system with Ubuntu 16.04.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Could anyone help me to understand what rules am I breaking about the status of pointers?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;Raffaele&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 09:29:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-behaviour-when-passing-pointers-to-BLAS-subroutines/m-p/1157211#M141944</guid>
      <dc:creator>raffaele_b_</dc:creator>
      <dc:date>2018-03-21T09:29:27Z</dc:date>
    </item>
    <item>
      <title>Your arguments to the ZCOPY</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-behaviour-when-passing-pointers-to-BLAS-subroutines/m-p/1157212#M141945</link>
      <description>&lt;P&gt;Your arguments to the ZCOPY call are inconsistent in type (or you have the number of elements wrong) with what ZCOPY wants - you are providing REAL(8) - it expects COMPLEX*16.&amp;nbsp; As a result, execution of ZCOPY trashes memory, all sorts of bad things may then happen.&lt;/P&gt;

&lt;P&gt;Did you intend to call DCOPY?&lt;/P&gt;

&lt;P&gt;The Fortran 90 RESHAPE intrinsic might be of interest.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 09:49:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-behaviour-when-passing-pointers-to-BLAS-subroutines/m-p/1157212#M141945</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2018-03-21T09:49:24Z</dc:date>
    </item>
    <item>
      <title>The BLAS routines use</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-behaviour-when-passing-pointers-to-BLAS-subroutines/m-p/1157213#M141946</link>
      <description>&lt;P&gt;The BLAS routines use implicit interfaces, and do not distinguish between pointer and non-pointer arguments. Originally, they were written in Fortran 77; even if they have been rewritten, whether in Fortran or another language, they have to behave in the same way as Fortran 77 subroutines and functions.&lt;/P&gt;

&lt;P&gt;In the specific code that you showed, the error is the programmer's. The routine ZCOPY is for copying double precision &lt;STRONG&gt;complex&lt;/STRONG&gt; arrays. Your call passes double precision &lt;STRONG&gt;real&lt;/STRONG&gt; arrays. Instead of copying m.n double precision numbers, the routine copies 2.m.n double precision numbers, which clobbers memory that is beyond that allocated for A.&lt;/P&gt;

&lt;P&gt;Why did you call ZCOPY rather than DCOPY? Unless you are writing Fortran 77 code, why call an external routine?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 09:57:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-behaviour-when-passing-pointers-to-BLAS-subroutines/m-p/1157213#M141946</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2018-03-21T09:57:00Z</dc:date>
    </item>
    <item>
      <title>Sorry, it was zcopy, but with</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-behaviour-when-passing-pointers-to-BLAS-subroutines/m-p/1157214#M141947</link>
      <description>&lt;P&gt;Sorry, it was zcopy, but with complex(8) not real(8).&lt;/P&gt;

&lt;P&gt;You are right about the abuse of this subroutines, but this is an extract of a code that is not mine.&amp;nbsp; I think the best option for me is just to rewrite part of the code instead of debugging the use of zcopy.&lt;/P&gt;

&lt;P&gt;I cannot simply write A = C&amp;nbsp; as they have differente sizes.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 10:02:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-behaviour-when-passing-pointers-to-BLAS-subroutines/m-p/1157214#M141947</guid>
      <dc:creator>raffaele_b_</dc:creator>
      <dc:date>2018-03-21T10:02:44Z</dc:date>
    </item>
    <item>
      <title>Sorry for this comment. That</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-behaviour-when-passing-pointers-to-BLAS-subroutines/m-p/1157215#M141948</link>
      <description>&lt;P&gt;Sorry for this comment. That part of the code is working fine. The problem with zcopy is still there in my full code but it is quite difficult to define where the error come from.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 10:14:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-behaviour-when-passing-pointers-to-BLAS-subroutines/m-p/1157215#M141948</guid>
      <dc:creator>raffaele_b_</dc:creator>
      <dc:date>2018-03-21T10:14:44Z</dc:date>
    </item>
    <item>
      <title>No apology needed. You are</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-behaviour-when-passing-pointers-to-BLAS-subroutines/m-p/1157216#M141949</link>
      <description>&lt;P&gt;No apology needed. You are probably at a fork in the road that many of us have faced. You can either ask the original author of the code for help/guidance, or try to craft your own remedy.&amp;nbsp; I appreciate your attempt to create a short example to illustrate the problem with the big code. We have just seen that there is such a thing as oversimplification.&lt;/P&gt;

&lt;P&gt;I suggest that you try to isolate the problem. First, use the -traceback option when compiling, and see if the failure to deallocate is repeatable and locate the part of the code where that happens.&lt;/P&gt;

&lt;P&gt;Second, check the arguments that were passed to the subprogram. Add WRITE statements, dump to a file, or use a symbolic debugger.&lt;/P&gt;

&lt;P&gt;Finally, consider writing a short driver that passes the same arguments to the problematic subprogram.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 12:37:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-behaviour-when-passing-pointers-to-BLAS-subroutines/m-p/1157216#M141949</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2018-03-21T12:37:50Z</dc:date>
    </item>
  </channel>
</rss>

