<?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: Segmentation fault in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segmentation-fault/m-p/754247#M9757</link>
    <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
I can set the stack size limit to 'unlimited' without having to do it as root. I just wondered if there is any way to do it from within my program.&lt;BR /&gt;</description>
    <pubDate>Wed, 01 Apr 2009 06:29:00 GMT</pubDate>
    <dc:creator>jirina</dc:creator>
    <dc:date>2009-04-01T06:29:00Z</dc:date>
    <item>
      <title>Segmentation fault</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segmentation-fault/m-p/754242#M9752</link>
      <description>I am getting a segmentation fault in my program. When I use the debugger (idb), the program stops at at the first line of the subroutine find_binary_file_record which is called like this:&lt;BR /&gt;
&lt;PRE&gt;[cpp]write(name,'(a,i2.2)' 'Transformer ', i
call find_binary_file_record ( 11, name, value, .true., new_value )

subroutine find_binary_file_record ( code, name, value, check_names, new_value )[/cpp]&lt;/PRE&gt;
with&lt;BR /&gt;
&lt;PRE&gt;[cpp]integer*4 code
character*25 name
real*8 value
logical*4 check_names, new_value[/cpp]&lt;/PRE&gt;
in both the calling and the called subroutine if applicable.&lt;BR /&gt;&lt;BR /&gt;The segmentation fault occurs in both release and debug version. The debug version is compiled using following options:&lt;BR /&gt;
&lt;PRE&gt;[cpp]ifort -debug -g -fixed -extend_source 132 -openmp -fpscomp general -warn declarations -assume byterecl -align all -heap-arrays -static-intel -threads *.for -o myApp.out[/cpp]&lt;/PRE&gt;
Based on the discussion in &lt;A href="http://software.intel.com/en-us/forums/showthread.php?t=62964" target="_blank"&gt;this thread&lt;/A&gt;, I tried adding following options:&lt;BR /&gt;
&lt;PRE&gt;[cpp]-fp-stack-check -check all -traceback -gen-interfaces -warn interfaces[/cpp]&lt;/PRE&gt;
However, the segmentation error is still occuring.&lt;BR /&gt;&lt;BR /&gt;I made sure that the stack size is unlimited by setting it so (ulimit -s unlimited) and I am using -heap-arrays also because of OpenMP stuff in my program.&lt;BR /&gt;&lt;BR /&gt;I have already mentioned this problem &lt;A href="http://software.intel.com/en-us/forums/showthread.php?t=62011" target="_blank"&gt;in this thread&lt;/A&gt; and it helped to increase the stack size limit. Since that, the program has been extended and the segmentation fault is back again.&lt;BR /&gt;&lt;BR /&gt;I tried to read &lt;A href="http://software.intel.com/en-us/articles/intel-fortran-compiler-increased-stack-usage-of-80-or-higher-compilers-causes-segmentation-fault/" target="_blank"&gt;another thread&lt;/A&gt; on the stack usage and the segmentation fault, but I am not sure if the Linux note mentioning the stack size in various 32bit Linux distributions applies to my case. I use Fedora 10.</description>
      <pubDate>Thu, 26 Mar 2009 12:33:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segmentation-fault/m-p/754242#M9752</guid>
      <dc:creator>jirina</dc:creator>
      <dc:date>2009-03-26T12:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Segmentation fault</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segmentation-fault/m-p/754243#M9753</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
It seems that the problem was somewhere else. There were two arrays delared in the subroutine find_binary_file_record:&lt;BR /&gt;
&lt;PRE&gt;[cpp]subroutine find_binary_file_record ( code, name, value, check_names, new_value )
...
integer*4 MAX_CHANGES
parameter ( MAX_CHANGES=1000000 )
real*8 change_time(MAX_CHANGES), change_value(MAX_CHANGES)
...[/cpp]&lt;/PRE&gt;
It helped to change the above mentioned to&lt;BR /&gt;
&lt;PRE&gt;[cpp]real*8, allocatable :: change_time(:), change_value(:)
allocate ( change_time(MAX_CHANGES), change_value(MAX_CHANGES), stat=errNo )[/cpp]&lt;/PRE&gt;
&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Mar 2009 09:12:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segmentation-fault/m-p/754243#M9753</guid>
      <dc:creator>jirina</dc:creator>
      <dc:date>2009-03-27T09:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: Segmentation fault</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segmentation-fault/m-p/754244#M9754</link>
      <description>&lt;DIV style="margin: 0px; height: auto;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;Moving to allocatable array resolving the error shows that the problem is still related to the stack. Is the subroutine called from inside a parallel region? Maybe you can have a try to set OpenMP runtime environment variable "KMP_STACKSIZE" to larger size like "32000000" (32m).</description>
      <pubDate>Mon, 30 Mar 2009 09:36:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segmentation-fault/m-p/754244#M9754</guid>
      <dc:creator>Xiaoping_D_Intel</dc:creator>
      <dc:date>2009-03-30T09:36:45Z</dc:date>
    </item>
    <item>
      <title>Re: Segmentation fault</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segmentation-fault/m-p/754245#M9755</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
No, the subroutine is not called from a parallel region.&lt;BR /&gt;&lt;BR /&gt;I went back to what was causing problems before and I ran some tests:&lt;BR /&gt;&lt;BR /&gt;'ulimit -s' in the shell yields 10240 and running my program triggers the segmentation fault. I tried to include following piece of code in my application:&lt;BR /&gt;
&lt;PRE&gt;[cpp]integer*4 status&lt;BR /&gt;status = system('ulimit -s unlimited')&lt;BR /&gt;write(*,'(a,i3)') ' ulimit status: ', status[/cpp]&lt;/PRE&gt;
When I run my program, the status is 0, the segmentation fault occurs and 'ulimit -s' yields 10240 again. Specifying 'ulimit -s unlimited' directly in the shell resolves the problem, but I wanted my program to do this automatically. &lt;STRONG&gt;Is there any way to do it? Why does my code from above not work as expected?&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;I would also like to ask how to set KMP_STACKSIZE.&lt;/STRONG&gt; I found in help that some functions can be called or that 'export KMP_STACKSIZE=value' can be used, but it did not work. I tried typing 'export KMP_STACKSIZE=100000000' in the shell and run my program immediately after that, but I got the segmentation fault again.&lt;BR /&gt;&lt;BR /&gt;Also, I discovered that the sequence of commands 'ulimit -s unlimited', 'ulimit -s 10240' and 'ulimit -s unlimited' produces an error 'bash: ulimit: stack size: cannot modify limit: Operation not permitted'. This might be of no importance; it it just a side effect of my tests.</description>
      <pubDate>Mon, 30 Mar 2009 21:55:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segmentation-fault/m-p/754245#M9755</guid>
      <dc:creator>jirina</dc:creator>
      <dc:date>2009-03-30T21:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Segmentation fault</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segmentation-fault/m-p/754246#M9756</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
kmp stacksize sets thread stack limit. If your problem is not associated with a parallel region, KMP_STACKSIZE should not have an influence.&lt;BR /&gt;Depending on the context, the maximum ulimit allowed to a user may be limited by the value set as root.&lt;BR /&gt;</description>
      <pubDate>Mon, 30 Mar 2009 23:47:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segmentation-fault/m-p/754246#M9756</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2009-03-30T23:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: Segmentation fault</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segmentation-fault/m-p/754247#M9757</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
I can set the stack size limit to 'unlimited' without having to do it as root. I just wondered if there is any way to do it from within my program.&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Apr 2009 06:29:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segmentation-fault/m-p/754247#M9757</guid>
      <dc:creator>jirina</dc:creator>
      <dc:date>2009-04-01T06:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: Segmentation fault</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segmentation-fault/m-p/754248#M9758</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;Yes. Ron provided a method in the earlier thread (&lt;A href="http://software.intel.com/en-us/forums/showthread.php?t=43795" target="_blank"&gt;here&lt;/A&gt;).</description>
      <pubDate>Wed, 01 Apr 2009 11:24:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segmentation-fault/m-p/754248#M9758</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2009-04-01T11:24:10Z</dc:date>
    </item>
  </channel>
</rss>

