Max common block size, global array size on ia32

Martin Siegert siegert at sfu.ca
Wed Jul 24 10:33:33 PDT 2002


For what it is worth: the following works on my system
(RH7.2, Linux-2.4.18, pgf90)

--------------------------------------------------
module block
integer, parameter :: k9=selected_int_kind(9)
integer(kind=k9), parameter :: size=896*1024*1024
character, allocatable :: a(:)
end module

program memtest
use block
  allocate (a(size))
  write(*,*) "hello"
end
--------------------------------------------------

whereas

--------------------------------------------------
module block
integer, parameter :: k9=selected_int_kind(9)
integer(kind=k9), parameter :: size=896*1024*1024
character :: a(size)
end module

program memtest
use block
  write(*,*) "hello"
end
--------------------------------------------------

segfaults. This is straight out of the box without any manipulation of
the stack limit or anything else.

Martin

========================================================================
Martin Siegert
Academic Computing Services                        phone: (604) 291-4691
Simon Fraser University                            fax:   (604) 291-4242
Burnaby, British Columbia                          email: siegert at sfu.ca
Canada  V5A 1S6
========================================================================

On Tue, Jul 23, 2002 at 07:51:38PM -0700, Chris Smith wrote:
> You're actually hitting the data segment limit, not the stack limit. 
> 
> I brought the array declaration inside of main() in the C program to
> force it to be allocated on the stack, bumped up the stack limit as you
> did, and the program ran. Alternatively, you can use malloc() to
> allocate this memory on the heap.
> 
> I tried bumping up the data segment limit (even though it was unlimited
> already), but still had the seg fault. Maybe this is hard limit on the
> way the process address space is carved up.
> 
> Sorry ... I don't know how to do the same kind of manipulation in
> Fortran.
> 
> -- Chris
> 
> On Tue, 2002-07-23 at 16:43, Craig Tierney wrote:
> > Sorry if this is a bit off topic.  I am not sure
> > where to ask this question.  The following
> > two codes fail on my system (Dual Xeon, 2 GB Ram,
> > Linux-2.4.18, redhat 7.2).
> > 
> > program memtest
> > 
> > integer*8 size
> > parameter(size=896*1024*1024)
> > haracter a(size)   
> > common /block/ a
> > 
> > write(*,*) "hello"
> > 
> > stop
> > end
> > 
> > OR:
> > 
> > #include<stdio.h>
> > #include<memory.h>
> > char ar[896*1024*1024];
> > 
> > int main() { printf("Hello\n"); }
> > 
> > I get a segmentation fault before the codes
> > start.  I can use ifc, icc, pgf77 and gcc and
> > get the same results.   If I change the array size to 895 MB,
> > the codes run.  If I change the C code to
> > define the array as 'static char ar[blah]' I can
> > allocate more than 895MB.
> > 
> > I have bumped up the max stack size with:
> > 
> > ulimit -Hs 2048000
> > ulimit -s 2048000
> > 
> > But this does not help.
> > 
> > I cannot find anywhere in the linux source where
> > the max stacksize might be set.  It seems that
> > it might be tied to 1 GB, but I cannot find it.
> > 
> > Does anyone know how I can get around this
> > issue?
> > 
> > Thanks,
> > Craig
> > 
> > 
> > -- 
> > Craig Tierney (ctierney at hpti.com)
> > _______________________________________________
> > Beowulf mailing list, Beowulf at beowulf.org
> > To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf
> 
> 
> 
> _______________________________________________
> Beowulf mailing list, Beowulf at beowulf.org
> To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf



More information about the Beowulf mailing list