<?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: segfault with reshaping and transposing big arrays in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746905#M4625</link>
    <description>Thanks for the answers.
&lt;BR /&gt;
&lt;BR /&gt;Stack size was 10240 kbytes (Fedora 8 x86_64). Setting it to unlimited  (ulimit -s unlimited) solved the problem, as does the switch -heap-arrays. 
&lt;BR /&gt;
&lt;BR /&gt;Greetings,
&lt;BR /&gt;
&lt;BR /&gt;Wim
&lt;BR /&gt;</description>
    <pubDate>Tue, 12 Feb 2008 17:28:10 GMT</pubDate>
    <dc:creator>wim_van_hoydonck</dc:creator>
    <dc:date>2008-02-12T17:28:10Z</dc:date>
    <item>
      <title>segfault with reshaping and transposing big arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746900#M4620</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;For big arrays ( &amp;gt; 1048 by 3000), the following line gives a segfault (complete test program at the end):&lt;BR /&gt;&lt;BR /&gt;b = reshape( transpose(a) , shape(b) )&lt;BR /&gt;&lt;BR /&gt;whereas splitting this line in two, does not result in a crash:&lt;BR /&gt;&lt;BR /&gt;at = transpose(a)&lt;BR /&gt;b = reshape( at , shape(b) )&lt;BR /&gt;&lt;BR /&gt;This happens with:&lt;BR /&gt;ifort (IFORT) 10.1 20080112&lt;BR /&gt;and&lt;BR /&gt;ifort (IFORT) 10.1 20070913&lt;BR /&gt;&lt;BR /&gt;with or without optimization.&lt;BR /&gt;&lt;BR /&gt;Compiling with gfortran or g95 doesn't result in a segfault.&lt;BR /&gt;&lt;BR /&gt;For integer(1) arrays, the segfault occurs when the array is approximately 4 times as big. Memory problem?&lt;BR /&gt;&lt;BR /&gt;valgrind reports this (amongst other things):&lt;BR /&gt;==5654== Invalid write of size 1&lt;BR /&gt;==5654== at 0x402FA0: MAIN__ (test.f90:15)&lt;BR /&gt;==5654== Address 0x7FE48E380 is on thread 1's stack&lt;BR /&gt;==5654== Can't extend stack to 0x7FE48DA90 during signal delivery for thread 1:&lt;BR /&gt;==5654== no stack segment&lt;BR /&gt;==5654==&lt;BR /&gt;==5654== Process terminating with default action of signal 11 (SIGSEGV)&lt;BR /&gt;==5654== Access not within mapped region at address 0x7FE48DA90&lt;BR /&gt;==5654== at 0x402FA0: MAIN__ (test.f90:15)&lt;BR /&gt;==5654==&lt;BR /&gt;==5654== Invalid write of size 8&lt;BR /&gt;==5654== at 0x4802338: _vgnU_freeres (vg_preloaded.c:56)&lt;BR /&gt;==5654== Address 0x7FE48E2F8 is on thread 1's stack&lt;BR /&gt;==5654==&lt;BR /&gt;==5654== Process terminating with default action of signal 11 (SIGSEGV)&lt;BR /&gt;==5654== Access not within mapped region at address 0x7FE48E2F8&lt;BR /&gt;==5654== at 0x4802338: _vgnU_freeres (vg_preloaded.c:56)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Greetings,&lt;BR /&gt;&lt;BR /&gt;Wim&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;!*test.f90************************************&lt;BR /&gt;program test&lt;BR /&gt;&lt;BR /&gt;integer , parameter :: nx = 1049 , ny = 3000&lt;BR /&gt;integer , allocatable :: a(:,:) , at(:,:) , b(:)&lt;BR /&gt;integer :: status&lt;BR /&gt;&lt;BR /&gt;allocate ( a(nx,ny) , b(nx*ny) , at(ny,nx) , stat=status )&lt;BR /&gt;print *, status&lt;BR /&gt;&lt;BR /&gt;forall(i=1:nx,j=1:ny) a(i,j) = i*j&lt;BR /&gt;&lt;BR /&gt;at = transpose(a)&lt;BR /&gt;b = reshape( at , shape(b) )&lt;BR /&gt;&lt;BR /&gt;! ifort segfaults here&lt;BR /&gt;b = reshape( transpose(a) , shape(b) )&lt;BR /&gt;&lt;BR /&gt;deallocate( a , b , at )&lt;BR /&gt;&lt;BR /&gt;end program test&lt;BR /&gt;!********************************************************&lt;/P&gt;</description>
      <pubDate>Sat, 09 Feb 2008 22:57:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746900#M4620</guid>
      <dc:creator>wim_van_hoydonck</dc:creator>
      <dc:date>2008-02-09T22:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: segfault with reshaping and transposing big arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746901#M4621</link>
      <description>Looks like a shameless stack abuse case to me.&lt;BR /&gt;
Try to compile your software with the qualifier &lt;B&gt;-heap-arrays 0&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;</description>
      <pubDate>Sun, 10 Feb 2008 00:12:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746901#M4621</guid>
      <dc:creator>oh_moose</dc:creator>
      <dc:date>2008-02-10T00:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: segfault with reshaping and transposing big arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746902#M4622</link>
      <description>Thanks,
