LAM/MPI logo

LAM/MPI General User's Mailing List Archives

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

From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2003-05-14 14:42:32


On Mon, 12 May 2003, Pak, Anne O wrote:

> I have a mex function that i'm calling from a MATLAB script.
>
> In this MEX function, I make many different MPI calls.
>
> Recently, my MEX function has been crashing MATLAB whenever it
> encounters a call to MPI_Barrier.
>
> In the past, I have written many MEX functions that called MPI_Barrier,
> with no problems.

Is there any way that you can attach a debugger to this and see what
exactly is failing? The simple fact that you are calling MPI_Barrier
should not crash your process...

> The only difference between this MEX function and the other ones is that
> I am now declaring some of the variable to be static. Is there some
> sort of correlation between static variables and MPI_Barrier that I am
> not aware of?

There shouldn't be. It sounds like there could be some memory badness
going on here, and that the addition of the static variables shifted your
memory usage such that this symptom is now occuring.

> (If I take out the call to MPI_Barrier, then some of my programs work
> fine, but then there are some other programs where I also need to call
> MPI_Reduce. In those programs, I *have* to call MPI_Barrier before
> calling MPI_Reduce, but calling MPI_Barrier is crashing MATLAB.
> Without calling MPI_Barrier prior to caling MPI_Reducing, MATLAB is also
> crashing because the processors are not synchronized when I call
> MPI_Reduce. Big dilemma here!!!)

You should not need to syncrhonize before calling MPI_Reduce -- i.e., it
is correct MPI to have:

        MPI_Reduce(.......);

you do not need to have to:

        MPI_Barrier(...);
        MPI_Reduce(.......);

-- 
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/