<?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 Re: Passing non-consecutive array indicies in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741317#M873</link>
    <description>Jim,&lt;BR /&gt;&lt;BR /&gt;Thanks for catching that error. &lt;BR /&gt;&lt;BR /&gt;It appears the error is due to the temp array and the stack size (ulimit -s unlimited fixes the problem).&lt;BR /&gt;&lt;BR /&gt;Unfortunately, I inherited this project and its going to be a mess to fix it. &lt;BR /&gt;&lt;BR /&gt;Thanks again for all the help!!&lt;BR /&gt;&lt;BR /&gt;Case&lt;BR /&gt;</description>
    <pubDate>Tue, 11 Jul 2006 04:51:09 GMT</pubDate>
    <dc:creator>gtopo30</dc:creator>
    <dc:date>2006-07-11T04:51:09Z</dc:date>
    <item>
      <title>Passing non-consecutive array indicies</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741310#M866</link>
      <description>&lt;P&gt;I am working on porting code I didn't write from pgf90 to ifort and I have run into a difference between the two compilers I don't know how to fix.&lt;BR /&gt;&lt;BR /&gt;Here is an example. I have a matrix A which is 5 by 7 elements. Based on tests elsewhere in the code, I construct a vector of "good" rows. So I have good_rows who's values are {1,2,4,5}.&lt;BR /&gt;&lt;BR /&gt;Now, with pgf90 I can pass just the good elements via something like this&lt;BR /&gt;&lt;BR /&gt;call workfn(A(good_rows,:),...)&lt;BR /&gt;&lt;BR /&gt;However, when I compile with ifort (v9 build 20051201) I do not get an error but I will get a segmentation fault at run time.&lt;BR /&gt;&lt;BR /&gt;I hope this is enough info. Any thoughts?&lt;BR /&gt;&lt;BR /&gt;Case&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2006 07:39:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741310#M866</guid>
      <dc:creator>gtopo30</dc:creator>
      <dc:date>2006-07-06T07:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: Passing non-consecutive array indicies</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741311#M867</link>
      <description>It's not enough info, because we would also need to see:&lt;BR /&gt;&lt;BR /&gt;1. Any explicit interface for workfn visible to the caller&lt;BR /&gt;2. The subroutine statement and declaration section from routine workfn&lt;BR /&gt;&lt;BR /&gt;Let me suggest, though, that you may be encountering a bug which was fixed a few months ago. The compiler you are using is six months old. Please download and install 9.1.032 from Intel Premier Support File Downloads and see if that helps. After installing, be sure to invoke the proper ifortvars.sh so that you get the newer compiler.&lt;BR /&gt;</description>
      <pubDate>Fri, 07 Jul 2006 01:16:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741311#M867</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2006-07-07T01:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Passing non-consecutive array indicies</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741312#M868</link>
      <description>Thanks Steve,&lt;BR /&gt;&lt;BR /&gt;I upgraded to 9.1.032 and that didn't change the behavior.&lt;BR /&gt;&lt;BR /&gt;A is declared as a double precision, allocatable, pointer. &lt;BR /&gt;&lt;BR /&gt;good_index is declared as integer, allocatable, pointer.&lt;BR /&gt;&lt;BR /&gt;The subroutine workfn is pretty simple:&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="Courier New"&gt;subroutine workfn(mat, sum)&lt;BR /&gt;implicit none&lt;BR /&gt;&lt;BR /&gt;double precision, dimension(0:,0:), intent(in) :: mat&lt;BR /&gt;double precision, dimension(0:), intent(out) :: sum&lt;BR /&gt;&lt;/FONT&gt;&lt;BR /&gt;The routine runs through a series of mostly simple math to fill out the vector 'sum' based on the "good indicies" of 'mat'.&lt;BR /&gt;&lt;BR /&gt;I hope this helps.&lt;BR /&gt;&lt;BR /&gt;Case&lt;BR /&gt;</description>
      <pubDate>Fri, 07 Jul 2006 23:21:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741312#M868</guid>
      <dc:creator>gtopo30</dc:creator>
      <dc:date>2006-07-07T23:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Passing non-consecutive array indicies</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741313#M869</link>
      <description>Is an explicit interface for workfn visible to the caller? It needs to be as the routine has assumed-shape array arguments.&lt;BR /&gt;&lt;BR /&gt;If that's not the problem, then please submit an example to Intel Premier Support and we'll be glad to look into it.&lt;BR /&gt;</description>
      <pubDate>Sat, 08 Jul 2006 09:51:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741313#M869</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2006-07-08T09:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: Passing non-consecutive array indicies</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741314#M870</link>
      <description>Unfortunately, when I try to log in to "Premier Support", all I get is this page:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://premier.intel.com/scripts-util/quaderror.htm" target="_blank"&gt;https://premier.intel.com/scripts-util/quaderror.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;However, I was able to duplicate the problem in the following manner:&lt;BR /&gt;&lt;BR /&gt;Main Program : &lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="Courier New"&gt;program main&lt;BR /&gt;&lt;BR /&gt;use hmatrix_mod&lt;BR /&gt;&lt;BR /&gt;implicit none&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;type (HMatrix) :: This&lt;BR /&gt;&lt;BR /&gt;double precision :: ds&lt;BR /&gt;&lt;BR /&gt;integer, allocatable, dimension(:) :: mIndex&lt;BR /&gt;integer :: i, j, k, good_ind&lt;BR /&gt;&lt;BR /&gt;good_ind = 1400&lt;BR /&gt;&lt;BR /&gt;allocate(mIndex(0:good_ind-2))&lt;BR /&gt;&lt;BR /&gt;do i=0,49&lt;BR /&gt; mIndex(i) = i&lt;BR /&gt;end do&lt;BR /&gt;&lt;BR /&gt;do i=51,good_ind-2&lt;BR /&gt; mIndex(i-1) = i&lt;BR /&gt;end do&lt;BR /&gt;&lt;BR /&gt;call init_hmatrix(This,good_ind)&lt;BR /&gt;&lt;BR /&gt;call workfn(This%HMatrixValues, ds)&lt;BR /&gt;&lt;BR /&gt;print*,'Passing all, ds = ',ds&lt;BR /&gt;&lt;BR /&gt;call workfn(This%HMatrixValues(mIndex,:),ds)&lt;BR /&gt;&lt;BR /&gt;print*,'Passing some, ds = ',ds&lt;BR /&gt;&lt;BR /&gt;nullify(This%HMatrixValues)&lt;BR /&gt;&lt;BR /&gt;deallocate(mIndex)&lt;BR /&gt;&lt;BR /&gt;end&lt;BR /&gt;&lt;/FONT&gt;&lt;BR /&gt;With one subroutine:&lt;BR /&gt;&lt;FONT face="Courier New"&gt;&lt;BR /&gt;module hmatrix_mod&lt;BR /&gt; implicit none&lt;BR /&gt; &lt;BR /&gt; type HMatrix&lt;BR /&gt; double precision :: HMatrixMinValue&lt;BR /&gt; double precision :: HMatrixResolution&lt;BR /&gt; integer :: HMatrixNumColumns&lt;BR /&gt; integer :: HMatrixNumRows&lt;BR /&gt; double precision, dimension(:,:), pointer :: HMatrixValues&lt;BR /&gt; integer, dimension(:,:), pointer :: HMatrixValueRowIndex&lt;BR /&gt; integer, dimension(:), pointer :: HMatrixNum&lt;BR /&gt; end type HMatrix&lt;BR /&gt; &lt;BR /&gt; double precision, allocatable, target, save :: HMatrixValues_mat(:,:)&lt;BR /&gt; integer, allocatable, target, save :: HMatrixValuesRowIndex_mat(:,:)&lt;BR /&gt; integer, allocatable, target, save :: HMatrixNum_mat(:)&lt;BR /&gt;&lt;BR /&gt;contains&lt;BR /&gt; &lt;BR /&gt; subroutine workfn(matVal, sum)&lt;BR /&gt; implicit none&lt;BR /&gt; &lt;BR /&gt; double precision, dimension (0:,0:), intent(in) :: matVal&lt;BR /&gt; double precision :: sum&lt;BR /&gt; &lt;BR /&gt; integer :: i, j, k&lt;BR /&gt; &lt;BR /&gt; sum = 0.d0&lt;BR /&gt; &lt;BR /&gt; do i=0,size(matVal,1)-1&lt;BR /&gt; do j=0,size(matVal,2)-1&lt;BR /&gt; sum = sum + matVal(i,j)&lt;BR /&gt; end do&lt;BR /&gt; end do&lt;BR /&gt; &lt;BR /&gt; return&lt;BR /&gt; &lt;BR /&gt; end subroutine workfn&lt;BR /&gt; &lt;BR /&gt; subroutine init_hmatrix(HM, indx)&lt;BR /&gt; implicit none&lt;BR /&gt; &lt;BR /&gt; type(HMatrix), intent(out) :: HM&lt;BR /&gt; &lt;BR /&gt; integer :: indx, i, j, k&lt;BR /&gt; &lt;BR /&gt;&amp;amp;nbs