&lt;BR /&gt;
&lt;BR /&gt;That works :)
&lt;BR /&gt;
&lt;BR /&gt;Now I have to figure out why...
&lt;BR /&gt;</description>
      <pubDate>Sun, 10 Feb 2008 12:55:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746902#M4622</guid>
      <dc:creator>wim_van_hoydonck</dc:creator>
      <dc:date>2008-02-10T12:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: segfault with reshaping and transposing big arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746903#M4623</link>
      <description>On Linux/x86 the stack size is limited to 8 MiB. That is a pretty large
stack for calling routines. Unfortunately some languages put the actual
values of function arguments onto the stack for a function call.
Fortran puts references (pointers) to the arguments onto the stack. And
to make matters worse, some compilers put all local variables of
functions onto the stack, too. At least the Intel Fortran compiler for
Linux allows you to set the maximum size of arrays on the stack. Any
array above the specified size ends up on the heap (see &lt;I&gt;woman ifort&lt;/I&gt;). With &lt;B&gt;-heap-arrays 0&lt;/B&gt; you tell the compiler to put &lt;U&gt;all&lt;/U&gt;
arrays (including temporary copies and intermediate results) onto the heap. I am sure there is a performance penalty for
doing the right thing. You could tune this option, but with large
arrays on the stack you may just postpone the crash.&lt;BR /&gt;
&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Feb 2008 22:37:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746903#M4623</guid>
      <dc:creator>oh_moose</dc:creator>
      <dc:date>2008-02-11T22:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: segfault with reshaping and transposing big arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746904#M4624</link>
      <description>My understanding is that on Linux the stacksize is initially set by a kernel parameter. You can raise the stacksize limit with commands such as:&lt;BR /&gt;&lt;BR /&gt;ulimit -s&lt;BR /&gt;or&lt;BR /&gt;limit stacksize unlimited&lt;BR /&gt;&lt;BR /&gt;where "unlimited" really means "maximum as defined when the kernel was built". The stack can't exceed 1GB on 32-bit, I believe.&lt;BR /&gt;&lt;BR /&gt;Regarding the -heap-arrays switch - you can leave off the 0 as that is the default. There is a small performance penalty due to the allocate and deallocate calls but my feeling is that this is typically swamped by the routine execution time. You can specify a non-zero parameter, so that allocations under the specified size are still done on the stack, but this affects only those cases where the size is known at compile-time.&lt;BR /&gt;&lt;BR /&gt;If using -heap-arrays means that the program runs whereas without it it doesn't, the performance difference is not relevant.&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Feb 2008 15:04:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746904#M4624</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2008-02-12T15:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: segfault with reshaping and transposing big arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746905#M4625</link>
      <description>Thanks for the answers.
&lt;BR /&gt;
&lt;BR /&gt;Stack size was 10240 kbytes (Fedora 8 x86_64). Setting it to unlimited  (ulimit -s unlimited) solved the problem, as does the switch -heap-arrays. 
&lt;BR /&gt;
&lt;BR /&gt;Greetings,
&lt;BR /&gt;
&lt;BR /&gt;Wim
&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Feb 2008 17:28:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746905#M4625</guid>
      <dc:creator>wim_van_hoydonck</dc:creator>
      <dc:date>2008-02-12T17:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: segfault with reshaping and transposing big arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746906#M4626</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Greetings,&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;i have a similar problem. I am getting the following error when I compile my code with ifort with optimization -03. It is a fortran code.&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;I re-ran with unlimited stack size but, this time, the problem fails for larger arrays (larger grids).&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Can't extend stack to 0x7FE7BE2B0 during signal delivery for thread 1:&lt;BR /&gt;==2255== no stack segment&lt;BR /&gt;==2255==&lt;BR /&gt;==2255== Process terminating with default action of signal 11 (SIGSEGV)&lt;BR /&gt;==2255== Access not within mapped region at address 0x7FE7BE2B0&lt;BR /&gt;==2255== at 0x42E7C3: global_mp_read_data_ &lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;When I ran with using &lt;STRONG&gt;-heap-arrays 0, &lt;/STRONG&gt;it does not compile and throws an error. What is the correct way of using this option &lt;STRONG&gt;-heap-arrays 0 ?&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;$ mpif77 -O3 -heap-arrays 0 -o 500iterV0.exe V0.f90&lt;BR /&gt;ld: 1: No such file: No such file or directory&lt;BR /&gt;mpif77: No such file or directory&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;$ mpif77 -heap-arrays 0 -O3 -o 500iterV0.exe V0.f90&lt;BR /&gt;ld: 0: No such file: No such file or directory&lt;BR /&gt;mpif77: No such file or directory&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;I know fortran compiler exists as I am able to compile the code without using &lt;STRONG&gt;-heap-arrays 0 &lt;/STRONG&gt;as shown below:&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;$ mpif77 -O3 -o 500iterV0.exe V0.f90&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Pl advise. Thank you.&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/193784"&gt;wim.van.hoydonck@gmail.com&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt; Thanks for the answers. &lt;BR /&gt; &lt;BR /&gt;Stack size was 10240 kbytes (Fedora 8 x86_64). Setting it to unlimited  (ulimit -s unlimited) solved the problem, as does the switch -heap-arrays.  &lt;BR /&gt; &lt;BR /&gt;Greetings, &lt;BR /&gt; &lt;BR /&gt;Wim &lt;BR /&gt; &lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Nov 2008 03:01:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746906#M4626</guid>
      <dc:creator>kristipati</dc:creator>
      <dc:date>2008-11-18T03:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: segfault with reshaping and transposing big arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746907#M4627</link>
      <description>&lt;P&gt;OS Info:&lt;/P&gt;
