<?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 The issue on the system that in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971128#M97160</link>
    <description>&lt;P&gt;The issue on the system that fails relates to exhausting the available shell stack space related to the creation of stack-based arrays.&lt;/P&gt;
&lt;P&gt;You can check the shell stack space with either &lt;STRONG&gt;ulimit -s &lt;/STRONG&gt;(bash) or &lt;STRONG&gt;limit stacksize&lt;/STRONG&gt; (csh).&lt;/P&gt;
&lt;P&gt;To change either, use:&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;ulimit -s &lt;/STRONG&gt;&lt;EM&gt;&amp;lt;value&amp;gt;&lt;/EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&amp;nbsp; or &lt;STRONG&gt;limit stacksize &lt;/STRONG&gt;&lt;EM&gt;&amp;lt;value&amp;gt;&lt;/EM&gt;, where &lt;EM&gt;&amp;lt;value&amp;gt;&lt;/EM&gt; is specified in kbytes. &lt;EM&gt;&amp;lt;value&amp;gt;&lt;/EM&gt; can also be specified as: &lt;STRONG&gt;unlimited&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;For additional information about this type of failure refer to &lt;A href="http://software.intel.com/en-us/articles/determining-root-cause-of-sigsegv-or-sigbus-errors/" target="_blank"&gt;&lt;STRONG&gt;Determining Root Cause of Segmentation Faults SIGSEGV or SIGBUS errors&amp;nbsp;&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Apr 2014 09:32:12 GMT</pubDate>
    <dc:creator>Kevin_D_Intel</dc:creator>
    <dc:date>2014-04-04T09:32:12Z</dc:date>
    <item>
      <title>What is the maximum character length allowed?</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971127#M97159</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I wrote this simple code (see below) that converts an array of real into a very long string of characters.&lt;BR /&gt;I have been running this little code on 2 different machines and I compiled it with the same compler on both machines :&lt;/P&gt;
&lt;P&gt;Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.1.106 Build 20131008&lt;BR /&gt;Copyright (C) 1985-2013 Intel Corporation.&amp;nbsp; All rights reserved.&lt;/P&gt;
&lt;P&gt;Both machines are equipped with Intel processors,&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;one with processors like : Intel(R) Xeon(R) CPU E5472&amp;nbsp; @ 3.00GHz&lt;/LI&gt;
&lt;LI&gt;and the other one with processor like : Intel(R) Xeon(R) CPU E5506&amp;nbsp; @ 2.13GHz&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;While on machine 1, the code works fine, on machine 2, I get a "Segmentation fault (core dumped)" message most of the time with n = 2093504.&lt;/P&gt;
&lt;P&gt;So, is there a maximum character length allowed that is machine-dependant? How can I know this maximum?&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;F.&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="brush:fortran;"&gt;program test

        implicit none

        integer :: i
        real, allocatable :: cube(:)
        integer :: n, length

        n = 2093503 ! OK
        n = 2093504 ! Segmentation fault
        length = 4*n
        write(*,*) n, length
        if (.not. allocated(cube)) allocate(cube(n))

        do i = 1, n
            call random(cube(i))
        end do

        call sub(cube, n, length)

    end program

    subroutine sub(array, n, length)

        implicit none

        integer :: n, len
        real :: array(n), f
        character(length) :: buf
        character(4) :: c
        integer :: i

        equivalence(f, c)

        write(*,*) n, length
        do i = 1, n
            f = array(i)

            buf(4*(i-1)+1:4*(i-1)+4) = c(1:4)
        end do

    end subroutine sub&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Apr 2014 08:48:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971127#M97159</guid>
      <dc:creator>fuji_s_</dc:creator>
      <dc:date>2014-04-04T08:48:13Z</dc:date>
    </item>
    <item>
      <title>The issue on the system that</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971128#M97160</link>
      <description>&lt;P&gt;The issue on the system that fails relates to exhausting the available shell stack space related to the creation of stack-based arrays.&lt;/P&gt;
&lt;P&gt;You can check the shell stack space with either &lt;STRONG&gt;ulimit -s &lt;/STRONG&gt;(bash) or &lt;STRONG&gt;limit stacksize&lt;/STRONG&gt; (csh).&lt;/P&gt;
&lt;P&gt;To change either, use:&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;ulimit -s &lt;/STRONG&gt;&lt;EM&gt;&amp;lt;value&amp;gt;&lt;/EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&amp;nbsp; or &lt;STRONG&gt;limit stacksize &lt;/STRONG&gt;&lt;EM&gt;&amp;lt;value&amp;gt;&lt;/EM&gt;, where &lt;EM&gt;&amp;lt;value&amp;gt;&lt;/EM&gt; is specified in kbytes. &lt;EM&gt;&amp;lt;value&amp;gt;&lt;/EM&gt; can also be specified as: &lt;STRONG&gt;unlimited&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;For additional information about this type of failure refer to &lt;A href="http://software.intel.com/en-us/articles/determining-root-cause-of-sigsegv-or-sigbus-errors/" target="_blank"&gt;&lt;STRONG&gt;Determining Root Cause of Segmentation Faults SIGSEGV or SIGBUS errors&amp;nbsp;&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Apr 2014 09:32:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971128#M97160</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2014-04-04T09:32:12Z</dc:date>
    </item>
    <item>
      <title>Thanks Kevin,