p; if(allocated(HMatrixValues_mat)) then&lt;BR /&gt; deallocate(HMatrixValues_mat)&lt;BR /&gt; endif&lt;BR /&gt;&lt;BR /&gt; if(allocated(HMatrixValuesRowIndex_mat)) then&lt;BR /&gt; deallocate(HMatrixValuesRowIndex_mat)&lt;BR /&gt; endif&lt;BR /&gt;&lt;BR /&gt; if(allocated(HMatrixNum_mat)) then&lt;BR /&gt; deallocate(HMatrixNum_mat)&lt;BR /&gt; endif&lt;BR /&gt;&lt;BR /&gt; allocate(HMatrixNum_mat(0:indx-1))&lt;BR /&gt; allocate(HMatrixValuesRowIndex_mat(0:indx-1,0:indx-1))&lt;BR /&gt; allocate(HMatrixValues_mat(0:indx-1,0:indx-1))&lt;BR /&gt; &lt;BR /&gt; HMatrixNum_mat = 0&lt;BR /&gt; HMatrixValuesRowIndex_mat = -1&lt;BR /&gt; HMatrixValues_mat = 1.d0&lt;BR /&gt; &lt;BR /&gt; HM%HMatrixValues =&amp;gt; HMatrixValues_mat&lt;BR /&gt; HM%HMatrixValueRowIndex =&amp;gt; HMatrixValuesRowIndex_mat&lt;BR /&gt; HM%HMatrixNum =&amp;gt; HMatrixNum_mat&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; end subroutine init_hmatrix&lt;BR /&gt; &lt;BR /&gt;end module hmatrix_mod&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;Everything was compiled with&lt;BR /&gt;&lt;BR /&gt;ifort -mcmodel=medium -g -CB -i-dynamic -fpic main.f90 hmatrix_mod.f90 -o Main&lt;BR /&gt;&lt;BR /&gt;This causes the same behavior (segmentation fault) as the program earlier.&lt;BR /&gt;&lt;BR /&gt;Case&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Jul 2006 01:38:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741314#M870</guid>
      <dc:creator>gtopo30</dc:creator>
      <dc:date>2006-07-11T01:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: Passing non-consecutive array indicies</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741315#M871</link>
      <description>&lt;P&gt;Case,&lt;/P&gt;