&lt;P&gt;Linux 2.6.12.6 #1 Thu Dec 22 19:30:31 EST 2005 x86_64 x86_64 x86_64 GNU/Linux&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Nov 2008 03:03:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746907#M4627</guid>
      <dc:creator>kristipati</dc:creator>
      <dc:date>2008-11-18T03:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: segfault with reshaping and transposing big arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746908#M4628</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;P&gt;Just leave off the 0.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Nov 2008 06:49:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746908#M4628</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2008-11-18T06:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: segfault with reshaping and transposing big arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746909#M4629</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;I did that and I was able to compile the code.&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;But, when I run the valgrind, I still get the stack error.&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;$ mpif77 -heap-arrays -O3 -o 500iterV0.exe V0.f90&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;$ mpirun -np 1 valgrind --tool=cachegrind ./500iterV0.exe&lt;BR /&gt;==6685== Cachegrind, an I1/D1/L2 cache profiler.&lt;BR /&gt;==6685== Copyright (C) 2002-2005, and GNU GPL'd, by Nicholas Nethercote et al.&lt;BR /&gt;==6685== Using LibVEX rev 1471, a library for dynamic binary translation.&lt;BR /&gt;==6685== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.&lt;BR /&gt;==6685== Using valgrind-3.1.0, a dynamic binary instrumentation framework.&lt;BR /&gt;==6685== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.&lt;BR /&gt;==6685== For more details, rerun with: -v&lt;BR /&gt;==6685==&lt;BR /&gt; g0_1.dat&lt;BR /&gt;==6685== Can't extend stack to 0x7FE7BE000 during signal delivery for thread 1:&lt;BR /&gt;==6685== no stack segment&lt;BR /&gt;==6685==&lt;BR /&gt;==6685== Process terminating with default action of signal 11 (SIGSEGV)&lt;BR /&gt;==6685== Access not within mapped region at address 0x7FE7BE000&lt;BR /&gt;==6685== at 0x42E7C3: global_mp_read_data_ (in /scratch/pavan/thesis/600/500iterV0.exe)&lt;BR /&gt;==6685==&lt;BR /&gt;==6685== I refs: 958,292&lt;BR /&gt;==6685== I1 misses: 3,741&lt;BR /&gt;==6685== L2i misses: 3,092&lt;BR /&gt;==6685== I1 miss rate: 0.39%&lt;BR /&gt;==6685== L2i miss rate: 0.32%&lt;BR /&gt;==6685==&lt;BR /&gt;==6685== D refs: 368,659 (248,427 rd + 120,232 wr)&lt;BR /&gt;==6685== D1 misses: 17,562 ( 10,986 rd + 6,576 wr)&lt;BR /&gt;==6685== L2d misses: 11,220 ( 5,126 rd + 6,094 wr)&lt;BR /&gt;==6685== D1 miss rate: 4.7% ( 4.4% + 5.4% )&lt;BR /&gt;==6685== L2d miss rate: 3.0% ( 2.0% + 5.0% )&lt;BR /&gt;==6685==&lt;BR /&gt;==6685== L2 refs: 21,303 ( 14,727 rd + 6,576 wr)&lt;BR /&gt;==6685== L2 misses: 14,312 ( 8,218 rd + 6,094 wr)&lt;BR /&gt;==6685== L2 miss rate: 1.0% ( 0.6% + 5.0% )&lt;BR /&gt;-----------------------------------------------------------------------------&lt;BR /&gt;One of the processes started by mpirun has exited with a nonzero exit&lt;BR /&gt;code. This typically indicates that the process finished in error.&lt;BR /&gt;If your process did not finish in error, be sure to include a "return&lt;BR /&gt;0" or "exit(0)" in your C code before exiting the application.&lt;BR /&gt;&lt;BR /&gt;PID 6685 failed on node n0 (127.0.0.1) due to signal 11.&lt;BR /&gt;-----------------------------------------------------------------------------&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/336209"&gt;Steve Lionel (Intel)&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;
&lt;P&gt;Just leave off the 0.&lt;/P&gt;
&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Nov 2008 14:45:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/segfault-with-reshaping-and-transposing-big-arrays/m-p/746909#M4629</guid>
      <dc:creator>kristipati</dc:creator>
      <dc:date>2008-11-18T14:45:33Z</dc:date>
    </item>
  </channel>
</rss>

