public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: large array, ia64, "segmentation fault"
@ 2004-11-29  9:12 Luck, Tony
  0 siblings, 0 replies; 8+ messages in thread
From: Luck, Tony @ 2004-11-29  9:12 UTC (permalink / raw)
  To: Discussion of Linux on the Intel IA-64 processor,
	gcc mail-list gcc, RHEL3 RHEL3


>Excuse me , In the REHL3 64bit platform ,how many can
>i increase the stack size? I mean the maximum size.

Use "ulimit -s {size}" ... you need to be "root" to increase
the limit.  The default seems to be 10MB:

 $ ulimit -s
 10240

-Tony

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: large array, ia64, "segmentation fault"
  2004-11-29 19:15     ` David Mosberger
@ 2004-11-29 19:30       ` Joe Buck
  0 siblings, 0 replies; 8+ messages in thread
From: Joe Buck @ 2004-11-29 19:30 UTC (permalink / raw)
  To: davidm
  Cc: Discussion of Linux on the Intel IA-64 processor,
	gcc mail-list gcc, RHEL3 RHEL3

On Mon, Nov 29, 2004 at 10:53:03AM -0800, David Mosberger wrote:
> >>>>> On Sat, 27 Nov 2004 11:27:30 +0800 (CST), hx w <ye_hx_w@yahoo.com.cn> said:
> 
>   hx> Excuse me , In the REHL3 64bit platform ,how many can
>   hx> i increase the stack size? I mean the maximum size.
> 
> Depends on the shell.  With bash:
> 
> 	$ ulimit -s unlimited

Off topic, but risky advice has just been given.

This is not advisable, unless you want to risk waking the OOM-killer when
you accidentally write an infinite recursion.  At one time, "unlimited"
was the default in seveal GNU/Linux distros, and I ran into this problem
several times.

I would suggest choosing a limit that leaves room in your swap file in
case some program decides to use all the stack you allow it.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: large array, ia64, "segmentation fault"
  2004-11-27  8:27   ` hx w
  2004-11-27 23:42     ` Mike Stump
@ 2004-11-29 19:15     ` David Mosberger
  2004-11-29 19:30       ` Joe Buck
  1 sibling, 1 reply; 8+ messages in thread
From: David Mosberger @ 2004-11-29 19:15 UTC (permalink / raw)
  To: Discussion of Linux on the Intel IA-64 processor
  Cc: gcc mail-list gcc, RHEL3 RHEL3

>>>>> On Sat, 27 Nov 2004 11:27:30 +0800 (CST), hx w <ye_hx_w@yahoo.com.cn> said:

  hx> Excuse me , In the REHL3 64bit platform ,how many can
  hx> i increase the stack size? I mean the maximum size.

Depends on the shell.  With bash:

	$ ulimit -s unlimited

  --david

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: large array, ia64, "segmentation fault"
  2004-11-27 23:42     ` Mike Stump
@ 2004-11-28  3:50       ` Dave Korn
  0 siblings, 0 replies; 8+ messages in thread
From: Dave Korn @ 2004-11-28  3:50 UTC (permalink / raw)
  To: 'Mike Stump', 'hx w'
  Cc: 'gcc mail-list gcc', 'ia64', 'RHEL3 RHEL3'

> -----Original Message-----
> From: gcc-owner On Behalf Of Mike Stump
> Sent: 27 November 2004 21:50
> To: hx w
> Cc: gcc mail-list gcc; ia64; RHEL3 RHEL3
> Subject: Re: large array, ia64, "segmentation fault"
> 
> On Friday, November 26, 2004, at 07:27  PM, hx w wrote:
> > Excuse me , In the REHL3 64bit platform ,how many can
> > i increase the stack size?
> 
> See ulimit -a (ulimit -s).
> 

  We can even drag this (marginally) back OT for the gcc list by suggesting
he compile with the "-Wl,--stack=<some huge number>" flag :)



    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....
 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: large array, ia64, "segmentation fault"
  2004-11-27  8:27   ` hx w
@ 2004-11-27 23:42     ` Mike Stump
  2004-11-28  3:50       ` Dave Korn
  2004-11-29 19:15     ` David Mosberger
  1 sibling, 1 reply; 8+ messages in thread
From: Mike Stump @ 2004-11-27 23:42 UTC (permalink / raw)
  To: hx w; +Cc: gcc mail-list gcc, ia64, RHEL3 RHEL3

On Friday, November 26, 2004, at 07:27  PM, hx w wrote:
> Excuse me , In the REHL3 64bit platform ,how many can
> i increase the stack size?

See ulimit -a (ulimit -s).

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: large array, ia64, "segmentation fault"
  2004-11-27  2:46 ` Peter Barada
@ 2004-11-27  8:27   ` hx w
  2004-11-27 23:42     ` Mike Stump
  2004-11-29 19:15     ` David Mosberger
  0 siblings, 2 replies; 8+ messages in thread
From: hx w @ 2004-11-27  8:27 UTC (permalink / raw)
  To: gcc mail-list gcc, ia64, RHEL3 RHEL3

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb2312, Size: 1084 bytes --]