&lt;P&gt;You have a programming error:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;allocate(mIndex(0:good_ind-2))&lt;BR /&gt;&lt;BR /&gt;do i=0,49&lt;BR /&gt; mIndex(i) = i&lt;BR /&gt;end do&lt;BR /&gt;&lt;BR /&gt;do i=51,good_ind-2&lt;BR /&gt; mIndex(i-1) = i&lt;BR /&gt;end do&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;Allocates from mIndex(0) thru mIndex(good_ind-2)&lt;BR /&gt;The second do loop finishes up at &lt;BR /&gt;mIndex(good_ind-2-1) &lt;BR /&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;where the array mIndex ends at good_ind-2. This results in mIndex(good_ind-2) being undefined.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;Don't know if this is causes the error message you are seeing. But using an initialized index is not good.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;Jim Dempsey&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2006 04:27:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741315#M871</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2006-07-11T04:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Passing non-consecutive array indicies</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741316#M872</link>
      <description>&lt;P&gt;One more thing.&lt;/P&gt;
&lt;P&gt;The way you havethe calls to workfn coded will result in a temporary array being created. It may be more efficient to pass in the entire array plus an integer array of the selected rows (using -1 to indicate end of list or row not selected). In this manner a temporary array is not created. This results in faster runtimes as well as reducing stack requirements for temporary arrays.&lt;/P&gt;
&lt;P&gt;Jim Dempsey&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2006 04:33:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741316#M872</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2006-07-11T04:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: Passing non-consecutive array indicies</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741317#M873</link>
      <description>Jim,&lt;BR /&gt;&lt;BR /&gt;Thanks for catching that error. &lt;BR /&gt;&lt;BR /&gt;It appears the error is due to the temp array and the stack size (ulimit -s unlimited fixes the problem).&lt;BR /&gt;&lt;BR /&gt;Unfortunately, I inherited this project and its going to be a mess to fix it. &lt;BR /&gt;&lt;BR /&gt;Thanks again for all the help!!&lt;BR /&gt;&lt;BR /&gt;Case&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Jul 2006 04:51:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741317#M873</guid>
      <dc:creator>gtopo30</dc:creator>
      <dc:date>2006-07-11T04:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: Passing non-consecutive array indicies</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741318#M874</link>
      <description>&lt;P&gt;Case,&lt;/P&gt;
&lt;P&gt;You might try options -O0 -g -traceback -check bounds&lt;/P&gt;
&lt;P&gt;this will help catch other array bounds issues that might be hiding in the code.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2006 23:25:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741318#M874</guid>
      <dc:creator>Ron_Green</dc:creator>
      <dc:date>2006-07-11T23:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Passing non-consecutive array indicies</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741319#M875</link>
      <description>&lt;P&gt;Case,&lt;/P&gt;
&lt;P&gt;The stack size issue is a build and run environment issue and other than for performance and memory capacity requirement is not a fundimental problem with the old code you inherited.&lt;/P&gt;
&lt;P&gt;Invalid subscripting though &lt;EM&gt;is &lt;/EM&gt;a fundimental problem with the old code you inherited. As suggested in another reply, it would be well worth your time to make a few runs with the array subscript checks as well as the uninitialized variable checkoptions enabled. "A stitch in time saves nine."&lt;/P&gt;
&lt;P&gt;Jim Dempsey&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2006 00:37:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Passing-non-consecutive-array-indicies/m-p/741319#M875</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2006-07-12T00:37:53Z</dc:date>
    </item>
  </channel>
</rss>

