LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Brian W. Barrett (brbarret_at_[hidden])
Date: 2003-04-15 09:43:26


On Tue, 15 Apr 2003, Andrej Bagon wrote:

> I noticed a problem or an arhitecture limit or something. It will be
> best described on an example.
>
> using
> int a[2000000];
>
> and then using
> MPI_Gather or
> MPI_Bcast the array my application crashes (segfault). I dont know why,
> but when using
>
> int *a;
> a = malloc(2000000*sizeof(int));
>
> and then using MPI_Gather or MPI_Bcast lam works without a problem. What
> kind of problem is this?

This is most likely a stack size problem. You are trying to allocate
about 8MB of data on the stack in the first example, which may be enough
to overflow the stack (and therefore cause a segfault). With the second
example, you move the array down into the heap, so you are much less
likely to overflow.

There isn't any "solution" to this issue, other than to allocate your
large arrays on the heap. :)

> BTW: anyone practiced anything with Global Arrays? I mean what is it
> good for and when it is better utilized than LAM (but again GA uses LAM
> to distribute).

I have not used Global Arrays. However, a quick glance at the project
would lead me to the conclusion that if you want to implement a program
that used a shared memory paradigm, Global Arrays is an option. If you
want straight message passing, LAM/MPI is a good choice.

Hope this helps,

Brian

-- 
  Brian Barrett
  LAM/MPI developer and all around nice guy
  Have a LAM/MPI day: http://www.lam-mpi.org/