Excuse me , In the REHL3 64bit platform ,how many can
i increase the stack size? I mean the maximum size.

Thanks!!


 --- Peter Barada <peter@the-baradas.com> µÄÕýÎÄ£º
> 
> >I compile a source , when N=100, everything is
> good;
> >but 
> >when i modify N=1000, i got the info: segmentation
> >fault. i am using icc 8.1.
> >
> >My sys info:
> >RHEL3-64bit update 2.
> >2.4.21-4.EL kernel
> >4-way Iatnium2 .
> >8G RAM.
> 
> You're trying to allocate a *large* amount of data
> off the stack int
> hte function main, probably enought to blow the
> limit on the stack
> size.  Look up the manual page for 'ulimit' and use
> that command (with
> the appropriate parameters) to increase the stack
> size limit
> 
> Your other choice is to move the definition oft
> A,B,C outside of main
> so they will be declared globally...
> 
> -- 
> Peter Barada
> peter@the-baradas.com
>  

_________________________________________________________
Do You Yahoo!?
×¢²áÊÀ½çÒ»Á÷Æ·ÖʵÄÑÅ»¢Ãâ·ÑµçÓÊ
http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: large array, ia64, "segmentation fault"
  2004-11-27  2:43 hx w
@ 2004-11-27  2:46 ` Peter Barada
  2004-11-27  8:27   ` hx w
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Barada @ 2004-11-27  2:46 UTC (permalink / raw)
  To: ye_hx_w; +Cc: gcc, ia64-list, Taroon-list


>I compile a source , when N=100, everything is good;
>but 
>when i modify N=1000, i got the info: segmentation
>fault. i am using icc 8.1.
>
>My sys info:
>RHEL3-64bit update 2.
>2.4.21-4.EL kernel
>4-way Iatnium2 .
>8G RAM.

You're trying to allocate a *large* amount of data off the stack int
hte function main, probably enought to blow the limit on the stack
size.  Look up the manual page for 'ulimit' and use that command (with
the appropriate parameters) to increase the stack size limit

Your other choice is to move the definition oft A,B,C outside of main
so they will be declared globally...

-- 
Peter Barada
peter@the-baradas.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* large array, ia64, "segmentation fault"
@ 2004-11-27  2:43 hx w
  2004-11-27  2:46 ` Peter Barada
  0 siblings, 1 reply; 8+ messages in thread
From: hx w @ 2004-11-27  2:43 UTC (permalink / raw)
  To: gcc mail-list gcc, ia64, RHEL3 RHEL3

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb2312, Size: 1776 bytes --]


I compile a source , when N=100, everything is good;
but 
when i modify N=1000, i got the info: segmentation
fault. i am using icc 8.1.

My sys info:
RHEL3-64bit update 2.
2.4.21-4.EL kernel
4-way Iatnium2 .
8G RAM.

So, does any one meet the same thing as me? What cause
the error info? And how cuold i do to resolve it?

Thanks !
£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½
#include <stdio.h>
#include <sys/time.h>
#include <stdlib.h>

#define  N 1000
void Input(double A[N][N], double B[N][N]);
void MultiplyS(double A[][N], double B[][N], double
C[][N]);

int main()
{
    int i,j,k;
    double A[N][N],B[N][N],C[N][N];
    struct timeval start_time,end_time;
    double  elapsed_time;

    gettimeofday(&start_time,NULL);
    Input(A,B);
    MultiplyS(A,B,C);
    gettimeofday(&end_time,NULL);
   
elapsed_time=1000000*(end_time.tv_sec-start_time.tv_sec)+
end_time.tv_usec-start_time.tv_usec;
    elapsed_time/=1000000;

    printf("Used Time:%f seconds\n",elapsed_time);

    return 0;
}


void Input(double A[N][N],double B[N][N])
{
   int i,j;
   for( i=0; i<N; i++)
     for( j=0; j<N; j++)
     {
       A[i][j] = 1;
       B[i][j] = 0.8;
     }
  }

void MultiplyS(double A[][N], double B[][N], double
C[][N])
{
   int i,j,k;
   for(i=0; i<N; i++)
      for( j=0; j<N; j++)
      {
        C[i][j] = 0;
        for( k=0; k<N; k++)
           C[i][j]+= (A[i][k]* B[k][j]);
      }
}
£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½

_________________________________________________________
Do You Yahoo!?
×¢²áÊÀ½çÒ»Á÷Æ·ÖʵÄÑÅ»¢Ãâ·ÑµçÓÊ
http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-11-29 19:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-29  9:12 large array, ia64, "segmentation fault" Luck, Tony
  -- strict thread matches above, loose matches on Subject: below --
2004-11-27  2:43 hx w
2004-11-27  2:46 ` Peter Barada
2004-11-27  8:27   ` hx w
2004-11-27 23:42     ` Mike Stump
2004-11-28  3:50       ` Dave Korn
2004-11-29 19:15     ` David Mosberger
2004-11-29 19:30       ` Joe Buck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).