That was it.</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971129#M97161</link>
      <description>&lt;P&gt;Thanks Kevin,&lt;/P&gt;

&lt;P&gt;That was it.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Apr 2014 09:37:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971129#M97161</guid>
      <dc:creator>fuji_s_</dc:creator>
      <dc:date>2014-04-04T09:37:16Z</dc:date>
    </item>
    <item>
      <title>The correct way to have fixed</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971130#M97162</link>
      <description>&lt;P&gt;The correct way to have fixed this is with the foreknowledge that "length" is very large in&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#006699"&gt;character&lt;/FONT&gt;&lt;/STRONG&gt;&lt;CODE class="fortran plain"&gt;(length) :: buf&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;would be to use:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#006699"&gt;character&lt;/FONT&gt;&lt;/STRONG&gt;&lt;CODE class="fortran plain"&gt;(:),&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#006699" face="Arial"&gt;allocatable&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;:: buf&lt;BR /&gt;
	...&lt;BR /&gt;
	&lt;STRONG&gt;&lt;FONT color="#006699" face="Arial"&gt;allocate&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;(&lt;STRONG&gt;&lt;FONT color="#006699" face="Arial"&gt;character&lt;/FONT&gt;&lt;/STRONG&gt;&lt;CODE class="fortran plain"&gt;(length)::&lt;/CODE&gt;buf)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The "ulimit" is fine if, and only if, the program is, and will always remain, single threaded.&lt;/P&gt;

&lt;P&gt;BTW insert a test for allocation failure such that you can take appropriate action.&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Fri, 04 Apr 2014 12:38:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971130#M97162</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2014-04-04T12:38:00Z</dc:date>
    </item>
    <item>
      <title>You can search the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971131#M97163</link>
      <description>&lt;P&gt;You can search the documentation index for "compiler limits". Online, the page for that is &lt;A href="http://software.intel.com/en-us/node/463616"&gt;here&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;I note that we don't document a limit for character lengths - the theoretical limit is 2**31-1 for IA-32 and 2**63-1 for Intel 64. I will suggest that we add this to the documentation.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Apr 2014 15:40:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971131#M97163</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2014-04-04T15:40:14Z</dc:date>
    </item>
    <item>
      <title>@Jim, I learned something. I</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971132#M97164</link>
      <description>&lt;P&gt;@Jim, I learned something. I didn't know one could do this : &lt;STRONG&gt;allocate&lt;/STRONG&gt;&amp;nbsp;(&lt;STRONG&gt;character&lt;/STRONG&gt;(length)::buf)&lt;BR /&gt;
	I'll try that.&lt;/P&gt;

&lt;P&gt;@Steve, good idea.&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;

&lt;P&gt;F.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Apr 2014 08:11:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971132#M97164</guid>
      <dc:creator>fuji_s_</dc:creator>
      <dc:date>2014-04-05T08:11:09Z</dc:date>
    </item>
    <item>
      <title>Quote:fuji s. wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971133#M97165</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;fuji s. wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;@Jim, I learned something. I didn't know one could do this : &lt;STRONG&gt;allocate&lt;/STRONG&gt;&amp;nbsp;(&lt;STRONG&gt;character&lt;/STRONG&gt;(length)::buf)&lt;BR /&gt;
	&lt;BR /&gt;
	...&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Do not forget to add the allocation status test as suggested by Jim:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;    ALLOCATE( CHARACTER(LEN=DesiredLength) :: buf, STAT=IntErrorCodeVar)
    IF (IntErrorCodeVar /= 0) THEN
       !.. Handle the error&lt;/PRE&gt;

&lt;P&gt;It's good to do so as a general practice, but especially important in your case as your string length will be stretching your system resources.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Apr 2014 22:57:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971133#M97165</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2014-04-05T22:57:54Z</dc:date>
    </item>
    <item>
      <title>Hello,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971134#M97166</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I tried to allocate a character string works and it works well too even when the stacksize is low.&lt;/P&gt;

&lt;P&gt;Thank you all for your help.&lt;/P&gt;

&lt;P&gt;F.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Apr 2014 07:16:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971134#M97166</guid>
      <dc:creator>fuji_s_</dc:creator>
      <dc:date>2014-04-07T07:16:25Z</dc:date>
    </item>
    <item>
      <title>You rarely have to explicitly</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971135#M97167</link>
      <description>&lt;P&gt;You rarely have to explicitly allocate an allocatable, deferred-length character value. Just assign to it and the allocation is handled automatically. However, if you are passing such a variable to a procedure which writes to it, you may need to allocate it first.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Apr 2014 14:02:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971135#M97167</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2014-04-07T14:02:22Z</dc:date>
    </item>
    <item>
      <title>You also may want to</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971136#M97168</link>
      <description>&lt;P&gt;You also may want to explicitly allocate the deferred-length character value when you know the length is very large and may experience an allocation failure. (Such as in the original poster's example.)&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Mon, 07 Apr 2014 14:12:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/What-is-the-maximum-character-length-allowed/m-p/971136#M97168</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2014-04-07T14:12:25Z</dc:date>
    </item>
  </channel>
</rss>

